#include "StdAfx.h"
#include "TestCefAPP.h"
#include "include/cef_browser.h"
#include "include/cef_command_line.h"
#include "include/views/cef_browser_view.h"
#include "include/views/cef_window.h"
#include "include/wrapper/cef_helpers.h"
#include "TestCefHandler.h"
TestCefAPP::TestCefAPP(void)
{
}
TestCefAPP::~TestCefAPP(void)
{
}
namespace {
// When using the Views framework this object provides the delegate
// implementation for the CefWindow that hosts the Views-based browser.
class SimpleWindowDelegate : public CefWindowDelegate {
public:
explicit SimpleWindowDelegate(CefRefPtr<CefBrowserView> browser_view)
: browser_view_(browser_view) {
}
void OnWindowCreated(CefRefPtr<CefWindow> window) OVERRIDE {
// Add the browser view and show the window.
window->AddChildView(browser_view_);
window->Show();
// Give keyboard focus to the browser view.
browser_view_->RequestFocus();
}
void OnWindowDestroyed(CefRefPtr<CefWindow> window) OVERRIDE {
browser_view_ = NULL;
}
bool CanClose(CefRefPtr<CefWindow> window) OVERRIDE {
// Allow the window to close if the browser says it's OK.
CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser();
if (browser)
return browser->GetHost()->TryCloseBrowser();
return true;
}
private:
CefRefPtr<CefBrowserView> browser_view_;
IMPLEMENT_REFCOUNTING(SimpleWindowDelegate);
DISALLOW_COPY_AND_ASSIGN(SimpleWindowDelegate);
};
} // namespace
void TestCefAPP::OnContextInitialized() {
CEF_REQUIRE_UI_THREAD();
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
#if defined(OS_WIN) || defined(OS_LINUX)
// Create the browser using the Views framework if "--use-views" is specified
// via the command-line. Otherwise, create the browser using the native
// platform framework. The Views framework is currently only supported on
// Windows and Linux.
const bool use_views = command_line->HasSwitch("use-views");
#else
const bool use_views = false;
#endif
// SimpleHandler implements browser-level callbacks.
CefRefPtr<TestCefHandler> handler(new TestCefHandler(use_views));
// Specify CEF browser settings here.
CefBrowserSettings browser_settings;
std::string url;
// Check if a "--url=" value was provided via the command-line. If so, use
// that instead of the default URL.
url = command_line->GetSwitchValue("url");
if (url.empty())
{
//url = "file:///C:/Users/Administrator/Desktop/flash/test.html";
url = "www.baidu.com";
}
if (use_views) {
// Create the BrowserView.
CefRefPtr<CefBrowserView> browser_view = CefBrowserView::CreateBrowserView(
handler, url, browser_settings, NULL, NULL, NULL);
// Create the Window. It will show itself after creation.
CefWindow::CreateTopLevelWindow(new SimpleWindowDelegate(browser_view));
}
else {
// Information used when creating the native window.
CefWindowInfo window_info;
#if defined(OS_WIN)
// On Windows we need to specify certain flags that will be passed to
// CreateWindowEx().
window_info.SetAsPopup(NULL, "cefsimple");
#endif
// Create the first browser window.
CefBrowserHost::CreateBrowser(window_info, handler, url, browser_settings,
NULL, NULL);
}
}
void TestCefAPP::OnBeforeCommandLineProcessing(const CefString & process_type, CefRefPtr<CefCommandLine> command_line)
{
//加载flash插件
command_line->AppendSwitchWithValue("--ppapi-flash-path", "pepflashplayer32_32_0_0_207.dll");
//manifest.json中的version
command_line->AppendSwitchWithValue("--ppapi-flash-version", "32.0.0.207");
//使用系统flash
//command_line->AppendSwitchWithValue("enable-system-flash", "true");
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
C++内嵌浏览器CEF组件 (456个子文件)
TestCef.aps 94KB
v8_context_snapshot.bin 848KB
v8_context_snapshot.bin 599KB
snapshot_blob.bin 530KB
snapshot_blob.bin 281KB
natives_blob.bin 81KB
natives_blob.bin 81KB
applicationhost.config 83KB
TestCefAPP.cpp 4KB
TestCefHandler.cpp 4KB
TestCef.cpp 3KB
stdafx.cpp 211B
icudtl.dat 9.93MB
icudtl.dat 9.93MB
data_0 44KB
data_1 264KB
data_2 8KB
data_3 4.01MB
Browse.VC.db 35.62MB
libcef.dll 124.13MB
libcef.dll 91.61MB
pepflashplayer32_32_0_0_207.dll 17.12MB
pepflashplayer32_32_0_0_207.dll 17.12MB
libGLESv2.dll 6.3MB
libGLESv2.dll 4.65MB
d3dcompiler_47.dll 3.49MB
d3dcompiler_47.dll 3.49MB
libGLESv2.dll 2.9MB
libGLESv2.dll 2.88MB
chrome_elf.dll 815KB
chrome_elf.dll 745KB
libEGL.dll 334KB
libEGL.dll 333KB
libEGL.dll 310KB
libEGL.dll 310KB
TestCef.exe 3.46MB
TestCef.exe 544KB
dummy_cmd.exe 0B
dummy_cmd.exe 0B
TestCef.vcxproj.filters 2KB
cef_pack_strings.h 262KB
cef_bind_internal.h 118KB
cef_types.h 84KB
cef_pack_resources.h 73KB
cef_tuple.h 57KB
cef_v8_capi.h 37KB
cef_browser_capi.h 36KB
cef_net_error_list.h 35KB
cef_v8.h 33KB
cef_browser.h 33KB
cef_callback.h 33KB
cef_types_wrappers.h 30KB
cef_logging.h 29KB
cef_bind.h 29KB
cef_values_capi.h 27KB
cef_scoped_ptr.h 24KB
cef_values.h 23KB
cef_translator_test_capi.h 23KB
cef_string_wrappers.h 23KB
cef_trace_event.h 22KB
cef_translator_test.h 20KB
cef_bind_helpers.h 19KB
cef_menu_model_capi.h 19KB
cef_message_router.h 18KB
cef_request_context_capi.h 16KB
cef_menu_model.h 16KB
cef_server_capi.h 15KB
cef_request_context.h 15KB
cef_view_capi.h 14KB
cef_resource_manager.h 14KB
cef_callback_list.h 14KB
cef_server.h 14KB
cef_weak_ptr.h 13KB
cef_view.h 12KB
cef_bind_internal_win.h 12KB
cef_request_handler_capi.h 12KB
cef_resource_request_handler.h 12KB
cef_resource_request_handler_capi.h 12KB
cef_request_capi.h 12KB
cef_request_handler.h 12KB
cef_context_menu_handler_capi.h 11KB
cef_move.h 11KB
cef_life_span_handler_capi.h 11KB
cef_life_span_handler.h 11KB
cef_render_handler_capi.h 11KB
cef_window_capi.h 11KB
cef_dom_capi.h 11KB
cef_xml_reader_capi.h 10KB
cef_request.h 10KB
cef_render_handler.h 10KB
cef_cancelable_callback.h 10KB
cef_context_menu_handler.h 10KB
cef_ref_counted.h 10KB
cef_textfield_capi.h 10KB
cef_frame_capi.h 9KB
cef_resource_handler_capi.h 9KB
cef_window.h 9KB
cef_extension_handler_capi.h 9KB
cef_string16.h 9KB
cef_atomicops.h 9KB
共 456 条
- 1
- 2
- 3
- 4
- 5
资源评论
N89757
- 粉丝: 3
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MineAdmin是基于Hyperf框架 和 Vue3+Vite5 开发的前后端分离权限管理系统,自适应多终端 特色:后端 crud 生成 + 前端低代码 json 化配置.zip
- Preact前端框架,一键部署到云开发平台.zip
- bpi flash读ID程序
- Lessgo 是一款简单、稳定、高效、灵活的 golang web 开发框架,支持动态路由、自动化API测试文档、热编译、热更新等,实现前后端分离、系统与业务分离.zip
- 2019计算机联考408代码题
- easyink的前端服务之一,基于企业微信JS-SDK开发的企微客户端侧边栏页面.zip
- DRF-ADMIN后台管理系统项目(端代码).zip
- micro-app-chrome-plugin是基于京东零售推出的一款为micro-app框架而开发的chrome插件.zip
- front-end project template 前端快速开发模版.zip
- LaravelAdmin,简洁、直观、强悍的前端后端开发框架,让全栈开发更迅速的SPA单页面应用.LaravelAdmin,LaravelAdmin官网.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功