Multi-desktop

Aura now makes it possible for the same browser process to render to multiple desktops simultaneously (e.g., Native Desktop and Metro Desktop on Windows 8).

 
To enable this, the Chromium codebase had to be made multi-desktop aware (i.e., chrome::HostDesktopType parameters were added in several locations).
 
So... a bunch of methods now take chrome::HostDesktopType, but how do you get the right HostDesktopType when you need to provide one?
There are many ways:
  1. If you have a Browser: take its host_desktop_type() member.
  2. If you have a gfx::NativeView: use chrome::GetHostDesktopTypeForNativeView().
  3. If you have a gfx::NativeWindow: use chrome::GetHostDesktopTypeForNativeWindow().
  4. If you have a WebContents* w: you can use (2) passing in w->GetNativeView()  OR you might be able to get a Browser with chrome::FindBrowserWithWebContents() and use (1)
  5. If all else fails and you have absolutely NO way of getting desktop context (e.g., a background extension that wants to open a new window...): you can use chrome::GetActiveDesktop() to get the type of the last user-activated Chrome desktop, but be aware that this is inherently racy (i.e., the user can switch desktops at any time) -- If you are in a test, it is OK to use GetActiveDesktop() since almost all tests run on a single desktop making GetActiveDesktop() constant.
  6. You should almost never hardcode HOST_DESKTOP_TYPE_X constants.
  7. If you work on Chrome OS and your code is under ash/, please use HOST_DESKTOP_TYPE_ASH (this is the same as HOST_DESKTOP_TYPE_NATIVE on Chrome OS, but not on other platforms).
Most of the methods mentioned above are found in src/chrome/browser/ui/host_desktop.h.
 
Note: If you hardcode HOST_DESKTOP_TYPE_NATIVE it will look like it's working if you're in a single-desktop environment (which most of you are), but what it will really do is: one day someone will trigger your feature from the Ash desktop (e.g., in Windows 8 Metro) and it will open a window/tab on the native desktop (invisible to the user who is immersed in the Ash environment)...

最新文章

  1. jQuery+CSS3文字跑马灯特效
  2. 【ueditor】api方法
  3. 1001. A+B Format (20)
  4. Ubuntu Gnome 14.04.2 lts 折腾笔记
  5. C++ dll 通用dll编写
  6. mysql数据库版本引发的问题
  7. 适配IOS9中间遇到的一些问题
  8. ASP.Net MVC利用NPOI导入导出Excel
  9. android 深入研究ratingbar自定义
  10. Hadoop概念学习系列之URI深入(三十二)
  11. Linux kernel ‘qeth_snmp_command’函数缓冲区溢出漏洞
  12. SQLCLR
  13. poj1023
  14. jquery插件FlexiGrid的使用
  15. python-networkx学习(1)
  16. AD16 PCB重新定义板型时没有Redefine Board Shape
  17. DataGridView的单元格如何嵌入多个按钮控件
  18. goaccess nginx 日志分析
  19. TensorFlow加载图片的方法
  20. CentOS6最佳实践

热门文章

  1. updatefile.sh - Linux下代码更新脚本
  2. WebRTC代码走读(八):代码文件夹结构
  3. 143.vector模板库
  4. 报表工具Report Builder 3.0的安装
  5. (转载)Android引导界面实现
  6. Servlet学习(一)——Servlet的生命周期、执行过程、配置
  7. String Comparison(C#)
  8. js闭包详解-转自好友trigkit4
  9. 复制excel表,往excel表中写入数据
  10. Uncaught TypeError: Cannot read property 'offsetTop' of undefined at VueComponent.handleScroll