OLD | NEW |
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/views/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" |
6 | 6 |
7 #include "ash/launcher/launcher_types.h" | 7 #include "ash/launcher/launcher_types.h" |
8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.h" |
9 #include "ash/wm/partial_screenshot_view.h" | 9 #include "ash/wm/partial_screenshot_view.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 void ChromeShellDelegate::Exit() { | 108 void ChromeShellDelegate::Exit() { |
109 BrowserList::AttemptUserExit(); | 109 BrowserList::AttemptUserExit(); |
110 } | 110 } |
111 | 111 |
112 void ChromeShellDelegate::NewWindow(bool is_incognito) { | 112 void ChromeShellDelegate::NewWindow(bool is_incognito) { |
113 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 113 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
114 Browser::NewEmptyWindow( | 114 Browser::NewEmptyWindow( |
115 is_incognito ? profile->GetOffTheRecordProfile() : profile); | 115 is_incognito ? profile->GetOffTheRecordProfile() : profile); |
116 } | 116 } |
117 | 117 |
| 118 bool ChromeShellDelegate::IsBrowserWindow(const aura::Window* window) { |
| 119 for (BrowserList::const_iterator iter = BrowserList::begin(); |
| 120 iter != BrowserList::end(); |
| 121 ++iter) { |
| 122 Browser* browser = *iter; |
| 123 if (browser && browser->window() && |
| 124 browser->window()->GetNativeHandle() == window) { |
| 125 return true; |
| 126 } |
| 127 } |
| 128 return false; |
| 129 } |
| 130 |
118 void ChromeShellDelegate::Search() { | 131 void ChromeShellDelegate::Search() { |
119 // Exit fullscreen to show omnibox. | 132 // Exit fullscreen to show omnibox. |
120 Browser* last_active = BrowserList::GetLastActive(); | 133 Browser* last_active = BrowserList::GetLastActive(); |
121 if (last_active) { | 134 if (last_active) { |
122 if (last_active->window()->IsFullscreen()) { | 135 if (last_active->window()->IsFullscreen()) { |
123 last_active->ToggleFullscreenMode(); | 136 last_active->ToggleFullscreenMode(); |
124 // ToggleFullscreenMode is asynchronous, so we don't have omnibox | 137 // ToggleFullscreenMode is asynchronous, so we don't have omnibox |
125 // visible at this point. Wait for next event cycle which toggles | 138 // visible at this point. Wait for next event cycle which toggles |
126 // the visibility of omnibox before creating new tab. | 139 // the visibility of omnibox before creating new tab. |
127 MessageLoop::current()->PostTask( | 140 MessageLoop::current()->PostTask( |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 ash::Shell::GetInstance()->CreateLauncher(); | 243 ash::Shell::GetInstance()->CreateLauncher(); |
231 break; | 244 break; |
232 default: | 245 default: |
233 NOTREACHED() << "Unexpected notification " << type; | 246 NOTREACHED() << "Unexpected notification " << type; |
234 } | 247 } |
235 #else | 248 #else |
236 // MSVC++ warns about switch statements without any cases. | 249 // MSVC++ warns about switch statements without any cases. |
237 NOTREACHED() << "Unexpected notification " << type; | 250 NOTREACHED() << "Unexpected notification " << type; |
238 #endif | 251 #endif |
239 } | 252 } |
OLD | NEW |