Cef开发学习 - Windows平台简易的Cef浏览器,支持下载管理和多标签管理

PS:本系列文章主要学习介绍Cef开发相关的内容。


文章目录

  • Cef开发学习 - Windows平台简易的Cef浏览器,支持下载管理和多标签管理
  • 一、浏览器内核
  • 二、浏览器UI
  • 三、浏览器演示
  • 四、浏览器例子下载
  • 总结

一、浏览器内核

本程序使用的Cef开发内核库的版本为libcef 3809,重新编译的后的3809库支持MP4视频播放。

class ICefBrowserHandler
{
public:virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,int httpStatusCode){}virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) { }virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,const CefString& target_url,const CefString& target_frame_name,cef_window_open_disposition_t target_disposition,bool user_gesture,const CefPopupFeatures& popupFeatures,CefWindowInfo& windowInfo,CefRefPtr<CefClient>& client,CefBrowserSettings& settings,CefRefPtr<CefDictionaryValue>& extra_info,bool* no_javascript_access) { return true; }///// Called when a frame's address has changed.////*--cef()--*/virtual void OnAddressChange(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,const CefString& url) {}///// Called when the page title changes.////*--cef(optional_param=title)--*/virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,const CefString& title) {}///// Called when the page icon changes.////*--cef(optional_param=icon_urls)--*/virtual void OnFaviconURLChange(CefRefPtr<CefBrowser> browser,const std::vector<CefString>& icon_urls) {}///// Called when web content in the page has toggled fullscreen mode. If// |fullscreen| is true the content will automatically be sized to fill the// browser content area. If |fullscreen| is false the content will// automatically return to its original size and position. The client is// responsible for resizing the browser if desired.////*--cef()--*/virtual void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,bool fullscreen) {}///// Called when the browser is about to display a tooltip. |text| contains the// text that will be displayed in the tooltip. To handle the display of the// tooltip yourself return true. Otherwise, you can optionally modify |text|// and then return false to allow the browser to display the tooltip.// When window rendering is disabled the application is responsible for// drawing tooltips and the return value is ignored.////*--cef(optional_param=text)--*/virtual bool OnTooltip(CefRefPtr<CefBrowser> browser,CefString& text) { return false; }///// Called when the browser receives a status message. |value| contains the// text that will be displayed in the status message.////*--cef(optional_param=value)--*/virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser,const CefString& value) {}///// Called to display a console message. Return true to stop the message from// being output to the console.////*--cef(optional_param=message,optional_param=source)--*/virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,const CefString& message,const CefString& source,int line) { return false; }
};

二、浏览器UI

本程序使用开源的Duilib库作为浏览器的UI开发库,实现了浏览器多窗口、多标签、下载管理的各个模块。
1、Cef浏览器控件

class CCefBrowserUI : public CControlUI, public IMessageFilterUI
{
public:CCefBrowserUI();~CCefBrowserUI();public:LPCTSTR GetClass() const;LPVOID GetInterface(LPCTSTR pstrName);public:void SetPos(RECT rc, bool bNeedInvalidate = true);void SetVisible(bool bVisible /* = true */);void SetInternVisible(bool bVisible);void DoEvent(TEventUI& event);
}

2、多标签管理

class CBrowserTabBar : public CContainerUI
{
public:CBrowserTabBar();~CBrowserTabBar();public:LPCTSTR GetClass() const;LPVOID GetInterface(LPCTSTR pstrName);void SetPos(RECT rc, bool bNeedInvalidate = true);public:bool Add(CControlUI* pControl);bool AddAt(CControlUI* pControl, int iIndex);void Invalidate();void SetStartTab(int nStart);void SelectTab(CBrowserTab *pTab);void SelectTab(int nIndex);void CloseTab(CBrowserTab *pTab, BOOL bPrevSelected = TRUE);int GetTabCount();int GetVisibleTabCount();CBrowserTab* GetTab(int nIndex);int GetTabIndex(CBrowserTab *pTab);CBrowserTab* GetPrevTab(CBrowserTab *pTab);CBrowserTab* GetNextTab(CBrowserTab *pTab);private:void UpdatePostPaint(CBrowserTab *pTab);private:int m_nStartTab;int m_nSelectedTab;
};

三、浏览器演示

Cef浏览器

四、浏览器例子下载

Cef浏览器下载

总结

随着桌面软件开发的移动化和Web化,集成Cef后,极大的提高了前端复杂项目的开发效率,核心代码一次编译,多平台共享使用!

Cef开发学习 - Windows平台简易的Cef浏览器,支持下载管理和多标签管理相关推荐

  1. Android开发学习——3.平台版本、SDK版本、API级别

    文章目录 一.引言 二.概念学习 1. 平台版本 2. API级别 3. SDK版本 三.参考 一.引言 前两篇文介绍了Android开发的IDE--AS和AS安装时需要准备的工具包.某种程度上来说, ...

  2. Google Chrome Windows平台稳定版离线安装包下载

    以后从此处下载[https://tools.shuax.com/chrome/] Google Chrome 49.0.2623.112 Stable版(支持Windows XP的最终版) 32位版谷 ...

  3. windows平台VR全景播放器,支持图片视频,rtsp,rtmp,http,udp,hls等网络格式

    QQ: 515311445 先上下载链接:点击下载VR全景播放器 本工具使用开源的vlc做为核心播放器,添加全景代码而成,编译vlc时建议使用linux电脑编译,目前vlc已经支持全景图片和视频了,但 ...

  4. Windows平台Go语言环境搭建

    官网:https://golang.google.cn/dl/ 使用 Go 构建简单.安全.可扩展的系统 "当时,没有一个团队成员知道 Go,但在一个月内,每个人都在用 Go 编写,我们正在 ...

  5. Dart开发(一)Windows平台环境搭建

    Dart开发Windows平台环境搭建 SDK官网下载地址:https://gekorm.com/dart-windows/ 安装完成后,在命令行输入:dart --version,安装成功会出现相应 ...

  6. 初级java开发学习路线_成为初级全栈Web开发人员的10分钟路线图

    初级java开发学习路线 So you have started your journey into the world of web development. But what do you lea ...

  7. Windows平台摄像头或屏幕RTMP推送:OBS VS SmartPublisher

    好多开发者问道,既然有了OBS,你们为什么还要开发SmartPublisher? 的确,在我们进行Windows平台RTMP推送模块开发之前,市面上为数不多的Windows平台RTMP推流工具当属OB ...

  8. swift文档_Swift 正式进入 Windows 平台

    作者 | Saleem Abdulrasool  来源 | swift.org/blog,点击阅读原文查看作者更多文章 Swift 项目为 Windows 平台引入了新的可下载 Swift 工具链镜像 ...

  9. 四大浏览器再战Windows平台:Opera勇夺第一

    Firefox 7.0正式发布了,Firefox的这一新版主要对性能进行了提升,功能方面的变动并不大.此时,又是一次浏览器速度测试的良机,LifeHacker选取了Windows平台上的四大浏览器,对 ...

最新文章

  1. java大文件读写操作,java nio 之MappedByteBuffer,高效文件/内存映射
  2. Android.mk文件语法规范及使用模板 (转载)
  3. 利用ATL创建com组件和如何在程序中使用组件的接口函数和设置接口的属性
  4. netty做一个posp的网络_皑云网络——接手一个新的SEM竞价账户怎么做?
  5. CentOS7升级JDK
  6. (转)【SpringMvc】如何使用form发送PUT和DELETE请求
  7. 周敏教授计算机编码与密码学,中国科学院计算机与控制学院博士生导师:张玉清教授...
  8. angularJs中的发送请求例子
  9. 怎么看外文文献的影响因子_如何查询外文期刊的影响因子?
  10. cron表达式案例+cron在线生成器
  11. vue中实现分片大文件上传
  12. 测试人员的绩效考核,看看你有哪些没做好
  13. 2019大数据未来七大发展方向
  14. ERP失败案例:业务流程再造失误
  15. DHCP的工作原理及过程
  16. 推荐一个朋友 - 学历不好,非科班,不负光阴终进大厂
  17. Android 蓝牙自动打开并扫描设备,以及获取对方蓝牙设备的种类
  18. 什么是智能客服?智能客服能做到什么?
  19. flutter pod install报错:[BUG] Bus Error at 0x00000001001b8000 ruby 2.6.3p62 (2019-04-16 revision 67580
  20. 强悍!基于Vue的无渲染的富文本编辑器——tiptap!

热门文章

  1. Geek-10h-re-wp
  2. [附源码]计算机毕业设计springboot咖啡销售平台
  3. 用c语言实现矩阵的转置算法,C++实现矩阵原地转置算法
  4. 数学/数论专题-学习笔记:狄利克雷卷积
  5. python怎么设置随机数种子_python实验随机种子的设置
  6. 88E1111使用记录
  7. 百事可乐AI人工智能生产过程破光
  8. react-router如何配置可选参数
  9. R语言 dataframe 取指定行列filter 随机取数
  10. 寒门如何出贵子(摘抄)