| 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/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/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/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "chrome/browser/chromeos/login/screen_locker.h" | 11 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 12 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" | 12 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" |
| 13 #include "chrome/browser/lifetime/application_lifetime.h" | 13 #include "chrome/browser/lifetime/application_lifetime.h" |
| 14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/browser/sessions/tab_restore_service.h" | 16 #include "chrome/browser/sessions/tab_restore_service.h" |
| 17 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 17 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 18 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" | 18 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
| 19 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" | 19 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" |
| 20 #include "chrome/browser/ui/ash/caps_lock_handler.h" | 20 #include "chrome/browser/ui/ash/caps_lock_handler.h" |
| 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 22 #include "chrome/browser/ui/ash/user_action_handler.h" | 22 #include "chrome/browser/ui/ash/user_action_handler.h" |
| 23 #include "chrome/browser/ui/ash/window_positioner.h" | 23 #include "chrome/browser/ui/ash/window_positioner.h" |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_commands.h" | 25 #include "chrome/browser/ui/browser_commands.h" |
| 26 #include "chrome/browser/ui/browser_finder.h" | 26 #include "chrome/browser/ui/browser_finder.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/host_desktop.h" |
| 28 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 29 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 29 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
| 30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 32 #include "chrome/common/time_format.h" | 33 #include "chrome/common/time_format.h" |
| 33 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 34 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
| 36 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 37 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 58 #endif | 59 #endif |
| 59 | 60 |
| 60 namespace { | 61 namespace { |
| 61 | 62 |
| 62 // Returns the browser that should handle accelerators. | 63 // Returns the browser that should handle accelerators. |
| 63 Browser* GetTargetBrowser() { | 64 Browser* GetTargetBrowser() { |
| 64 Browser* browser = browser::FindBrowserWithWindow(ash::wm::GetActiveWindow()); | 65 Browser* browser = browser::FindBrowserWithWindow(ash::wm::GetActiveWindow()); |
| 65 if (browser) | 66 if (browser) |
| 66 return browser; | 67 return browser; |
| 67 return browser::FindOrCreateTabbedBrowser( | 68 return browser::FindOrCreateTabbedBrowser( |
| 68 ProfileManager::GetDefaultProfileOrOffTheRecord()); | 69 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
| 70 chrome::HOST_DESKTOP_TYPE_ASH); |
| 69 } | 71 } |
| 70 | 72 |
| 71 } // namespace | 73 } // namespace |
| 72 | 74 |
| 73 // static | 75 // static |
| 74 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; | 76 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; |
| 75 | 77 |
| 76 ChromeShellDelegate::ChromeShellDelegate() | 78 ChromeShellDelegate::ChromeShellDelegate() |
| 77 : window_positioner_(new ash::WindowPositioner()), | 79 : window_positioner_(new ash::WindowPositioner()), |
| 78 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 80 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 272 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
| 271 std::string url(chrome::kChromeUIKeyboardOverlayURL); | 273 std::string url(chrome::kChromeUIKeyboardOverlayURL); |
| 272 KeyboardOverlayView::ShowDialog(profile, | 274 KeyboardOverlayView::ShowDialog(profile, |
| 273 new ChromeWebContentsHandler, | 275 new ChromeWebContentsHandler, |
| 274 GURL(url)); | 276 GURL(url)); |
| 275 #endif | 277 #endif |
| 276 } | 278 } |
| 277 | 279 |
| 278 void ChromeShellDelegate::ShowTaskManager() { | 280 void ChromeShellDelegate::ShowTaskManager() { |
| 279 Browser* browser = browser::FindOrCreateTabbedBrowser( | 281 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 280 ProfileManager::GetDefaultProfileOrOffTheRecord()); | 282 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
| 283 chrome::HOST_DESKTOP_TYPE_ASH); |
| 281 chrome::OpenTaskManager(browser, false); | 284 chrome::OpenTaskManager(browser, false); |
| 282 } | 285 } |
| 283 | 286 |
| 284 content::BrowserContext* ChromeShellDelegate::GetCurrentBrowserContext() { | 287 content::BrowserContext* ChromeShellDelegate::GetCurrentBrowserContext() { |
| 285 return ProfileManager::GetDefaultProfile(); | 288 return ProfileManager::GetDefaultProfile(); |
| 286 } | 289 } |
| 287 | 290 |
| 288 void ChromeShellDelegate::ToggleSpokenFeedback() { | 291 void ChromeShellDelegate::ToggleSpokenFeedback() { |
| 289 #if defined(OS_CHROMEOS) | 292 #if defined(OS_CHROMEOS) |
| 290 content::WebUI* login_screen_web_ui = NULL; | 293 content::WebUI* login_screen_web_ui = NULL; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 ash::Shell::GetInstance()->ShowLauncher(); | 450 ash::Shell::GetInstance()->ShowLauncher(); |
| 448 break; | 451 break; |
| 449 default: | 452 default: |
| 450 NOTREACHED() << "Unexpected notification " << type; | 453 NOTREACHED() << "Unexpected notification " << type; |
| 451 } | 454 } |
| 452 #else | 455 #else |
| 453 // MSVC++ warns about switch statements without any cases. | 456 // MSVC++ warns about switch statements without any cases. |
| 454 NOTREACHED() << "Unexpected notification " << type; | 457 NOTREACHED() << "Unexpected notification " << type; |
| 455 #endif | 458 #endif |
| 456 } | 459 } |
| OLD | NEW |