| 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; |
| 389 } |
| 388 if (screen_locked_) | 390 if (screen_locked_) |
| 389 return ash::user::LOGGED_IN_LOCKED; | 391 return ash::user::LOGGED_IN_LOCKED; |
| 390 if (manager->IsCurrentUserOwner()) | 392 |
| 391 return ash::user::LOGGED_IN_OWNER; | 393 LoginState::LoggedInUserType user_type = |
| 392 if (manager->IsLoggedInAsGuest()) | 394 LoginState::Get()->GetLoggedInUserType(); |
| 393 return ash::user::LOGGED_IN_GUEST; | 395 switch (user_type) { |
| 394 if (manager->IsLoggedInAsDemoUser()) | 396 case LoginState::LOGGED_IN_USER_NONE: |
| 395 return ash::user::LOGGED_IN_RETAIL_MODE; | 397 return ash::user::LOGGED_IN_NONE; |
| 396 if (manager->IsLoggedInAsPublicAccount()) | 398 case LoginState::LOGGED_IN_USER_REGULAR: |
| 397 return ash::user::LOGGED_IN_PUBLIC; | 399 return ash::user::LOGGED_IN_USER; |
| 398 return ash::user::LOGGED_IN_USER; | 400 case LoginState::LOGGED_IN_USER_OWNER: |
| 401 return ash::user::LOGGED_IN_OWNER; |
| 402 case LoginState::LOGGED_IN_USER_GUEST: |
| 403 return ash::user::LOGGED_IN_GUEST; |
| 404 case LoginState::LOGGED_IN_USER_RETAIL_MODE: |
| 405 return ash::user::LOGGED_IN_RETAIL_MODE; |
| 406 case LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT: |
| 407 return ash::user::LOGGED_IN_PUBLIC; |
| 408 case LoginState::LOGGED_IN_USER_LOCALLY_MANAGED: |
| 409 return ash::user::LOGGED_IN_LOCALLY_MANAGED; |
| 410 case LoginState::LOGGED_IN_USER_KIOSK_APP: |
| 411 return ash::user::LOGGED_IN_KIOSK_APP; |
| 412 } |
| 413 NOTREACHED(); |
| 414 return ash::user::LOGGED_IN_NONE; |
| 399 } | 415 } |
| 400 | 416 |
| 401 virtual bool IsOobeCompleted() const OVERRIDE { | 417 virtual bool IsOobeCompleted() const OVERRIDE { |
| 402 return WizardController::IsOobeCompleted(); | 418 return WizardController::IsOobeCompleted(); |
| 403 } | 419 } |
| 404 | 420 |
| 405 virtual void ChangeProfilePicture() OVERRIDE { | 421 virtual void ChangeProfilePicture() OVERRIDE { |
| 406 content::RecordAction( | 422 content::RecordAction( |
| 407 content::UserMetricsAction("OpenChangeProfilePictureDialog")); | 423 content::UserMetricsAction("OpenChangeProfilePictureDialog")); |
| 408 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 424 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1544 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 1529 }; | 1545 }; |
| 1530 | 1546 |
| 1531 } // namespace | 1547 } // namespace |
| 1532 | 1548 |
| 1533 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1549 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1534 return new chromeos::SystemTrayDelegate(); | 1550 return new chromeos::SystemTrayDelegate(); |
| 1535 } | 1551 } |
| 1536 | 1552 |
| 1537 } // namespace chromeos | 1553 } // namespace chromeos |
| OLD | NEW |