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> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 #include "chrome/common/chrome_notification_types.h" | 82 #include "chrome/common/chrome_notification_types.h" |
83 #include "chrome/common/pref_names.h" | 83 #include "chrome/common/pref_names.h" |
84 #include "chrome/common/time_format.h" | 84 #include "chrome/common/time_format.h" |
85 #include "chrome/common/url_constants.h" | 85 #include "chrome/common/url_constants.h" |
86 #include "chromeos/chromeos_switches.h" | 86 #include "chromeos/chromeos_switches.h" |
87 #include "chromeos/dbus/dbus_thread_manager.h" | 87 #include "chromeos/dbus/dbus_thread_manager.h" |
88 #include "chromeos/dbus/power_manager_client.h" | 88 #include "chromeos/dbus/power_manager_client.h" |
89 #include "chromeos/dbus/session_manager_client.h" | 89 #include "chromeos/dbus/session_manager_client.h" |
90 #include "chromeos/dbus/system_clock_client.h" | 90 #include "chromeos/dbus/system_clock_client.h" |
91 #include "chromeos/ime/xkeyboard.h" | 91 #include "chromeos/ime/xkeyboard.h" |
92 #include "chromeos/login/login_state.h" | |
92 #include "content/public/browser/browser_thread.h" | 93 #include "content/public/browser/browser_thread.h" |
93 #include "content/public/browser/notification_observer.h" | 94 #include "content/public/browser/notification_observer.h" |
94 #include "content/public/browser/notification_service.h" | 95 #include "content/public/browser/notification_service.h" |
95 #include "content/public/browser/user_metrics.h" | 96 #include "content/public/browser/user_metrics.h" |
96 #include "device/bluetooth/bluetooth_adapter.h" | 97 #include "device/bluetooth/bluetooth_adapter.h" |
97 #include "device/bluetooth/bluetooth_adapter_factory.h" | 98 #include "device/bluetooth/bluetooth_adapter_factory.h" |
98 #include "device/bluetooth/bluetooth_device.h" | 99 #include "device/bluetooth/bluetooth_device.h" |
99 #include "grit/ash_strings.h" | 100 #include "grit/ash_strings.h" |
100 #include "grit/generated_resources.h" | 101 #include "grit/generated_resources.h" |
101 #include "grit/locale_settings.h" | 102 #include "grit/locale_settings.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = | 358 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
358 g_browser_process->browser_policy_connector()-> | 359 g_browser_process->browser_policy_connector()-> |
359 GetDeviceCloudPolicyManager(); | 360 GetDeviceCloudPolicyManager(); |
360 if (policy_manager) | 361 if (policy_manager) |
361 policy_manager->core()->store()->RemoveObserver(this); | 362 policy_manager->core()->store()->RemoveObserver(this); |
362 } | 363 } |
363 | 364 |
364 // Overridden from ash::SystemTrayDelegate: | 365 // Overridden from ash::SystemTrayDelegate: |
365 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { | 366 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { |
366 // In case of OOBE / sign in screen tray will be shown later. | 367 // In case of OOBE / sign in screen tray will be shown later. |
367 return UserManager::Get()->IsUserLoggedIn(); | 368 return LoginState::Get()->IsUserLoggedIn(); |
368 } | 369 } |
369 | 370 |
370 virtual const string16 GetUserDisplayName() const OVERRIDE { | 371 virtual const string16 GetUserDisplayName() const OVERRIDE { |
371 return UserManager::Get()->GetLoggedInUser()->GetDisplayName(); | 372 return UserManager::Get()->GetLoggedInUser()->GetDisplayName(); |
372 } | 373 } |
373 | 374 |
374 virtual const std::string GetUserEmail() const OVERRIDE { | 375 virtual const std::string GetUserEmail() const OVERRIDE { |
375 return UserManager::Get()->GetLoggedInUser()->display_email(); | 376 return UserManager::Get()->GetLoggedInUser()->display_email(); |
376 } | 377 } |
377 | 378 |
378 virtual const gfx::ImageSkia& GetUserImage() const OVERRIDE { | 379 virtual const gfx::ImageSkia& GetUserImage() const OVERRIDE { |
379 return UserManager::Get()->GetLoggedInUser()->image(); | 380 return UserManager::Get()->GetLoggedInUser()->image(); |
380 } | 381 } |
381 | 382 |
382 virtual ash::user::LoginStatus GetUserLoginStatus() const OVERRIDE { | 383 virtual ash::user::LoginStatus GetUserLoginStatus() const OVERRIDE { |
383 UserManager* manager = UserManager::Get(); | 384 LoginState::State state = LoginState::Get()->GetLoginState(); |
bartfab (slow)
2013/04/05 13:16:33
I really dislike this - two almost-identical enums
stevenjb
2013/04/05 18:17:15
One of them is Ash-specific (which may be on Windo
bartfab (slow)
2013/04/08 15:18:36
I don't see much reason to abstract away OOBE when
| |
384 // At new user image screen manager->IsUserLoggedIn() would return true | 385 switch (state) { |
385 // but there's no browser session available yet so use SessionStarted(). | 386 case LoginState::LOGGED_IN_OOBE: |
386 if (!manager->IsSessionStarted()) | 387 case LoginState::LOGGED_IN_NONE: |
387 return ash::user::LOGGED_IN_NONE; | 388 return ash::user::LOGGED_IN_NONE; |
388 if (screen_locked_) | 389 case LoginState::LOGGED_IN_LOCKED: |
389 return ash::user::LOGGED_IN_LOCKED; | 390 return ash::user::LOGGED_IN_LOCKED; |
390 if (manager->IsCurrentUserOwner()) | 391 case LoginState::LOGGED_IN_USER: |
391 return ash::user::LOGGED_IN_OWNER; | 392 return ash::user::LOGGED_IN_USER; |
392 if (manager->IsLoggedInAsGuest()) | 393 case LoginState::LOGGED_IN_OWNER: |
393 return ash::user::LOGGED_IN_GUEST; | 394 return ash::user::LOGGED_IN_OWNER; |
394 if (manager->IsLoggedInAsDemoUser()) | 395 case LoginState::LOGGED_IN_GUEST: |
395 return ash::user::LOGGED_IN_RETAIL_MODE; | 396 return ash::user::LOGGED_IN_GUEST; |
396 if (manager->IsLoggedInAsPublicAccount()) | 397 case LoginState::LOGGED_IN_RETAIL_MODE: |
397 return ash::user::LOGGED_IN_PUBLIC; | 398 return ash::user::LOGGED_IN_RETAIL_MODE; |
398 return ash::user::LOGGED_IN_USER; | 399 case LoginState::LOGGED_IN_KIOSK_APP: |
400 return ash::user::LOGGED_IN_KIOSK_APP; | |
401 case LoginState::LOGGED_IN_PUBLIC: | |
402 return ash::user::LOGGED_IN_PUBLIC; | |
403 } | |
404 NOTREACHED(); | |
405 return ash::user::LOGGED_IN_NONE; | |
399 } | 406 } |
400 | 407 |
401 virtual bool IsOobeCompleted() const OVERRIDE { | 408 virtual bool IsOobeCompleted() const OVERRIDE { |
402 return WizardController::IsOobeCompleted(); | 409 return WizardController::IsOobeCompleted(); |
403 } | 410 } |
404 | 411 |
405 virtual void ChangeProfilePicture() OVERRIDE { | 412 virtual void ChangeProfilePicture() OVERRIDE { |
406 content::RecordAction( | 413 content::RecordAction( |
407 content::UserMetricsAction("OpenChangeProfilePictureDialog")); | 414 content::UserMetricsAction("OpenChangeProfilePictureDialog")); |
408 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 415 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1529 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1536 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1530 }; | 1537 }; |
1531 | 1538 |
1532 } // namespace | 1539 } // namespace |
1533 | 1540 |
1534 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1541 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1535 return new chromeos::SystemTrayDelegate(); | 1542 return new chromeos::SystemTrayDelegate(); |
1536 } | 1543 } |
1537 | 1544 |
1538 } // namespace chromeos | 1545 } // namespace chromeos |
OLD | NEW |