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

Side by Side Diff: chrome/browser/ui/ash/ash_util.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tidy Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/ash/ash_util.h" 5 #include "chrome/browser/ui/ash/ash_util.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "chrome/browser/ui/ash/ash_init.h" 8 #include "chrome/browser/ui/ash/ash_init.h"
9 #include "chrome/browser/ui/host_desktop.h"
9 #include "ui/aura/root_window.h" 10 #include "ui/aura/root_window.h"
11 #include "ui/gfx/screen.h"
10 12
11 namespace chrome { 13 namespace chrome {
12 14
13 bool IsNativeViewInAsh(gfx::NativeView native_view) { 15 bool IsNativeViewInAsh(gfx::NativeView native_view) {
14 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
15 // Optimization. There is only ash on ChromeOS. 17 // Optimization. There is only ash on ChromeOS.
16 return true; 18 return true;
17 #endif 19 #endif
18 20
19 if (!ash::Shell::HasInstance()) 21 if (!ash::Shell::HasInstance())
20 return false; 22 return false;
21 23
22 ash::Shell::RootWindowList root_windows = 24 ash::Shell::RootWindowList root_windows =
23 ash::Shell::GetInstance()->GetAllRootWindows(); 25 ash::Shell::GetInstance()->GetAllRootWindows();
24 26
25 for (ash::Shell::RootWindowList::const_iterator it = root_windows.begin(); 27 for (ash::Shell::RootWindowList::const_iterator it = root_windows.begin();
26 it != root_windows.end(); ++it) { 28 it != root_windows.end(); ++it) {
27 if ((*it)->Contains(native_view)) 29 if ((*it)->Contains(native_view))
28 return true; 30 return true;
29 } 31 }
30 32
31 return false; 33 return false;
32 } 34 }
33 35
34 bool IsNativeWindowInAsh(gfx::NativeWindow native_window) { 36 bool IsNativeWindowInAsh(gfx::NativeWindow native_window) {
35 return IsNativeViewInAsh(native_window); 37 return IsNativeViewInAsh(native_window);
36 } 38 }
37 39
38 void ToggleAshDesktop() { 40 void ToggleAshDesktop() {
41 ScopedForceDesktopType force_ash(HOST_DESKTOP_TYPE_ASH);
42 gfx::Screen::ForceScreenTypeOverride(gfx::SCREEN_TYPE_ALTERNATE);
39 if (!ash::Shell::HasInstance()) 43 if (!ash::Shell::HasInstance())
40 OpenAsh(); 44 OpenAsh();
41 else 45 else
42 CloseAsh(); 46 CloseAsh();
47 gfx::Screen::ForceScreenTypeOverride(gfx::SCREEN_TYPE_COUNT);
43 } 48 }
44 49
45 } // namespace chrome 50 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698