Chromium Code Reviews| 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 // Map ChromeOS specific LOGGED_IN states to Ash LOGGED_IN states. |
| 384 // At new user image screen manager->IsUserLoggedIn() would return true | 385 LoginState::LoggedInState state = LoginState::Get()->GetLoggedInState(); |
| 385 // but there's no browser session available yet so use SessionStarted(). | 386 if (state == LoginState::LOGGED_IN_OOBE || |
| 386 if (!manager->IsSessionStarted()) | 387 state == LoginState::LOGGED_IN_NONE) |
| 387 return ash::user::LOGGED_IN_NONE; | 388 return ash::user::LOGGED_IN_NONE; |
|
Nikita (slow)
2013/04/10 08:09:22
nit: Add {}
stevenjb
2013/04/10 16:32:17
Done.
| |
| 388 if (screen_locked_) | 389 if (screen_locked_) |
| 389 return ash::user::LOGGED_IN_LOCKED; | 390 return ash::user::LOGGED_IN_LOCKED; |
| 390 if (manager->IsCurrentUserOwner()) | 391 |
| 391 return ash::user::LOGGED_IN_OWNER; | 392 LoginState::LoggedInUserType user_type = |
| 392 if (manager->IsLoggedInAsGuest()) | 393 LoginState::Get()->GetLoggedInUserType(); |
| 393 return ash::user::LOGGED_IN_GUEST; | 394 switch (user_type) { |
| 394 if (manager->IsLoggedInAsDemoUser()) | 395 case LoginState::LOGGED_IN_USER_NONE: |
| 395 return ash::user::LOGGED_IN_RETAIL_MODE; | 396 return ash::user::LOGGED_IN_NONE; |
| 396 if (manager->IsLoggedInAsPublicAccount()) | 397 case LoginState::LOGGED_IN_USER_REGULAR: |
| 397 return ash::user::LOGGED_IN_PUBLIC; | 398 return ash::user::LOGGED_IN_USER; |
| 398 return ash::user::LOGGED_IN_USER; | 399 case LoginState::LOGGED_IN_USER_OWNER: |
| 400 return ash::user::LOGGED_IN_OWNER; | |
| 401 case LoginState::LOGGED_IN_USER_GUEST: | |
| 402 return ash::user::LOGGED_IN_GUEST; | |
| 403 case LoginState::LOGGED_IN_USER_RETAIL_MODE: | |
| 404 return ash::user::LOGGED_IN_RETAIL_MODE; | |
| 405 case LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT: | |
| 406 return ash::user::LOGGED_IN_PUBLIC; | |
| 407 case LoginState::LOGGED_IN_USER_LOCALLY_MANAGED: | |
| 408 return ash::user::LOGGED_IN_LOCALLY_MANAGED; | |
| 409 case LoginState::LOGGED_IN_USER_KIOSK_APP: | |
| 410 return ash::user::LOGGED_IN_KIOSK_APP; | |
| 411 } | |
| 412 NOTREACHED(); | |
| 413 return ash::user::LOGGED_IN_NONE; | |
| 399 } | 414 } |
| 400 | 415 |
| 401 virtual bool IsOobeCompleted() const OVERRIDE { | 416 virtual bool IsOobeCompleted() const OVERRIDE { |
| 402 return WizardController::IsOobeCompleted(); | 417 return WizardController::IsOobeCompleted(); |
| 403 } | 418 } |
| 404 | 419 |
| 405 virtual void ChangeProfilePicture() OVERRIDE { | 420 virtual void ChangeProfilePicture() OVERRIDE { |
| 406 content::RecordAction( | 421 content::RecordAction( |
| 407 content::UserMetricsAction("OpenChangeProfilePictureDialog")); | 422 content::UserMetricsAction("OpenChangeProfilePictureDialog")); |
| 408 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 423 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1528 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1543 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 1529 }; | 1544 }; |
| 1530 | 1545 |
| 1531 } // namespace | 1546 } // namespace |
| 1532 | 1547 |
| 1533 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1548 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1534 return new chromeos::SystemTrayDelegate(); | 1549 return new chromeos::SystemTrayDelegate(); |
| 1535 } | 1550 } |
| 1536 | 1551 |
| 1537 } // namespace chromeos | 1552 } // namespace chromeos |
| OLD | NEW |