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