| 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 content::RecordAction(content::UserMetricsAction("Shutdown")); | 108 content::RecordAction(content::UserMetricsAction("Shutdown")); |
| 109 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 109 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 110 RequestShutdown(); | 110 RequestShutdown(); |
| 111 #endif | 111 #endif |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ChromeShellDelegate::Exit() { | 114 void ChromeShellDelegate::Exit() { |
| 115 browser::AttemptUserExit(); | 115 browser::AttemptUserExit(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ChromeShellDelegate::NewTab() { |
| 119 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 120 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 121 browser->NewTab(); |
| 122 browser->window()->Show(); |
| 123 } |
| 124 |
| 118 void ChromeShellDelegate::NewWindow(bool is_incognito) { | 125 void ChromeShellDelegate::NewWindow(bool is_incognito) { |
| 119 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 126 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
| 120 Browser::NewEmptyWindow( | 127 Browser::NewEmptyWindow( |
| 121 is_incognito ? profile->GetOffTheRecordProfile() : profile); | 128 is_incognito ? profile->GetOffTheRecordProfile() : profile); |
| 122 } | 129 } |
| 123 | 130 |
| 124 void ChromeShellDelegate::Search() { | 131 void ChromeShellDelegate::Search() { |
| 125 // Exit fullscreen to show omnibox. | 132 // Exit fullscreen to show omnibox. |
| 126 Browser* last_active = BrowserList::GetLastActive(); | 133 Browser* last_active = BrowserList::GetLastActive(); |
| 127 if (last_active) { | 134 if (last_active) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 content::OpenURLParams(GURL(chrome::kChromeUIMobileSetupURL), | 194 content::OpenURLParams(GURL(chrome::kChromeUIMobileSetupURL), |
| 188 content::Referrer(), | 195 content::Referrer(), |
| 189 NEW_FOREGROUND_TAB, | 196 NEW_FOREGROUND_TAB, |
| 190 content::PAGE_TRANSITION_LINK, | 197 content::PAGE_TRANSITION_LINK, |
| 191 false)); | 198 false)); |
| 192 browser->window()->Activate(); | 199 browser->window()->Activate(); |
| 193 } | 200 } |
| 194 #endif | 201 #endif |
| 195 } | 202 } |
| 196 | 203 |
| 204 void ChromeShellDelegate::OpenBookmarkManager() { |
| 205 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 206 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 207 browser->OpenBookmarkManager(); |
| 208 } |
| 209 |
| 210 void ChromeShellDelegate::OpenClearBrowsingData() { |
| 211 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 212 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 213 browser->OpenClearBrowsingDataDialog(); |
| 214 } |
| 215 |
| 216 void ChromeShellDelegate::OpenHelpPage() { |
| 217 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 218 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 219 browser->ShowHelpTab(); |
| 220 } |
| 221 |
| 222 void ChromeShellDelegate::OpenHistory() { |
| 223 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 224 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 225 browser->ShowHistoryTab(); |
| 226 } |
| 227 |
| 228 void ChromeShellDelegate::OpenDownloads() { |
| 229 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 230 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 231 browser->ShowDownloadsTab(); |
| 232 } |
| 233 |
| 234 void ChromeShellDelegate::OpenHome() { |
| 235 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 236 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 237 browser->Home(CURRENT_TAB); |
| 238 } |
| 239 |
| 240 void ChromeShellDelegate::RestoreTab() { |
| 241 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 242 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 243 browser->RestoreTab(); |
| 244 } |
| 245 |
| 197 void ChromeShellDelegate::ShowKeyboardOverlay(ui::AcceleratorTarget* target) { | 246 void ChromeShellDelegate::ShowKeyboardOverlay(ui::AcceleratorTarget* target) { |
| 198 #if defined(OS_CHROMEOS) | 247 #if defined(OS_CHROMEOS) |
| 199 KeyboardOverlayDialogView::ShowDialog(target); | 248 KeyboardOverlayDialogView::ShowDialog(target); |
| 200 #endif | 249 #endif |
| 201 } | 250 } |
| 202 | 251 |
| 252 void ChromeShellDelegate::ShowTaskManager() { |
| 253 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 254 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
| 255 browser->OpenTaskManager(false); |
| 256 } |
| 257 |
| 203 content::BrowserContext* ChromeShellDelegate::GetCurrentBrowserContext() { | 258 content::BrowserContext* ChromeShellDelegate::GetCurrentBrowserContext() { |
| 204 return ProfileManager::GetDefaultProfile(); | 259 return ProfileManager::GetDefaultProfile(); |
| 205 } | 260 } |
| 206 | 261 |
| 207 void ChromeShellDelegate::ToggleSpokenFeedback() { | 262 void ChromeShellDelegate::ToggleSpokenFeedback() { |
| 208 #if defined(OS_CHROMEOS) | 263 #if defined(OS_CHROMEOS) |
| 209 content::WebUI* login_screen_web_ui = NULL; | 264 content::WebUI* login_screen_web_ui = NULL; |
| 210 chromeos::WebUILoginDisplayHost* host = | 265 chromeos::WebUILoginDisplayHost* host = |
| 211 static_cast<chromeos::WebUILoginDisplayHost*>( | 266 static_cast<chromeos::WebUILoginDisplayHost*>( |
| 212 chromeos::BaseLoginDisplayHost::default_host()); | 267 chromeos::BaseLoginDisplayHost::default_host()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 ash::Shell::GetInstance()->CreateLauncher(); | 316 ash::Shell::GetInstance()->CreateLauncher(); |
| 262 break; | 317 break; |
| 263 default: | 318 default: |
| 264 NOTREACHED() << "Unexpected notification " << type; | 319 NOTREACHED() << "Unexpected notification " << type; |
| 265 } | 320 } |
| 266 #else | 321 #else |
| 267 // MSVC++ warns about switch statements without any cases. | 322 // MSVC++ warns about switch statements without any cases. |
| 268 NOTREACHED() << "Unexpected notification " << type; | 323 NOTREACHED() << "Unexpected notification " << type; |
| 269 #endif | 324 #endif |
| 270 } | 325 } |
| OLD | NEW |