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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 policy_manager->core()->store()->RemoveObserver(this); | 455 policy_manager->core()->store()->RemoveObserver(this); |
456 } | 456 } |
457 | 457 |
458 // Overridden from ash::SystemTrayDelegate: | 458 // Overridden from ash::SystemTrayDelegate: |
459 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { | 459 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { |
460 // In case of OOBE / sign in screen tray will be shown later. | 460 // In case of OOBE / sign in screen tray will be shown later. |
461 return LoginState::Get()->IsUserLoggedIn(); | 461 return LoginState::Get()->IsUserLoggedIn(); |
462 } | 462 } |
463 | 463 |
464 virtual ash::user::LoginStatus GetUserLoginStatus() const OVERRIDE { | 464 virtual ash::user::LoginStatus GetUserLoginStatus() const OVERRIDE { |
465 // Map ChromeOS specific LOGGED_IN states to Ash LOGGED_IN states. | 465 // All non-logged in ChromeOS specific LOGGED_IN states map to the same |
466 LoginState::LoggedInState state = LoginState::Get()->GetLoggedInState(); | 466 // Ash specific LOGGED_IN state. |
467 if (state == LoginState::LOGGED_IN_OOBE || | 467 if (!LoginState::Get()->IsUserLoggedIn()) |
468 state == LoginState::LOGGED_IN_NONE) { | |
469 return ash::user::LOGGED_IN_NONE; | 468 return ash::user::LOGGED_IN_NONE; |
470 } | 469 |
471 if (screen_locked_) | 470 if (screen_locked_) |
472 return ash::user::LOGGED_IN_LOCKED; | 471 return ash::user::LOGGED_IN_LOCKED; |
473 | 472 |
474 LoginState::LoggedInUserType user_type = | 473 LoginState::LoggedInUserType user_type = |
475 LoginState::Get()->GetLoggedInUserType(); | 474 LoginState::Get()->GetLoggedInUserType(); |
476 switch (user_type) { | 475 switch (user_type) { |
477 case LoginState::LOGGED_IN_USER_NONE: | 476 case LoginState::LOGGED_IN_USER_NONE: |
478 return ash::user::LOGGED_IN_NONE; | 477 return ash::user::LOGGED_IN_NONE; |
479 case LoginState::LOGGED_IN_USER_REGULAR: | 478 case LoginState::LOGGED_IN_USER_REGULAR: |
480 return ash::user::LOGGED_IN_USER; | 479 return ash::user::LOGGED_IN_USER; |
481 case LoginState::LOGGED_IN_USER_OWNER: | 480 case LoginState::LOGGED_IN_USER_OWNER: |
482 return ash::user::LOGGED_IN_OWNER; | 481 return ash::user::LOGGED_IN_OWNER; |
483 case LoginState::LOGGED_IN_USER_GUEST: | 482 case LoginState::LOGGED_IN_USER_GUEST: |
484 return ash::user::LOGGED_IN_GUEST; | 483 return ash::user::LOGGED_IN_GUEST; |
485 case LoginState::LOGGED_IN_USER_RETAIL_MODE: | 484 case LoginState::LOGGED_IN_USER_RETAIL_MODE: |
486 return ash::user::LOGGED_IN_RETAIL_MODE; | 485 return ash::user::LOGGED_IN_RETAIL_MODE; |
487 case LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT: | 486 case LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT: |
488 return ash::user::LOGGED_IN_PUBLIC; | 487 return ash::user::LOGGED_IN_PUBLIC; |
489 case LoginState::LOGGED_IN_USER_LOCALLY_MANAGED: | 488 case LoginState::LOGGED_IN_USER_LOCALLY_MANAGED: |
490 return ash::user::LOGGED_IN_LOCALLY_MANAGED; | 489 return ash::user::LOGGED_IN_LOCALLY_MANAGED; |
491 case LoginState::LOGGED_IN_USER_KIOSK_APP: | 490 case LoginState::LOGGED_IN_USER_KIOSK_APP: |
492 return ash::user::LOGGED_IN_KIOSK_APP; | 491 return ash::user::LOGGED_IN_KIOSK_APP; |
493 } | 492 } |
494 NOTREACHED(); | 493 NOTREACHED(); |
495 return ash::user::LOGGED_IN_NONE; | 494 return ash::user::LOGGED_IN_NONE; |
496 } | 495 } |
497 | 496 |
498 virtual bool IsOobeCompleted() const OVERRIDE { | 497 virtual bool IsOobeCompleted() const OVERRIDE { |
499 if (!base::chromeos::IsRunningOnChromeOS() && | 498 if (!base::chromeos::IsRunningOnChromeOS() && |
500 LoginState::Get()->GetLoggedInState() == LoginState::LOGGED_IN_ACTIVE) | 499 LoginState::Get()->IsUserLoggedIn()) |
501 return true; | 500 return true; |
502 return StartupUtils::IsOobeCompleted(); | 501 return StartupUtils::IsOobeCompleted(); |
503 } | 502 } |
504 | 503 |
505 virtual void ChangeProfilePicture() OVERRIDE { | 504 virtual void ChangeProfilePicture() OVERRIDE { |
506 content::RecordAction( | 505 content::RecordAction( |
507 content::UserMetricsAction("OpenChangeProfilePictureDialog")); | 506 content::UserMetricsAction("OpenChangeProfilePictureDialog")); |
508 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 507 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
509 chrome::kChangeProfilePictureSubPage); | 508 chrome::kChangeProfilePictureSubPage); |
510 } | 509 } |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1324 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1326 }; | 1325 }; |
1327 | 1326 |
1328 } // namespace | 1327 } // namespace |
1329 | 1328 |
1330 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1329 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1331 return new chromeos::SystemTrayDelegate(); | 1330 return new chromeos::SystemTrayDelegate(); |
1332 } | 1331 } |
1333 | 1332 |
1334 } // namespace chromeos | 1333 } // namespace chromeos |
OLD | NEW |