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/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "chrome/browser/chromeos/settings/cros_settings.h" | 65 #include "chrome/browser/chromeos/settings/cros_settings.h" |
66 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" | 66 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" |
67 #include "chrome/browser/lifetime/application_lifetime.h" | 67 #include "chrome/browser/lifetime/application_lifetime.h" |
68 #include "chrome/browser/profiles/profile_manager.h" | 68 #include "chrome/browser/profiles/profile_manager.h" |
69 #include "chrome/browser/supervised_user/supervised_user_service.h" | 69 #include "chrome/browser/supervised_user/supervised_user_service.h" |
70 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 70 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
71 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" | 71 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" |
72 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" | 72 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" |
73 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 73 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
74 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 74 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
75 #include "chrome/browser/ui/ash/system_tray_common.h" | 75 #include "chrome/browser/ui/ash/system_tray_client.h" |
76 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" | 76 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
77 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" | 77 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" |
78 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" | 78 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" |
79 #include "chrome/browser/ui/browser.h" | 79 #include "chrome/browser/ui/browser.h" |
80 #include "chrome/browser/ui/browser_finder.h" | 80 #include "chrome/browser/ui/browser_finder.h" |
81 #include "chrome/browser/ui/browser_list.h" | 81 #include "chrome/browser/ui/browser_list.h" |
82 #include "chrome/browser/ui/chrome_pages.h" | 82 #include "chrome/browser/ui/chrome_pages.h" |
83 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 83 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
84 #include "chrome/browser/ui/singleton_tabs.h" | 84 #include "chrome/browser/ui/singleton_tabs.h" |
85 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 85 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 390 |
391 bool SystemTrayDelegateChromeOS::IsUserChild() const { | 391 bool SystemTrayDelegateChromeOS::IsUserChild() const { |
392 return user_manager::UserManager::Get()->IsLoggedInAsChildUser(); | 392 return user_manager::UserManager::Get()->IsLoggedInAsChildUser(); |
393 } | 393 } |
394 | 394 |
395 void SystemTrayDelegateChromeOS::GetSystemUpdateInfo( | 395 void SystemTrayDelegateChromeOS::GetSystemUpdateInfo( |
396 ash::UpdateInfo* info) const { | 396 ash::UpdateInfo* info) const { |
397 GetUpdateInfo(UpgradeDetector::GetInstance(), info); | 397 GetUpdateInfo(UpgradeDetector::GetInstance(), info); |
398 } | 398 } |
399 | 399 |
400 void SystemTrayDelegateChromeOS::ShowSettings() { | |
401 SystemTrayCommon::ShowSettings(); | |
402 } | |
403 | |
404 bool SystemTrayDelegateChromeOS::ShouldShowSettings() { | 400 bool SystemTrayDelegateChromeOS::ShouldShowSettings() { |
405 ash::WmShell* wm_shell = ash::WmShell::Get(); | 401 ash::WmShell* wm_shell = ash::WmShell::Get(); |
406 return ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldShowSettings() && | 402 return ChromeUserManager::Get()->GetCurrentUserFlow()->ShouldShowSettings() && |
407 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); | 403 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); |
408 } | 404 } |
409 | 405 |
410 void SystemTrayDelegateChromeOS::ShowSetTimeDialog() { | 406 void SystemTrayDelegateChromeOS::ShowSetTimeDialog() { |
411 // TODO(mash): Refactor out GetNativeWindow and move to SystemTrayCommon. | 407 // TODO(mash): Refactor out GetNativeWindow and move to SystemTrayClient. |
412 SetTimeDialog::ShowDialog(GetNativeWindow()); | 408 SetTimeDialog::ShowDialog(GetNativeWindow()); |
413 } | 409 } |
414 | 410 |
415 void SystemTrayDelegateChromeOS::ShowNetworkSettingsForGuid( | 411 void SystemTrayDelegateChromeOS::ShowNetworkSettingsForGuid( |
416 const std::string& guid) { | 412 const std::string& guid) { |
417 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayCommon. | 413 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient. |
418 ash::WmShell* wm_shell = ash::WmShell::Get(); | 414 ash::WmShell* wm_shell = ash::WmShell::Get(); |
419 if (LoginState::Get()->IsUserLoggedIn() && | 415 if (LoginState::Get()->IsUserLoggedIn() && |
420 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) { | 416 !wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) { |
421 std::string page = chrome::kInternetOptionsSubPage; | 417 std::string page = chrome::kInternetOptionsSubPage; |
422 if (!guid.empty()) | 418 if (!guid.empty()) |
423 page += "?guid=" + net::EscapeUrlEncodedData(guid, true); | 419 page += "?guid=" + net::EscapeUrlEncodedData(guid, true); |
424 content::RecordAction(base::UserMetricsAction("OpenInternetOptionsDialog")); | 420 content::RecordAction(base::UserMetricsAction("OpenInternetOptionsDialog")); |
425 ShowSettingsSubPageForActiveUser(page); | 421 ShowSettingsSubPageForActiveUser(page); |
426 } | 422 } |
427 } | 423 } |
428 | 424 |
429 void SystemTrayDelegateChromeOS::ShowDisplaySettings() { | |
430 SystemTrayCommon::ShowDisplaySettings(); | |
431 } | |
432 | |
433 void SystemTrayDelegateChromeOS::ShowPowerSettings() { | |
434 SystemTrayCommon::ShowPowerSettings(); | |
435 } | |
436 | |
437 void SystemTrayDelegateChromeOS::ShowChromeSlow() { | |
438 SystemTrayCommon::ShowChromeSlow(); | |
439 } | |
440 | |
441 bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() { | 425 bool SystemTrayDelegateChromeOS::ShouldShowDisplayNotification() { |
442 // Packaged app is not counted as 'last active', so if a browser opening the | 426 // Packaged app is not counted as 'last active', so if a browser opening the |
443 // display settings is in background of a packaged app, it will return true. | 427 // display settings is in background of a packaged app, it will return true. |
444 // TODO(mukai): fix this. | 428 // TODO(mukai): fix this. |
445 Browser* active_browser = chrome::FindLastActive(); | 429 Browser* active_browser = chrome::FindLastActive(); |
446 if (!active_browser) | 430 if (!active_browser) |
447 return true; | 431 return true; |
448 | 432 |
449 content::WebContents* active_contents = | 433 content::WebContents* active_contents = |
450 active_browser->tab_strip_model()->GetActiveWebContents(); | 434 active_browser->tab_strip_model()->GetActiveWebContents(); |
451 if (!active_contents) | 435 if (!active_contents) |
452 return true; | 436 return true; |
453 | 437 |
454 GURL visible_url = active_contents->GetLastCommittedURL(); | 438 GURL visible_url = active_contents->GetLastCommittedURL(); |
455 return !chrome::IsSettingsSubPage( | 439 return !chrome::IsSettingsSubPage( |
456 visible_url, SystemTrayCommon::kDisplaySettingsSubPageName) && | 440 visible_url, SystemTrayClient::kDisplaySettingsSubPageName) && |
457 !chrome::IsSettingsSubPage( | 441 !chrome::IsSettingsSubPage( |
458 visible_url, | 442 visible_url, |
459 SystemTrayCommon::kDisplayOverscanSettingsSubPageName); | 443 SystemTrayClient::kDisplayOverscanSettingsSubPageName); |
460 } | |
461 | |
462 void SystemTrayDelegateChromeOS::ShowIMESettings() { | |
463 SystemTrayCommon::ShowIMESettings(); | |
464 } | |
465 | |
466 void SystemTrayDelegateChromeOS::ShowHelp() { | |
467 SystemTrayCommon::ShowHelp(); | |
468 } | |
469 | |
470 void SystemTrayDelegateChromeOS::ShowAccessibilityHelp() { | |
471 SystemTrayCommon::ShowAccessibilityHelp(); | |
472 } | |
473 | |
474 void SystemTrayDelegateChromeOS::ShowAccessibilitySettings() { | |
475 SystemTrayCommon::ShowAccessibilitySettings(); | |
476 } | |
477 | |
478 void SystemTrayDelegateChromeOS::ShowPaletteHelp() { | |
479 SystemTrayCommon::ShowPaletteHelp(); | |
480 } | |
481 | |
482 void SystemTrayDelegateChromeOS::ShowPaletteSettings() { | |
483 SystemTrayCommon::ShowPaletteSettings(); | |
484 } | |
485 | |
486 void SystemTrayDelegateChromeOS::ShowPublicAccountInfo() { | |
487 SystemTrayCommon::ShowPublicAccountInfo(); | |
488 } | 444 } |
489 | 445 |
490 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { | 446 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { |
491 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayCommon. | 447 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient. |
492 ash::LoginStatus status = GetUserLoginStatus(); | 448 ash::LoginStatus status = GetUserLoginStatus(); |
493 ash::WmShell* wm_shell = ash::WmShell::Get(); | 449 ash::WmShell* wm_shell = ash::WmShell::Get(); |
494 if (status == ash::LoginStatus::NOT_LOGGED_IN || | 450 if (status == ash::LoginStatus::NOT_LOGGED_IN || |
495 status == ash::LoginStatus::LOCKED || | 451 status == ash::LoginStatus::LOCKED || |
496 wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) { | 452 wm_shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen()) { |
497 scoped_refptr<chromeos::HelpAppLauncher> help_app( | 453 scoped_refptr<chromeos::HelpAppLauncher> help_app( |
498 new chromeos::HelpAppLauncher(GetNativeWindow())); | 454 new chromeos::HelpAppLauncher(GetNativeWindow())); |
499 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); | 455 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); |
500 } else { | 456 } else { |
501 chrome::ScopedTabbedBrowserDisplayer displayer( | 457 chrome::ScopedTabbedBrowserDisplayer displayer( |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 | 671 |
716 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { | 672 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { |
717 return bluetooth_adapter_ && bluetooth_adapter_->IsPowered(); | 673 return bluetooth_adapter_ && bluetooth_adapter_->IsPowered(); |
718 } | 674 } |
719 | 675 |
720 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { | 676 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { |
721 return bluetooth_discovery_session_ && | 677 return bluetooth_discovery_session_ && |
722 bluetooth_discovery_session_->IsActive(); | 678 bluetooth_discovery_session_->IsActive(); |
723 } | 679 } |
724 | 680 |
725 void SystemTrayDelegateChromeOS::ShowProxySettings() { | |
726 SystemTrayCommon::ShowProxySettings(); | |
727 } | |
728 | |
729 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() { | 681 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() { |
730 if (!cast_config_delegate_) | 682 if (!cast_config_delegate_) |
731 cast_config_delegate_ = CreateCastConfigDelegate(); | 683 cast_config_delegate_ = CreateCastConfigDelegate(); |
732 return cast_config_delegate_.get(); | 684 return cast_config_delegate_.get(); |
733 } | 685 } |
734 | 686 |
735 ash::NetworkingConfigDelegate* | 687 ash::NetworkingConfigDelegate* |
736 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { | 688 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { |
737 return networking_config_delegate_.get(); | 689 return networking_config_delegate_.get(); |
738 } | 690 } |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1217 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
1266 << "ENABLE_SUPERVISED_USERS undefined."; | 1218 << "ENABLE_SUPERVISED_USERS undefined."; |
1267 return base::string16(); | 1219 return base::string16(); |
1268 } | 1220 } |
1269 | 1221 |
1270 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1222 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1271 return new SystemTrayDelegateChromeOS(); | 1223 return new SystemTrayDelegateChromeOS(); |
1272 } | 1224 } |
1273 | 1225 |
1274 } // namespace chromeos | 1226 } // namespace chromeos |
OLD | NEW |