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 <memory> | 10 #include <memory> |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 const user_manager::User* /* active_user */) { | 455 const user_manager::User* /* active_user */) { |
456 } | 456 } |
457 | 457 |
458 void SystemTrayDelegateChromeOS::UserChangedChildStatus( | 458 void SystemTrayDelegateChromeOS::UserChangedChildStatus( |
459 user_manager::User* user) { | 459 user_manager::User* user) { |
460 Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(user); | 460 Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(user); |
461 | 461 |
462 // Returned user_profile might be NULL on restoring Users on browser start. | 462 // Returned user_profile might be NULL on restoring Users on browser start. |
463 // At some point profile is not yet fully initiated. | 463 // At some point profile is not yet fully initiated. |
464 if (session_started_ && user_profile && user_profile_ == user_profile) | 464 if (session_started_ && user_profile && user_profile_ == user_profile) |
465 ash::WmShell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); | 465 ash::Shell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); |
466 } | 466 } |
467 | 467 |
468 ash::SystemTrayNotifier* SystemTrayDelegateChromeOS::GetSystemTrayNotifier() { | 468 ash::SystemTrayNotifier* SystemTrayDelegateChromeOS::GetSystemTrayNotifier() { |
469 return ash::WmShell::Get()->system_tray_notifier(); | 469 return ash::WmShell::Get()->system_tray_notifier(); |
470 } | 470 } |
471 | 471 |
472 void SystemTrayDelegateChromeOS::SetProfile(Profile* profile) { | 472 void SystemTrayDelegateChromeOS::SetProfile(Profile* profile) { |
473 // Stop observing the AppWindowRegistry of the current |user_profile_|. | 473 // Stop observing the AppWindowRegistry of the current |user_profile_|. |
474 StopObservingAppWindowRegistry(); | 474 StopObservingAppWindowRegistry(); |
475 | 475 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 user_profile_)->app_windows().empty()) { | 612 user_profile_)->app_windows().empty()) { |
613 // The current user has at least one open app window. | 613 // The current user has at least one open app window. |
614 return; | 614 return; |
615 } | 615 } |
616 | 616 |
617 GetSystemTrayNotifier()->NotifyLastWindowClosed(); | 617 GetSystemTrayNotifier()->NotifyLastWindowClosed(); |
618 } | 618 } |
619 | 619 |
620 // Overridden from SessionManagerClient::Observer. | 620 // Overridden from SessionManagerClient::Observer. |
621 void SystemTrayDelegateChromeOS::ScreenIsLocked() { | 621 void SystemTrayDelegateChromeOS::ScreenIsLocked() { |
622 ash::WmShell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); | 622 ash::Shell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); |
623 } | 623 } |
624 | 624 |
625 void SystemTrayDelegateChromeOS::ScreenIsUnlocked() { | 625 void SystemTrayDelegateChromeOS::ScreenIsUnlocked() { |
626 ash::WmShell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); | 626 ash::Shell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); |
627 } | 627 } |
628 | 628 |
629 // content::NotificationObserver implementation. | 629 // content::NotificationObserver implementation. |
630 void SystemTrayDelegateChromeOS::Observe( | 630 void SystemTrayDelegateChromeOS::Observe( |
631 int type, | 631 int type, |
632 const content::NotificationSource& source, | 632 const content::NotificationSource& source, |
633 const content::NotificationDetails& details) { | 633 const content::NotificationDetails& details) { |
634 switch (type) { | 634 switch (type) { |
635 case chrome::NOTIFICATION_PROFILE_CREATED: { | 635 case chrome::NOTIFICATION_PROFILE_CREATED: { |
636 SetProfile(content::Source<Profile>(source).ptr()); | 636 SetProfile(content::Source<Profile>(source).ptr()); |
637 registrar_->Remove(this, | 637 registrar_->Remove(this, |
638 chrome::NOTIFICATION_PROFILE_CREATED, | 638 chrome::NOTIFICATION_PROFILE_CREATED, |
639 content::NotificationService::AllSources()); | 639 content::NotificationService::AllSources()); |
640 break; | 640 break; |
641 } | 641 } |
642 case chrome::NOTIFICATION_PROFILE_DESTROYED: { | 642 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
643 if (UnsetProfile(content::Source<Profile>(source).ptr())) { | 643 if (UnsetProfile(content::Source<Profile>(source).ptr())) { |
644 registrar_->Remove(this, | 644 registrar_->Remove(this, |
645 chrome::NOTIFICATION_PROFILE_DESTROYED, | 645 chrome::NOTIFICATION_PROFILE_DESTROYED, |
646 content::NotificationService::AllSources()); | 646 content::NotificationService::AllSources()); |
647 } | 647 } |
648 break; | 648 break; |
649 } | 649 } |
650 case chrome::NOTIFICATION_SESSION_STARTED: { | 650 case chrome::NOTIFICATION_SESSION_STARTED: { |
651 session_started_ = true; | 651 session_started_ = true; |
652 ash::WmShell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); | 652 ash::Shell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); |
653 SetProfile(ProfileManager::GetActiveUserProfile()); | 653 SetProfile(ProfileManager::GetActiveUserProfile()); |
654 break; | 654 break; |
655 } | 655 } |
656 default: | 656 default: |
657 NOTREACHED(); | 657 NOTREACHED(); |
658 } | 658 } |
659 } | 659 } |
660 | 660 |
661 void SystemTrayDelegateChromeOS::OnLanguageRemapSearchKeyToChanged() { | 661 void SystemTrayDelegateChromeOS::OnLanguageRemapSearchKeyToChanged() { |
662 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( | 662 search_key_mapped_to_ = user_pref_registrar_->prefs()->GetInteger( |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 791 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
792 << "ENABLE_SUPERVISED_USERS undefined."; | 792 << "ENABLE_SUPERVISED_USERS undefined."; |
793 return base::string16(); | 793 return base::string16(); |
794 } | 794 } |
795 | 795 |
796 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 796 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
797 return new SystemTrayDelegateChromeOS(); | 797 return new SystemTrayDelegateChromeOS(); |
798 } | 798 } |
799 | 799 |
800 } // namespace chromeos | 800 } // namespace chromeos |
OLD | NEW |