| 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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/host/root_window_host_factory.h" | 8 #include "ash/host/root_window_host_factory.h" |
| 9 #include "ash/launcher/launcher_types.h" | 9 #include "ash/launcher/launcher_types.h" |
| 10 #include "ash/magnifier/magnifier_constants.h" | 10 #include "ash/magnifier/magnifier_constants.h" |
| 11 #include "ash/session_state_delegate.h" | |
| 12 #include "ash/shelf/shelf_widget.h" | 11 #include "ash/shelf/shelf_widget.h" |
| 13 #include "ash/system/tray/system_tray_delegate.h" | 12 #include "ash/system/tray/system_tray_delegate.h" |
| 14 #include "ash/wm/window_properties.h" | 13 #include "ash/wm/window_properties.h" |
| 15 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 16 #include "base/bind.h" | 15 #include "base/bind.h" |
| 17 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 18 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 19 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 20 #include "chrome/browser/app_mode/app_mode_utils.h" | 19 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 21 #include "chrome/browser/lifetime/application_lifetime.h" | 20 #include "chrome/browser/lifetime/application_lifetime.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/browser/sessions/tab_restore_service.h" | 22 #include "chrome/browser/sessions/tab_restore_service.h" |
| 24 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 23 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 25 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" | 24 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
| 26 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" | 25 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" |
| 27 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h" | 26 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h" |
| 28 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 27 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 29 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 28 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 30 #include "chrome/browser/ui/ash/session_state_delegate.h" | |
| 31 #include "chrome/browser/ui/ash/user_action_handler.h" | 29 #include "chrome/browser/ui/ash/user_action_handler.h" |
| 32 #include "chrome/browser/ui/ash/window_positioner.h" | 30 #include "chrome/browser/ui/ash/window_positioner.h" |
| 33 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
| 34 #include "chrome/browser/ui/browser_commands.h" | 32 #include "chrome/browser/ui/browser_commands.h" |
| 35 #include "chrome/browser/ui/browser_finder.h" | 33 #include "chrome/browser/ui/browser_finder.h" |
| 36 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
| 37 #include "chrome/browser/ui/host_desktop.h" | 35 #include "chrome/browser/ui/host_desktop.h" |
| 38 #include "chrome/common/chrome_notification_types.h" | 36 #include "chrome/common/chrome_notification_types.h" |
| 39 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 40 #include "chrome/common/time_format.h" | 38 #include "chrome/common/time_format.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 72 } |
| 75 | 73 |
| 76 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { | 74 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { |
| 77 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); | 75 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); |
| 78 } | 76 } |
| 79 | 77 |
| 80 bool ChromeShellDelegate::IsRunningInForcedAppMode() const { | 78 bool ChromeShellDelegate::IsRunningInForcedAppMode() const { |
| 81 return chrome::IsRunningInForcedAppMode(); | 79 return chrome::IsRunningInForcedAppMode(); |
| 82 } | 80 } |
| 83 | 81 |
| 82 void ChromeShellDelegate::UnlockScreen() { |
| 83 // This is used only for testing thus far. |
| 84 NOTIMPLEMENTED(); |
| 85 } |
| 86 |
| 84 void ChromeShellDelegate::Exit() { | 87 void ChromeShellDelegate::Exit() { |
| 85 chrome::AttemptUserExit(); | 88 chrome::AttemptUserExit(); |
| 86 } | 89 } |
| 87 | 90 |
| 88 void ChromeShellDelegate::NewTab() { | 91 void ChromeShellDelegate::NewTab() { |
| 89 Browser* browser = GetTargetBrowser(); | 92 Browser* browser = GetTargetBrowser(); |
| 90 // If the browser was not active, we call BrowserWindow::Show to make it | 93 // If the browser was not active, we call BrowserWindow::Show to make it |
| 91 // visible. Otherwise, we let Browser::NewTab handle the active window change. | 94 // visible. Otherwise, we let Browser::NewTab handle the active window change. |
| 92 const bool was_active = browser->window()->IsActive(); | 95 const bool was_active = browser->window()->IsActive(); |
| 93 chrome::NewTab(browser); | 96 chrome::NewTab(browser); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // TODO(oshima): This is currently broken with multiple launchers. | 191 // TODO(oshima): This is currently broken with multiple launchers. |
| 189 // Refactor so that there is just one launcher delegate in the | 192 // Refactor so that there is just one launcher delegate in the |
| 190 // shell. | 193 // shell. |
| 191 if (!launcher_delegate_) { | 194 if (!launcher_delegate_) { |
| 192 launcher_delegate_ = ChromeLauncherController::CreateInstance(NULL, model); | 195 launcher_delegate_ = ChromeLauncherController::CreateInstance(NULL, model); |
| 193 launcher_delegate_->Init(); | 196 launcher_delegate_->Init(); |
| 194 } | 197 } |
| 195 return launcher_delegate_; | 198 return launcher_delegate_; |
| 196 } | 199 } |
| 197 | 200 |
| 198 ash::SessionStateDelegate* ChromeShellDelegate::CreateSessionStateDelegate() { | |
| 199 return new SessionStateDelegate; | |
| 200 } | |
| 201 | |
| 202 aura::client::UserActionClient* ChromeShellDelegate::CreateUserActionClient() { | 201 aura::client::UserActionClient* ChromeShellDelegate::CreateUserActionClient() { |
| 203 return new UserActionHandler; | 202 return new UserActionHandler; |
| 204 } | 203 } |
| 205 | 204 |
| 206 void ChromeShellDelegate::OpenFeedbackPage() { | 205 void ChromeShellDelegate::OpenFeedbackPage() { |
| 207 chrome::OpenFeedbackDialog(GetTargetBrowser()); | 206 chrome::OpenFeedbackDialog(GetTargetBrowser()); |
| 208 } | 207 } |
| 209 | 208 |
| 210 void ChromeShellDelegate::RecordUserMetricsAction( | 209 void ChromeShellDelegate::RecordUserMetricsAction( |
| 211 ash::UserMetricsAction action) { | 210 ash::UserMetricsAction action) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 return browser; | 363 return browser; |
| 365 return chrome::FindOrCreateTabbedBrowser( | 364 return chrome::FindOrCreateTabbedBrowser( |
| 366 ProfileManager::GetDefaultProfileOrOffTheRecord(), | 365 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
| 367 chrome::HOST_DESKTOP_TYPE_ASH); | 366 chrome::HOST_DESKTOP_TYPE_ASH); |
| 368 } | 367 } |
| 369 | 368 |
| 370 keyboard::KeyboardControllerProxy* | 369 keyboard::KeyboardControllerProxy* |
| 371 ChromeShellDelegate::CreateKeyboardControllerProxy() { | 370 ChromeShellDelegate::CreateKeyboardControllerProxy() { |
| 372 return new AshKeyboardControllerProxy(); | 371 return new AshKeyboardControllerProxy(); |
| 373 } | 372 } |
| OLD | NEW |