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/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/public/interfaces/constants.mojom.h" | 10 #include "ash/public/interfaces/constants.mojom.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/ui/singleton_tabs.h" | 32 #include "chrome/browser/ui/singleton_tabs.h" |
33 #include "chrome/browser/upgrade_detector.h" | 33 #include "chrome/browser/upgrade_detector.h" |
34 #include "chrome/common/chrome_features.h" | 34 #include "chrome/common/chrome_features.h" |
35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
36 #include "chromeos/dbus/dbus_thread_manager.h" | 36 #include "chromeos/dbus/dbus_thread_manager.h" |
37 #include "chromeos/dbus/session_manager_client.h" | 37 #include "chromeos/dbus/session_manager_client.h" |
38 #include "chromeos/login/login_state.h" | 38 #include "chromeos/login/login_state.h" |
39 #include "components/session_manager/core/session_manager.h" | 39 #include "components/session_manager/core/session_manager.h" |
40 #include "components/user_manager/user_manager.h" | 40 #include "components/user_manager/user_manager.h" |
41 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
42 #include "content/public/browser/user_metrics.h" | |
43 #include "content/public/common/service_manager_connection.h" | 42 #include "content/public/common/service_manager_connection.h" |
44 #include "device/bluetooth/bluetooth_device.h" | 43 #include "device/bluetooth/bluetooth_device.h" |
45 #include "extensions/browser/api/vpn_provider/vpn_service.h" | 44 #include "extensions/browser/api/vpn_provider/vpn_service.h" |
46 #include "extensions/browser/api/vpn_provider/vpn_service_factory.h" | 45 #include "extensions/browser/api/vpn_provider/vpn_service_factory.h" |
47 #include "net/base/escape.h" | 46 #include "net/base/escape.h" |
48 #include "services/service_manager/public/cpp/connector.h" | 47 #include "services/service_manager/public/cpp/connector.h" |
49 #include "services/ui/public/cpp/property_type_converters.h" | 48 #include "services/ui/public/cpp/property_type_converters.h" |
50 #include "services/ui/public/interfaces/window_manager.mojom.h" | 49 #include "services/ui/public/interfaces/window_manager.mojom.h" |
51 #include "third_party/cros_system_api/dbus/shill/dbus-constants.h" | 50 #include "third_party/cros_system_api/dbus/shill/dbus-constants.h" |
52 #include "ui/views/widget/widget.h" | 51 #include "ui/views/widget/widget.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 233 |
235 base::RecordAction( | 234 base::RecordAction( |
236 base::UserMetricsAction("StatusArea_Bluetooth_Connect_Unknown")); | 235 base::UserMetricsAction("StatusArea_Bluetooth_Connect_Unknown")); |
237 BluetoothPairingDialog* dialog = new BluetoothPairingDialog( | 236 BluetoothPairingDialog* dialog = new BluetoothPairingDialog( |
238 canonical_address, name_for_display, paired, connected); | 237 canonical_address, name_for_display, paired, connected); |
239 // The dialog deletes itself on close. | 238 // The dialog deletes itself on close. |
240 dialog->ShowInContainer(GetDialogParentContainerId()); | 239 dialog->ShowInContainer(GetDialogParentContainerId()); |
241 } | 240 } |
242 | 241 |
243 void SystemTrayClient::ShowDateSettings() { | 242 void SystemTrayClient::ShowDateSettings() { |
244 content::RecordAction(base::UserMetricsAction("ShowDateOptions")); | 243 base::RecordAction(base::UserMetricsAction("ShowDateOptions")); |
245 // Everybody can change the time zone (even though it is a device setting). | 244 // Everybody can change the time zone (even though it is a device setting). |
246 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(), | 245 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(), |
247 chrome::kDateTimeSubPage); | 246 chrome::kDateTimeSubPage); |
248 } | 247 } |
249 | 248 |
250 void SystemTrayClient::ShowSetTimeDialog() { | 249 void SystemTrayClient::ShowSetTimeDialog() { |
251 chromeos::SetTimeDialog::ShowDialogInContainer(GetDialogParentContainerId()); | 250 chromeos::SetTimeDialog::ShowDialogInContainer(GetDialogParentContainerId()); |
252 } | 251 } |
253 | 252 |
254 void SystemTrayClient::ShowDisplaySettings() { | 253 void SystemTrayClient::ShowDisplaySettings() { |
255 content::RecordAction(base::UserMetricsAction("ShowDisplayOptions")); | 254 base::RecordAction(base::UserMetricsAction("ShowDisplayOptions")); |
256 ShowSettingsSubPageForActiveUser(chrome::kDisplaySubPage); | 255 ShowSettingsSubPageForActiveUser(chrome::kDisplaySubPage); |
257 } | 256 } |
258 | 257 |
259 void SystemTrayClient::ShowPowerSettings() { | 258 void SystemTrayClient::ShowPowerSettings() { |
260 content::RecordAction(base::UserMetricsAction("Tray_ShowPowerOptions")); | 259 base::RecordAction(base::UserMetricsAction("Tray_ShowPowerOptions")); |
261 ShowSettingsSubPageForActiveUser(chrome::kPowerSubPage); | 260 ShowSettingsSubPageForActiveUser(chrome::kPowerSubPage); |
262 } | 261 } |
263 | 262 |
264 void SystemTrayClient::ShowChromeSlow() { | 263 void SystemTrayClient::ShowChromeSlow() { |
265 chrome::ScopedTabbedBrowserDisplayer displayer( | 264 chrome::ScopedTabbedBrowserDisplayer displayer( |
266 ProfileManager::GetPrimaryUserProfile()); | 265 ProfileManager::GetPrimaryUserProfile()); |
267 chrome::ShowSlow(displayer.browser()); | 266 chrome::ShowSlow(displayer.browser()); |
268 } | 267 } |
269 | 268 |
270 void SystemTrayClient::ShowIMESettings() { | 269 void SystemTrayClient::ShowIMESettings() { |
271 content::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog")); | 270 base::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog")); |
272 ShowSettingsSubPageForActiveUser(chrome::kLanguageOptionsSubPage); | 271 ShowSettingsSubPageForActiveUser(chrome::kLanguageOptionsSubPage); |
273 } | 272 } |
274 | 273 |
275 void SystemTrayClient::ShowHelp() { | 274 void SystemTrayClient::ShowHelp() { |
276 chrome::ShowHelpForProfile(ProfileManager::GetActiveUserProfile(), | 275 chrome::ShowHelpForProfile(ProfileManager::GetActiveUserProfile(), |
277 chrome::HELP_SOURCE_MENU); | 276 chrome::HELP_SOURCE_MENU); |
278 } | 277 } |
279 | 278 |
280 void SystemTrayClient::ShowAccessibilityHelp() { | 279 void SystemTrayClient::ShowAccessibilityHelp() { |
281 chrome::ScopedTabbedBrowserDisplayer displayer( | 280 chrome::ScopedTabbedBrowserDisplayer displayer( |
282 ProfileManager::GetActiveUserProfile()); | 281 ProfileManager::GetActiveUserProfile()); |
283 chromeos::accessibility::ShowAccessibilityHelp(displayer.browser()); | 282 chromeos::accessibility::ShowAccessibilityHelp(displayer.browser()); |
284 } | 283 } |
285 | 284 |
286 void SystemTrayClient::ShowAccessibilitySettings() { | 285 void SystemTrayClient::ShowAccessibilitySettings() { |
287 content::RecordAction(base::UserMetricsAction("ShowAccessibilitySettings")); | 286 base::RecordAction(base::UserMetricsAction("ShowAccessibilitySettings")); |
288 ShowSettingsSubPageForActiveUser(chrome::kAccessibilitySubPage); | 287 ShowSettingsSubPageForActiveUser(chrome::kAccessibilitySubPage); |
289 } | 288 } |
290 | 289 |
291 void SystemTrayClient::ShowPaletteHelp() { | 290 void SystemTrayClient::ShowPaletteHelp() { |
292 chrome::ScopedTabbedBrowserDisplayer displayer( | 291 chrome::ScopedTabbedBrowserDisplayer displayer( |
293 ProfileManager::GetActiveUserProfile()); | 292 ProfileManager::GetActiveUserProfile()); |
294 chrome::ShowSingletonTab(displayer.browser(), | 293 chrome::ShowSingletonTab(displayer.browser(), |
295 GURL(chrome::kChromePaletteHelpURL)); | 294 GURL(chrome::kChromePaletteHelpURL)); |
296 } | 295 } |
297 | 296 |
298 void SystemTrayClient::ShowPaletteSettings() { | 297 void SystemTrayClient::ShowPaletteSettings() { |
299 content::RecordAction(base::UserMetricsAction("ShowPaletteOptions")); | 298 base::RecordAction(base::UserMetricsAction("ShowPaletteOptions")); |
300 ShowSettingsSubPageForActiveUser(chrome::kStylusSubPage); | 299 ShowSettingsSubPageForActiveUser(chrome::kStylusSubPage); |
301 } | 300 } |
302 | 301 |
303 void SystemTrayClient::ShowPublicAccountInfo() { | 302 void SystemTrayClient::ShowPublicAccountInfo() { |
304 chrome::ScopedTabbedBrowserDisplayer displayer( | 303 chrome::ScopedTabbedBrowserDisplayer displayer( |
305 ProfileManager::GetActiveUserProfile()); | 304 ProfileManager::GetActiveUserProfile()); |
306 chrome::ShowPolicy(displayer.browser()); | 305 chrome::ShowPolicy(displayer.browser()); |
307 } | 306 } |
308 | 307 |
309 void SystemTrayClient::ShowNetworkConfigure(const std::string& network_id) { | 308 void SystemTrayClient::ShowNetworkConfigure(const std::string& network_id) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 session_manager::SessionManager::Get()->IsInSecondaryLoginScreen()) { | 346 session_manager::SessionManager::Get()->IsInSecondaryLoginScreen()) { |
348 return; | 347 return; |
349 } | 348 } |
350 | 349 |
351 std::string page = chrome::kInternetSubPage; | 350 std::string page = chrome::kInternetSubPage; |
352 if (!network_id.empty()) { | 351 if (!network_id.empty()) { |
353 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) | 352 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) |
354 page = chrome::kNetworkDetailSubPage; | 353 page = chrome::kNetworkDetailSubPage; |
355 page += "?guid=" + net::EscapeUrlEncodedData(network_id, true); | 354 page += "?guid=" + net::EscapeUrlEncodedData(network_id, true); |
356 } | 355 } |
357 content::RecordAction(base::UserMetricsAction("OpenInternetOptionsDialog")); | 356 base::RecordAction(base::UserMetricsAction("OpenInternetOptionsDialog")); |
358 ShowSettingsSubPageForActiveUser(page); | 357 ShowSettingsSubPageForActiveUser(page); |
359 } | 358 } |
360 | 359 |
361 void SystemTrayClient::ShowProxySettings() { | 360 void SystemTrayClient::ShowProxySettings() { |
362 LoginState* login_state = LoginState::Get(); | 361 LoginState* login_state = LoginState::Get(); |
363 // User is not logged in. | 362 // User is not logged in. |
364 CHECK(!login_state->IsUserLoggedIn() || | 363 CHECK(!login_state->IsUserLoggedIn() || |
365 login_state->GetLoggedInUserType() == LoginState::LOGGED_IN_USER_NONE); | 364 login_state->GetLoggedInUserType() == LoginState::LOGGED_IN_USER_NONE); |
366 chromeos::LoginDisplayHost::default_host()->OpenProxySettings(); | 365 chromeos::LoginDisplayHost::default_host()->OpenProxySettings(); |
367 } | 366 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 chromeos::system::SystemClock* clock) { | 400 chromeos::system::SystemClock* clock) { |
402 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); | 401 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
403 } | 402 } |
404 | 403 |
405 void SystemTrayClient::Observe(int type, | 404 void SystemTrayClient::Observe(int type, |
406 const content::NotificationSource& source, | 405 const content::NotificationSource& source, |
407 const content::NotificationDetails& details) { | 406 const content::NotificationDetails& details) { |
408 DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type); | 407 DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type); |
409 HandleUpdateAvailable(); | 408 HandleUpdateAvailable(); |
410 } | 409 } |
OLD | NEW |