OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/system/ash_system_tray_delegate.h" | 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/system/audio/audio_observer.h" | 9 #include "ash/system/audio/audio_observer.h" |
10 #include "ash/system/bluetooth/bluetooth_observer.h" | 10 #include "ash/system/bluetooth/bluetooth_observer.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 registrar_.Add(this, | 118 registrar_.Add(this, |
119 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 119 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
120 content::NotificationService::AllSources()); | 120 content::NotificationService::AllSources()); |
121 registrar_.Add(this, | 121 registrar_.Add(this, |
122 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 122 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
123 content::NotificationService::AllSources()); | 123 content::NotificationService::AllSources()); |
124 registrar_.Add(this, | 124 registrar_.Add(this, |
125 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, | 125 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
126 content::NotificationService::AllSources()); | 126 content::NotificationService::AllSources()); |
| 127 if (GetUserLoginStatus() == ash::user::LOGGED_IN_NONE) { |
| 128 registrar_.Add(this, |
| 129 chrome::NOTIFICATION_SESSION_STARTED, |
| 130 content::NotificationService::AllSources()); |
| 131 } |
127 registrar_.Add(this, | 132 registrar_.Add(this, |
128 chrome::NOTIFICATION_SESSION_STARTED, | 133 chrome::NOTIFICATION_PROFILE_CREATED, |
129 content::NotificationService::AllSources()); | 134 content::NotificationService::AllSources()); |
130 | 135 |
131 SetProfile(ProfileManager::GetDefaultProfile()); | |
132 | |
133 network_icon_large_->SetResourceSize(NetworkMenuIcon::SIZE_LARGE); | 136 network_icon_large_->SetResourceSize(NetworkMenuIcon::SIZE_LARGE); |
134 | 137 |
135 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, | 138 accessibility_enabled_.Init(prefs::kSpokenFeedbackEnabled, |
136 g_browser_process->local_state(), this); | 139 g_browser_process->local_state(), this); |
137 | 140 |
138 bluetooth_adapter_.reset(BluetoothAdapter::CreateDefaultAdapter()); | 141 bluetooth_adapter_.reset(BluetoothAdapter::CreateDefaultAdapter()); |
139 bluetooth_adapter_->AddObserver(this); | 142 bluetooth_adapter_->AddObserver(this); |
140 } | 143 } |
141 | 144 |
142 virtual ~SystemTrayDelegate() { | 145 virtual ~SystemTrayDelegate() { |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 ash::Shell::GetInstance()->tray()->accessibility_observer(); | 616 ash::Shell::GetInstance()->tray()->accessibility_observer(); |
614 if (observer) { | 617 if (observer) { |
615 observer->OnAccessibilityModeChanged( | 618 observer->OnAccessibilityModeChanged( |
616 service->GetBoolean(prefs::kSpokenFeedbackEnabled)); | 619 service->GetBoolean(prefs::kSpokenFeedbackEnabled)); |
617 } | 620 } |
618 } else { | 621 } else { |
619 NOTREACHED(); | 622 NOTREACHED(); |
620 } | 623 } |
621 break; | 624 break; |
622 } | 625 } |
| 626 case chrome::NOTIFICATION_PROFILE_CREATED: { |
| 627 SetProfile(content::Source<Profile>(source).ptr()); |
| 628 registrar_.Remove(this, |
| 629 chrome::NOTIFICATION_PROFILE_CREATED, |
| 630 content::NotificationService::AllSources()); |
| 631 break; |
| 632 } |
623 case chrome::NOTIFICATION_SESSION_STARTED: { | 633 case chrome::NOTIFICATION_SESSION_STARTED: { |
624 SetProfile(ProfileManager::GetDefaultProfile()); | 634 SetProfile(ProfileManager::GetDefaultProfile()); |
625 break; | 635 break; |
626 } | 636 } |
627 default: | 637 default: |
628 NOTREACHED(); | 638 NOTREACHED(); |
629 } | 639 } |
630 } | 640 } |
631 | 641 |
632 // Overridden from InputMethodManager::Observer. | 642 // Overridden from InputMethodManager::Observer. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 724 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
715 }; | 725 }; |
716 | 726 |
717 } // namespace | 727 } // namespace |
718 | 728 |
719 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 729 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
720 return new chromeos::SystemTrayDelegate(tray); | 730 return new chromeos::SystemTrayDelegate(tray); |
721 } | 731 } |
722 | 732 |
723 } // namespace chromeos | 733 } // namespace chromeos |
OLD | NEW |