| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/keyboard_overlay/keyboard_overlay_view.h" | 7 #include "ash/keyboard_overlay/keyboard_overlay_view.h" |
| 8 #include "ash/system/chromeos/network/network_observer.h" | |
| 9 #include "ash/system/tray/system_tray_notifier.h" | |
| 10 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 11 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 12 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 13 #include "base/utf_string_conversions.h" | |
| 14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 11 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 15 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 12 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 16 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" | 13 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
| 17 #include "chrome/browser/chromeos/cros/cros_library.h" | |
| 18 #include "chrome/browser/chromeos/cros/network_library.h" | |
| 19 #include "chrome/browser/chromeos/display/display_preferences.h" | 14 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 20 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" | 15 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" |
| 21 #include "chrome/browser/chromeos/extensions/media_player_api.h" | 16 #include "chrome/browser/chromeos/extensions/media_player_api.h" |
| 22 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" | 17 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
| 23 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 18 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 24 #include "chrome/browser/chromeos/login/screen_locker.h" | 19 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 25 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" | 20 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
| 26 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" | 21 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" |
| 27 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 28 #include "chrome/browser/extensions/shell_window_registry.h" | 23 #include "chrome/browser/extensions/shell_window_registry.h" |
| 29 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
| 30 #include "chrome/browser/speech/tts_controller.h" | 25 #include "chrome/browser/speech/tts_controller.h" |
| 31 #include "chrome/browser/ui/ash/caps_lock_delegate_chromeos.h" | 26 #include "chrome/browser/ui/ash/caps_lock_delegate_chromeos.h" |
| 32 #include "chrome/browser/ui/ash/window_positioner.h" | 27 #include "chrome/browser/ui/ash/window_positioner.h" |
| 33 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
| 34 #include "chrome/browser/ui/browser_finder.h" | 29 #include "chrome/browser/ui/browser_finder.h" |
| 35 #include "chrome/browser/ui/browser_window.h" | 30 #include "chrome/browser/ui/browser_window.h" |
| 36 #include "chrome/browser/ui/extensions/application_launch.h" | 31 #include "chrome/browser/ui/extensions/application_launch.h" |
| 37 #include "chrome/browser/ui/extensions/native_app_window.h" | 32 #include "chrome/browser/ui/extensions/native_app_window.h" |
| 38 #include "chrome/browser/ui/extensions/shell_window.h" | 33 #include "chrome/browser/ui/extensions/shell_window.h" |
| 39 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 34 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 40 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 35 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 41 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | |
| 42 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
| 43 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
| 44 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
| 45 #include "chromeos/chromeos_switches.h" | 39 #include "chromeos/chromeos_switches.h" |
| 46 #include "chromeos/dbus/dbus_thread_manager.h" | 40 #include "chromeos/dbus/dbus_thread_manager.h" |
| 47 #include "chromeos/dbus/power_manager_client.h" | 41 #include "chromeos/dbus/power_manager_client.h" |
| 48 #include "chromeos/ime/input_method_manager.h" | 42 #include "chromeos/ime/input_method_manager.h" |
| 49 #include "content/public/browser/user_metrics.h" | 43 #include "content/public/browser/user_metrics.h" |
| 50 #include "content/public/browser/web_contents.h" | 44 #include "content/public/browser/web_contents.h" |
| 51 #include "content/public/browser/web_contents_view.h" | 45 #include "content/public/browser/web_contents_view.h" |
| 52 #include "grit/generated_resources.h" | |
| 53 #include "ui/base/l10n/l10n_util.h" | |
| 54 | 46 |
| 55 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { | 47 bool ChromeShellDelegate::IsFirstRunAfterBoot() const { |
| 56 return CommandLine::ForCurrentProcess()->HasSwitch( | 48 return CommandLine::ForCurrentProcess()->HasSwitch( |
| 57 chromeos::switches::kFirstBoot); | 49 chromeos::switches::kFirstBoot); |
| 58 } | 50 } |
| 59 | 51 |
| 60 void ChromeShellDelegate::PreInit() { | 52 void ChromeShellDelegate::PreInit() { |
| 61 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); | 53 chromeos::LoadDisplayPreferences(IsFirstRunAfterBoot()); |
| 62 } | 54 } |
| 63 | 55 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 content::OpenURLParams(crosh_url, | 104 content::OpenURLParams(crosh_url, |
| 113 content::Referrer(), | 105 content::Referrer(), |
| 114 NEW_FOREGROUND_TAB, | 106 NEW_FOREGROUND_TAB, |
| 115 content::PAGE_TRANSITION_GENERATED, | 107 content::PAGE_TRANSITION_GENERATED, |
| 116 false)); | 108 false)); |
| 117 browser->window()->Show(); | 109 browser->window()->Show(); |
| 118 browser->window()->Activate(); | 110 browser->window()->Activate(); |
| 119 page->GetView()->Focus(); | 111 page->GetView()->Focus(); |
| 120 } | 112 } |
| 121 | 113 |
| 122 void ChromeShellDelegate::OpenMobileSetup(const std::string& service_path) { | |
| 123 // TODO(stevenjb): Replace with non-NetworkLibrary UI. | |
| 124 chromeos::NetworkLibrary* cros = | |
| 125 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | |
| 126 const chromeos::CellularNetwork* cellular = | |
| 127 cros->FindCellularNetworkByPath(service_path); | |
| 128 if (cellular && !cellular->activated() && | |
| 129 cellular->activate_over_non_cellular_network() && | |
| 130 (!cros->connected_network() || !cros->connected_network()->online())) { | |
| 131 chromeos::NetworkTechnology technology = cellular->network_technology(); | |
| 132 ash::NetworkObserver::NetworkType network_type = | |
| 133 (technology == chromeos::NETWORK_TECHNOLOGY_LTE || | |
| 134 technology == chromeos::NETWORK_TECHNOLOGY_LTE_ADVANCED) | |
| 135 ? ash::NetworkObserver::NETWORK_CELLULAR_LTE | |
| 136 : ash::NetworkObserver::NETWORK_CELLULAR; | |
| 137 ash::Shell::GetInstance()->system_tray_notifier()->NotifySetNetworkMessage( | |
| 138 NULL, | |
| 139 ash::NetworkObserver::ERROR_CONNECT_FAILED, | |
| 140 network_type, | |
| 141 l10n_util::GetStringUTF16(IDS_NETWORK_ACTIVATION_ERROR_TITLE), | |
| 142 l10n_util::GetStringFUTF16(IDS_NETWORK_ACTIVATION_NEEDS_CONNECTION, | |
| 143 UTF8ToUTF16((cellular->name()))), | |
| 144 std::vector<string16>()); | |
| 145 return; | |
| 146 } | |
| 147 MobileSetupDialog::Show(service_path); | |
| 148 } | |
| 149 | |
| 150 void ChromeShellDelegate::ToggleHighContrast() { | 114 void ChromeShellDelegate::ToggleHighContrast() { |
| 151 bool enabled = chromeos::accessibility::IsHighContrastEnabled(); | 115 bool enabled = chromeos::accessibility::IsHighContrastEnabled(); |
| 152 chromeos::accessibility::EnableHighContrast(!enabled); | 116 chromeos::accessibility::EnableHighContrast(!enabled); |
| 153 } | 117 } |
| 154 | 118 |
| 155 bool ChromeShellDelegate::IsSpokenFeedbackEnabled() const { | 119 bool ChromeShellDelegate::IsSpokenFeedbackEnabled() const { |
| 156 return chromeos::accessibility::IsSpokenFeedbackEnabled(); | 120 return chromeos::accessibility::IsSpokenFeedbackEnabled(); |
| 157 } | 121 } |
| 158 | 122 |
| 159 void ChromeShellDelegate::ToggleSpokenFeedback( | 123 void ChromeShellDelegate::ToggleSpokenFeedback( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 } | 247 } |
| 284 | 248 |
| 285 void ChromeShellDelegate::PlatformInit() { | 249 void ChromeShellDelegate::PlatformInit() { |
| 286 registrar_.Add(this, | 250 registrar_.Add(this, |
| 287 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 251 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 288 content::NotificationService::AllSources()); | 252 content::NotificationService::AllSources()); |
| 289 registrar_.Add(this, | 253 registrar_.Add(this, |
| 290 chrome::NOTIFICATION_SESSION_STARTED, | 254 chrome::NOTIFICATION_SESSION_STARTED, |
| 291 content::NotificationService::AllSources()); | 255 content::NotificationService::AllSources()); |
| 292 } | 256 } |
| OLD | NEW |