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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "ash/ash_switches.h" | 12 #include "ash/ash_switches.h" |
13 #include "ash/desktop_background/desktop_background_controller.h" | 13 #include "ash/desktop_background/desktop_background_controller.h" |
| 14 #include "ash/session_state_delegate.h" |
| 15 #include "ash/session_state_observer.h" |
14 #include "ash/shell.h" | 16 #include "ash/shell.h" |
15 #include "ash/shell_delegate.h" | 17 #include "ash/shell_delegate.h" |
16 #include "ash/shell_window_ids.h" | 18 #include "ash/shell_window_ids.h" |
17 #include "ash/system/bluetooth/bluetooth_observer.h" | 19 #include "ash/system/bluetooth/bluetooth_observer.h" |
18 #include "ash/system/brightness/brightness_observer.h" | 20 #include "ash/system/brightness/brightness_observer.h" |
19 #include "ash/system/chromeos/audio/audio_observer.h" | 21 #include "ash/system/chromeos/audio/audio_observer.h" |
20 #include "ash/system/chromeos/network/network_observer.h" | 22 #include "ash/system/chromeos/network/network_observer.h" |
21 #include "ash/system/chromeos/network/network_tray_delegate.h" | 23 #include "ash/system/chromeos/network/network_tray_delegate.h" |
22 #include "ash/system/date/clock_observer.h" | 24 #include "ash/system/date/clock_observer.h" |
23 #include "ash/system/drive/drive_observer.h" | 25 #include "ash/system/drive/drive_observer.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 public SessionManagerClient::Observer, | 230 public SessionManagerClient::Observer, |
229 public NetworkLibrary::NetworkManagerObserver, | 231 public NetworkLibrary::NetworkManagerObserver, |
230 public drive::JobListObserver, | 232 public drive::JobListObserver, |
231 public content::NotificationObserver, | 233 public content::NotificationObserver, |
232 public input_method::InputMethodManager::Observer, | 234 public input_method::InputMethodManager::Observer, |
233 public system::TimezoneSettings::Observer, | 235 public system::TimezoneSettings::Observer, |
234 public chromeos::SystemClockClient::Observer, | 236 public chromeos::SystemClockClient::Observer, |
235 public device::BluetoothAdapter::Observer, | 237 public device::BluetoothAdapter::Observer, |
236 public SystemKeyEventListener::CapsLockObserver, | 238 public SystemKeyEventListener::CapsLockObserver, |
237 public ash::NetworkTrayDelegate, | 239 public ash::NetworkTrayDelegate, |
238 public policy::CloudPolicyStore::Observer { | 240 public policy::CloudPolicyStore::Observer, |
| 241 public ash::SessionStateObserver { |
239 public: | 242 public: |
240 SystemTrayDelegate() | 243 SystemTrayDelegate() |
241 : ui_weak_ptr_factory_( | 244 : ui_weak_ptr_factory_( |
242 new base::WeakPtrFactory<SystemTrayDelegate>(this)), | 245 new base::WeakPtrFactory<SystemTrayDelegate>(this)), |
243 user_profile_(NULL), | 246 user_profile_(NULL), |
244 clock_type_(base::k24HourClock), | 247 clock_type_(base::k24HourClock), |
245 search_key_mapped_to_(input_method::kSearchKey), | 248 search_key_mapped_to_(input_method::kSearchKey), |
246 screen_locked_(false), | 249 screen_locked_(false), |
247 have_session_start_time_(false), | 250 have_session_start_time_(false), |
248 have_session_length_limit_(false), | 251 have_session_length_limit_(false), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 305 |
303 system::TimezoneSettings::GetInstance()->AddObserver(this); | 306 system::TimezoneSettings::GetInstance()->AddObserver(this); |
304 DBusThreadManager::Get()->GetSystemClockClient()->AddObserver(this); | 307 DBusThreadManager::Get()->GetSystemClockClient()->AddObserver(this); |
305 | 308 |
306 if (SystemKeyEventListener::GetInstance()) | 309 if (SystemKeyEventListener::GetInstance()) |
307 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); | 310 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); |
308 | 311 |
309 device::BluetoothAdapterFactory::GetAdapter( | 312 device::BluetoothAdapterFactory::GetAdapter( |
310 base::Bind(&SystemTrayDelegate::InitializeOnAdapterReady, | 313 base::Bind(&SystemTrayDelegate::InitializeOnAdapterReady, |
311 ui_weak_ptr_factory_->GetWeakPtr())); | 314 ui_weak_ptr_factory_->GetWeakPtr())); |
| 315 |
| 316 ash::Shell::GetInstance()->session_state_delegate()-> |
| 317 AddSessionStateObserver(this); |
312 } | 318 } |
313 | 319 |
314 virtual void Shutdown() OVERRIDE { | 320 virtual void Shutdown() OVERRIDE { |
315 data_promo_notification_.reset(); | 321 data_promo_notification_.reset(); |
316 } | 322 } |
317 | 323 |
318 void InitializeOnAdapterReady( | 324 void InitializeOnAdapterReady( |
319 scoped_refptr<device::BluetoothAdapter> adapter) { | 325 scoped_refptr<device::BluetoothAdapter> adapter) { |
320 bluetooth_adapter_ = adapter; | 326 bluetooth_adapter_ = adapter; |
321 CHECK(bluetooth_adapter_); | 327 CHECK(bluetooth_adapter_); |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 | 1273 |
1268 // Overridden from CloudPolicyStore::Observer | 1274 // Overridden from CloudPolicyStore::Observer |
1269 virtual void OnStoreLoaded(policy::CloudPolicyStore* store) OVERRIDE { | 1275 virtual void OnStoreLoaded(policy::CloudPolicyStore* store) OVERRIDE { |
1270 UpdateEnterpriseDomain(); | 1276 UpdateEnterpriseDomain(); |
1271 } | 1277 } |
1272 | 1278 |
1273 virtual void OnStoreError(policy::CloudPolicyStore* store) OVERRIDE { | 1279 virtual void OnStoreError(policy::CloudPolicyStore* store) OVERRIDE { |
1274 UpdateEnterpriseDomain(); | 1280 UpdateEnterpriseDomain(); |
1275 } | 1281 } |
1276 | 1282 |
| 1283 // Overridden from ash::SessionStateObserver |
| 1284 virtual void ActiveUserChanged(const std::string& user_id) OVERRIDE { |
| 1285 GetSystemTrayNotifier()->NotifyUserUpdate(); |
| 1286 } |
| 1287 |
1277 void UpdateCellular() { | 1288 void UpdateCellular() { |
1278 const CellularNetworkVector& cellular_networks = | 1289 const CellularNetworkVector& cellular_networks = |
1279 CrosLibrary::Get()->GetNetworkLibrary()->cellular_networks(); | 1290 CrosLibrary::Get()->GetNetworkLibrary()->cellular_networks(); |
1280 if (cellular_networks.empty()) | 1291 if (cellular_networks.empty()) |
1281 return; | 1292 return; |
1282 // We only care about the first cellular network (in practice there will | 1293 // We only care about the first cellular network (in practice there will |
1283 // only ever be one) | 1294 // only ever be one) |
1284 const CellularNetwork* cellular = cellular_networks[0]; | 1295 const CellularNetwork* cellular = cellular_networks[0]; |
1285 if (cellular->activation_state() == ACTIVATION_STATE_ACTIVATING) { | 1296 if (cellular->activation_state() == ACTIVATION_STATE_ACTIVATING) { |
1286 cellular_activating_ = true; | 1297 cellular_activating_ = true; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1336 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1326 }; | 1337 }; |
1327 | 1338 |
1328 } // namespace | 1339 } // namespace |
1329 | 1340 |
1330 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1341 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1331 return new chromeos::SystemTrayDelegate(); | 1342 return new chromeos::SystemTrayDelegate(); |
1332 } | 1343 } |
1333 | 1344 |
1334 } // namespace chromeos | 1345 } // namespace chromeos |
OLD | NEW |