| 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/content_support/gpu_support_impl.h" | 7 #include "ash/content_support/gpu_support_impl.h" |
| 8 #include "ash/wm/window_state.h" | 8 #include "ash/wm/window_state.h" |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 11 #include "chrome/browser/lifetime/application_lifetime.h" | 11 #include "chrome/browser/lifetime/application_lifetime.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/profiles/profiles_state.h" | 13 #include "chrome/browser/profiles/profiles_state.h" |
| 14 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" | 14 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
| 15 #include "chrome/browser/ui/ash/app_list/app_list_service_ash.h" | 15 #include "chrome/browser/ui/ash/app_list/app_list_service_ash.h" |
| 16 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h" | 16 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h" |
| 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 17 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 18 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 18 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 19 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.h" |
| 20 #include "chrome/browser/ui/browser_finder.h" |
| 21 #include "chrome/browser/ui/browser_navigator.h" |
| 22 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/grit/chromium_strings.h" | 23 #include "chrome/grit/chromium_strings.h" |
| 21 #include "components/signin/core/common/profile_management_switches.h" | 24 #include "components/signin/core/common/profile_management_switches.h" |
| 25 #include "grit/theme_resources.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" |
| 23 | 28 |
| 24 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
| 25 #include "base/prefs/pref_service.h" | 30 #include "base/prefs/pref_service.h" |
| 26 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 27 #include "chrome/browser/chromeos/display/display_configuration_observer.h" | 32 #include "chrome/browser/chromeos/display/display_configuration_observer.h" |
| 28 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 33 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
| 31 #include "components/user_manager/user.h" | 36 #include "components/user_manager/user.h" |
| 32 #include "components/user_manager/user_manager.h" | 37 #include "components/user_manager/user_manager.h" |
| 33 #endif | 38 #endif |
| 34 | 39 |
| 40 namespace { |
| 41 |
| 42 const char kKeyboardShortcutHelpPageUrl[] = |
| 43 "https://support.google.com/chromebook/answer/183101"; |
| 44 |
| 45 } // namespace |
| 46 |
| 35 // static | 47 // static |
| 36 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; | 48 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; |
| 37 | 49 |
| 38 ChromeShellDelegate::ChromeShellDelegate() | 50 ChromeShellDelegate::ChromeShellDelegate() |
| 39 : shelf_delegate_(NULL) { | 51 : shelf_delegate_(NULL) { |
| 40 instance_ = this; | 52 instance_ = this; |
| 41 PlatformInit(); | 53 PlatformInit(); |
| 42 } | 54 } |
| 43 | 55 |
| 44 ChromeShellDelegate::~ChromeShellDelegate() { | 56 ChromeShellDelegate::~ChromeShellDelegate() { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 162 |
| 151 ash::GPUSupport* ChromeShellDelegate::CreateGPUSupport() { | 163 ash::GPUSupport* ChromeShellDelegate::CreateGPUSupport() { |
| 152 // Chrome uses real GPU support. | 164 // Chrome uses real GPU support. |
| 153 return new ash::GPUSupportImpl; | 165 return new ash::GPUSupportImpl; |
| 154 } | 166 } |
| 155 | 167 |
| 156 base::string16 ChromeShellDelegate::GetProductName() const { | 168 base::string16 ChromeShellDelegate::GetProductName() const { |
| 157 return l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 169 return l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
| 158 } | 170 } |
| 159 | 171 |
| 172 void ChromeShellDelegate::OpenKeyboardShortcutHelpPage() const { |
| 173 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 174 Browser* browser = |
| 175 chrome::FindTabbedBrowser(profile, false, chrome::HOST_DESKTOP_TYPE_ASH); |
| 176 |
| 177 if (!browser) { |
| 178 browser = new Browser( |
| 179 Browser::CreateParams(profile, chrome::HOST_DESKTOP_TYPE_ASH)); |
| 180 browser->window()->Activate(); |
| 181 browser->window()->Show(); |
| 182 } |
| 183 |
| 184 chrome::NavigateParams params(browser, GURL(kKeyboardShortcutHelpPageUrl), |
| 185 ui::PAGE_TRANSITION_AUTO_BOOKMARK); |
| 186 params.disposition = SINGLETON_TAB; |
| 187 chrome::Navigate(¶ms); |
| 188 } |
| 189 |
| 190 gfx::Image ChromeShellDelegate::GetDeprecatedAcceleratorImage() const { |
| 191 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 192 IDR_BLUETOOTH_KEYBOARD); |
| 193 } |
| 194 |
| 160 keyboard::KeyboardControllerProxy* | 195 keyboard::KeyboardControllerProxy* |
| 161 ChromeShellDelegate::CreateKeyboardControllerProxy() { | 196 ChromeShellDelegate::CreateKeyboardControllerProxy() { |
| 162 return new AshKeyboardControllerProxy( | 197 return new AshKeyboardControllerProxy( |
| 163 ProfileManager::GetActiveUserProfile()); | 198 ProfileManager::GetActiveUserProfile()); |
| 164 } | 199 } |
| 165 | 200 |
| 166 void ChromeShellDelegate::VirtualKeyboardActivated(bool activated) { | 201 void ChromeShellDelegate::VirtualKeyboardActivated(bool activated) { |
| 167 FOR_EACH_OBSERVER(ash::VirtualKeyboardStateObserver, | 202 FOR_EACH_OBSERVER(ash::VirtualKeyboardStateObserver, |
| 168 keyboard_state_observer_list_, | 203 keyboard_state_observer_list_, |
| 169 OnVirtualKeyboardStateChanged(activated)); | 204 OnVirtualKeyboardStateChanged(activated)); |
| 170 } | 205 } |
| 171 | 206 |
| 172 void ChromeShellDelegate::AddVirtualKeyboardStateObserver( | 207 void ChromeShellDelegate::AddVirtualKeyboardStateObserver( |
| 173 ash::VirtualKeyboardStateObserver* observer) { | 208 ash::VirtualKeyboardStateObserver* observer) { |
| 174 keyboard_state_observer_list_.AddObserver(observer); | 209 keyboard_state_observer_list_.AddObserver(observer); |
| 175 } | 210 } |
| 176 | 211 |
| 177 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver( | 212 void ChromeShellDelegate::RemoveVirtualKeyboardStateObserver( |
| 178 ash::VirtualKeyboardStateObserver* observer) { | 213 ash::VirtualKeyboardStateObserver* observer) { |
| 179 keyboard_state_observer_list_.RemoveObserver(observer); | 214 keyboard_state_observer_list_.RemoveObserver(observer); |
| 180 } | 215 } |
| OLD | NEW |