| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/system_tray_client.h" | 5 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 6 | 6 |
| 7 #include "ash/common/login_status.h" | 7 #include "ash/common/login_status.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/feature_list.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/browser_process_platform_part.h" | 16 #include "chrome/browser/browser_process_platform_part.h" |
| 16 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 17 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 18 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 18 #include "chrome/browser/chromeos/options/network_config_view.h" | 19 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 19 #include "chrome/browser/chromeos/set_time_dialog.h" | 20 #include "chrome/browser/chromeos/set_time_dialog.h" |
| 20 #include "chrome/browser/chromeos/system/system_clock.h" | 21 #include "chrome/browser/chromeos/system/system_clock.h" |
| 21 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" | 22 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/browser/ui/ash/ash_util.h" | 24 #include "chrome/browser/ui/ash/ash_util.h" |
| 24 #include "chrome/browser/ui/chrome_pages.h" | 25 #include "chrome/browser/ui/chrome_pages.h" |
| 25 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 26 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 26 #include "chrome/browser/ui/singleton_tabs.h" | 27 #include "chrome/browser/ui/singleton_tabs.h" |
| 28 #include "chrome/common/chrome_features.h" |
| 27 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 28 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
| 29 #include "chromeos/dbus/dbus_thread_manager.h" | 31 #include "chromeos/dbus/dbus_thread_manager.h" |
| 30 #include "chromeos/dbus/session_manager_client.h" | 32 #include "chromeos/dbus/session_manager_client.h" |
| 31 #include "chromeos/login/login_state.h" | 33 #include "chromeos/login/login_state.h" |
| 32 #include "content/public/browser/user_metrics.h" | 34 #include "content/public/browser/user_metrics.h" |
| 33 #include "content/public/common/service_manager_connection.h" | 35 #include "content/public/common/service_manager_connection.h" |
| 34 #include "net/base/escape.h" | 36 #include "net/base/escape.h" |
| 35 #include "services/service_manager/public/cpp/connector.h" | 37 #include "services/service_manager/public/cpp/connector.h" |
| 36 #include "third_party/cros_system_api/dbus/shill/dbus-constants.h" | 38 #include "third_party/cros_system_api/dbus/shill/dbus-constants.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 135 |
| 134 //////////////////////////////////////////////////////////////////////////////// | 136 //////////////////////////////////////////////////////////////////////////////// |
| 135 // ash::mojom::SystemTrayClient: | 137 // ash::mojom::SystemTrayClient: |
| 136 | 138 |
| 137 void SystemTrayClient::ShowSettings() { | 139 void SystemTrayClient::ShowSettings() { |
| 138 ShowSettingsSubPageForActiveUser(std::string()); | 140 ShowSettingsSubPageForActiveUser(std::string()); |
| 139 } | 141 } |
| 140 | 142 |
| 141 void SystemTrayClient::ShowDateSettings() { | 143 void SystemTrayClient::ShowDateSettings() { |
| 142 content::RecordAction(base::UserMetricsAction("ShowDateOptions")); | 144 content::RecordAction(base::UserMetricsAction("ShowDateOptions")); |
| 143 std::string sub_page = | 145 std::string sub_page; |
| 144 std::string(chrome::kSearchSubPage) + "#" + | 146 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { |
| 145 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); | 147 sub_page = chrome::kDateTimeSubPage; |
| 148 } else { |
| 149 sub_page = |
| 150 std::string(chrome::kDeprecatedOptionsSearchSubPage) + "#" + |
| 151 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); |
| 152 } |
| 146 // Everybody can change the time zone (even though it is a device setting). | 153 // Everybody can change the time zone (even though it is a device setting). |
| 147 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(), | 154 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(), |
| 148 sub_page); | 155 sub_page); |
| 149 } | 156 } |
| 150 | 157 |
| 151 void SystemTrayClient::ShowSetTimeDialog() { | 158 void SystemTrayClient::ShowSetTimeDialog() { |
| 152 chromeos::SetTimeDialog::ShowDialogInContainer(GetDialogParentContainerId()); | 159 chromeos::SetTimeDialog::ShowDialogInContainer(GetDialogParentContainerId()); |
| 153 } | 160 } |
| 154 | 161 |
| 155 void SystemTrayClient::ShowDisplaySettings() { | 162 void SystemTrayClient::ShowDisplaySettings() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 179 } | 186 } |
| 180 | 187 |
| 181 void SystemTrayClient::ShowAccessibilityHelp() { | 188 void SystemTrayClient::ShowAccessibilityHelp() { |
| 182 chrome::ScopedTabbedBrowserDisplayer displayer( | 189 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 183 ProfileManager::GetActiveUserProfile()); | 190 ProfileManager::GetActiveUserProfile()); |
| 184 chromeos::accessibility::ShowAccessibilityHelp(displayer.browser()); | 191 chromeos::accessibility::ShowAccessibilityHelp(displayer.browser()); |
| 185 } | 192 } |
| 186 | 193 |
| 187 void SystemTrayClient::ShowAccessibilitySettings() { | 194 void SystemTrayClient::ShowAccessibilitySettings() { |
| 188 content::RecordAction(base::UserMetricsAction("ShowAccessibilitySettings")); | 195 content::RecordAction(base::UserMetricsAction("ShowAccessibilitySettings")); |
| 189 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + | 196 std::string sub_page; |
| 190 l10n_util::GetStringUTF8( | 197 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { |
| 191 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY); | 198 sub_page = chrome::kAccessibilitySubPage; |
| 199 } else { |
| 200 sub_page = std::string(chrome::kDeprecatedOptionsSearchSubPage) + "#" + |
| 201 l10n_util::GetStringUTF8( |
| 202 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY); |
| 203 } |
| 192 ShowSettingsSubPageForActiveUser(sub_page); | 204 ShowSettingsSubPageForActiveUser(sub_page); |
| 193 } | 205 } |
| 194 | 206 |
| 195 void SystemTrayClient::ShowPaletteHelp() { | 207 void SystemTrayClient::ShowPaletteHelp() { |
| 196 chrome::ScopedTabbedBrowserDisplayer displayer( | 208 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 197 ProfileManager::GetActiveUserProfile()); | 209 ProfileManager::GetActiveUserProfile()); |
| 198 chrome::ShowSingletonTab(displayer.browser(), | 210 chrome::ShowSingletonTab(displayer.browser(), |
| 199 GURL(chrome::kChromePaletteHelpURL)); | 211 GURL(chrome::kChromePaletteHelpURL)); |
| 200 } | 212 } |
| 201 | 213 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 connector->ConnectToInterface("service:content_browser", &system_tray_); | 292 connector->ConnectToInterface("service:content_browser", &system_tray_); |
| 281 | 293 |
| 282 // Tolerate ash crashing and coming back up. | 294 // Tolerate ash crashing and coming back up. |
| 283 system_tray_.set_connection_error_handler(base::Bind( | 295 system_tray_.set_connection_error_handler(base::Bind( |
| 284 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); | 296 &SystemTrayClient::OnClientConnectionError, base::Unretained(this))); |
| 285 } | 297 } |
| 286 | 298 |
| 287 void SystemTrayClient::OnClientConnectionError() { | 299 void SystemTrayClient::OnClientConnectionError() { |
| 288 system_tray_.reset(); | 300 system_tray_.reset(); |
| 289 } | 301 } |
| OLD | NEW |