首页 技术 正文
技术 2022年11月16日
0 收藏 746 点赞 4,469 浏览 1750 个字

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)…

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,077
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,552
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,401
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,813
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,896