Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: chrome/browser/ui/host_desktop.cc

Issue 1637943003: Remove HostDesktopType from BrowserList::GetInstance() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screen-wrapper-land
Patch Set: mac2 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/host_desktop.h" 5 #include "chrome/browser/ui/host_desktop.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/ui/ash/ash_util.h"
9 #include "chrome/browser/ui/aura/active_desktop_monitor.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_list.h"
12
13 #if defined(OS_WIN)
14 #include <windows.h>
15 #endif
16
17 #if defined(USE_ASH)
18 #include "ash/shell.h"
19 #endif
20 8
21 namespace chrome { 9 namespace chrome {
22 10
23 HostDesktopType GetHostDesktopTypeForNativeView(gfx::NativeView native_view) { 11 HostDesktopType GetHostDesktopTypeForNativeView(gfx::NativeView native_view) {
24 #if defined(USE_ASH) 12 // TODO(scottmg): This file is being removed: http://crbug.com/558054.
25 // TODO(ananta)
26 // Once we've threaded creation context to wherever needed, we should remove
27 // this check here.
28 #if defined(OS_WIN)
29 if (!native_view)
30 return GetActiveDesktop();
31 #endif
32 return IsNativeViewInAsh(native_view) ?
33 HOST_DESKTOP_TYPE_ASH :
34 HOST_DESKTOP_TYPE_NATIVE;
35 #else
36 return HOST_DESKTOP_TYPE_NATIVE; 13 return HOST_DESKTOP_TYPE_NATIVE;
37 #endif
38 } 14 }
39 15
40 HostDesktopType GetHostDesktopTypeForNativeWindow( 16 HostDesktopType GetHostDesktopTypeForNativeWindow(
41 gfx::NativeWindow native_window) { 17 gfx::NativeWindow native_window) {
42 #if defined(USE_ASH) 18 // TODO(scottmg): This file is being removed: http://crbug.com/558054.
43 // TODO(ananta)
44 // Once we've threaded creation context to wherever needed, we should remove
45 // this check here.
46 #if defined(OS_WIN)
47 if (!native_window)
48 return GetActiveDesktop();
49 #endif
50 return IsNativeWindowInAsh(native_window) ?
51 HOST_DESKTOP_TYPE_ASH :
52 HOST_DESKTOP_TYPE_NATIVE;
53 #else
54 return HOST_DESKTOP_TYPE_NATIVE; 19 return HOST_DESKTOP_TYPE_NATIVE;
55 #endif
56 } 20 }
57 21
58 HostDesktopType GetActiveDesktop() { 22 HostDesktopType GetActiveDesktop() {
59 #if defined(USE_ASH) && !defined(OS_CHROMEOS) 23 // TODO(scottmg): This file is being removed: http://crbug.com/558054.
60 // The Ash desktop is considered active if a non-desktop RootWindow was last
61 // activated and the Ash desktop is still open. As it is, the Ash desktop
62 // will be considered the last active if a user switches from metro Chrome to
63 // the Windows desktop but doesn't activate any Chrome windows there (e.g.,
64 // by clicking on one or otherwise giving one focus). Consider finding a way
65 // to detect that the Windows desktop has been activated so that the native
66 // desktop can be considered active once the user switches to it if its
67 // BrowserList isn't empty.
68 if ((ActiveDesktopMonitor::GetLastActivatedDesktopType() ==
69 chrome::HOST_DESKTOP_TYPE_ASH) &&
70 ash::Shell::HasInstance()) {
71 return HOST_DESKTOP_TYPE_ASH;
72 }
73 #endif
74 return HOST_DESKTOP_TYPE_NATIVE; 24 return HOST_DESKTOP_TYPE_NATIVE;
75 } 25 }
76 26
77 } // namespace chrome 27 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/host_desktop.h ('k') | chrome/browser/ui/startup/startup_browser_creator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698