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(); |
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_UNKNOWN: |
386 if (!manager->IsSessionStarted()) | 387 case LoginState::LOGGED_IN_OOBE: |
387 return ash::user::LOGGED_IN_NONE; | 388 case LoginState::LOGGED_IN_NONE: |
388 if (screen_locked_) | 389 return ash::user::LOGGED_IN_NONE; |
389 return ash::user::LOGGED_IN_LOCKED; | 390 case LoginState::LOGGED_IN_LOCKED: |
390 if (manager->IsCurrentUserOwner()) | 391 return ash::user::LOGGED_IN_LOCKED; |
391 return ash::user::LOGGED_IN_OWNER; | 392 case LoginState::LOGGED_IN_USER: |
392 if (manager->IsLoggedInAsGuest()) | 393 return ash::user::LOGGED_IN_USER; |
393 return ash::user::LOGGED_IN_GUEST; | 394 case LoginState::LOGGED_IN_OWNER: |
394 if (manager->IsLoggedInAsDemoUser()) | 395 return ash::user::LOGGED_IN_OWNER; |
395 return ash::user::LOGGED_IN_RETAIL_MODE; | 396 case LoginState::LOGGED_IN_GUEST: |
396 if (manager->IsLoggedInAsPublicAccount()) | 397 return ash::user::LOGGED_IN_GUEST; |
397 return ash::user::LOGGED_IN_PUBLIC; | 398 case LoginState::LOGGED_IN_RETAIL_MODE: |
398 return ash::user::LOGGED_IN_USER; | 399 return ash::user::LOGGED_IN_RETAIL_MODE; |
| 400 case LoginState::LOGGED_IN_KIOSK_APP: |
| 401 return ash::user::LOGGED_IN_KIOSK_APP; |
| 402 case LoginState::LOGGED_IN_PUBLIC: |
| 403 return ash::user::LOGGED_IN_PUBLIC; |
| 404 } |
| 405 NOTREACHED(); |
| 406 return ash::user::LOGGED_IN_NONE; |
399 } | 407 } |
400 | 408 |
401 virtual bool IsOobeCompleted() const OVERRIDE { | 409 virtual bool IsOobeCompleted() const OVERRIDE { |
402 return WizardController::IsOobeCompleted(); | 410 return WizardController::IsOobeCompleted(); |
403 } | 411 } |
404 | 412 |
405 virtual void ChangeProfilePicture() OVERRIDE { | 413 virtual void ChangeProfilePicture() OVERRIDE { |
406 content::RecordAction( | 414 content::RecordAction( |
407 content::UserMetricsAction("OpenChangeProfilePictureDialog")); | 415 content::UserMetricsAction("OpenChangeProfilePictureDialog")); |
408 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 416 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1537 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1530 }; | 1538 }; |
1531 | 1539 |
1532 } // namespace | 1540 } // namespace |
1533 | 1541 |
1534 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1542 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1535 return new chromeos::SystemTrayDelegate(); | 1543 return new chromeos::SystemTrayDelegate(); |
1536 } | 1544 } |
1537 | 1545 |
1538 } // namespace chromeos | 1546 } // namespace chromeos |
OLD | NEW |