| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 policy_manager->core()->store()->RemoveObserver(this); | 462 policy_manager->core()->store()->RemoveObserver(this); |
| 463 } | 463 } |
| 464 | 464 |
| 465 // Overridden from ash::SystemTrayDelegate: | 465 // Overridden from ash::SystemTrayDelegate: |
| 466 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { | 466 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { |
| 467 // In case of OOBE / sign in screen tray will be shown later. | 467 // In case of OOBE / sign in screen tray will be shown later. |
| 468 return LoginState::Get()->IsUserLoggedIn(); | 468 return LoginState::Get()->IsUserLoggedIn(); |
| 469 } | 469 } |
| 470 | 470 |
| 471 virtual ash::user::LoginStatus GetUserLoginStatus() const OVERRIDE { | 471 virtual ash::user::LoginStatus GetUserLoginStatus() const OVERRIDE { |
| 472 // Map ChromeOS specific LOGGED_IN states to Ash LOGGED_IN states. | 472 // All non-logged in ChromeOS specific LOGGED_IN states map to the same |
| 473 LoginState::LoggedInState state = LoginState::Get()->GetLoggedInState(); | 473 // Ash specific LOGGED_IN state. |
| 474 if (state == LoginState::LOGGED_IN_OOBE || | 474 if (!LoginState::Get()->IsUserLoggedIn()) |
| 475 state == LoginState::LOGGED_IN_NONE) { | |
| 476 return ash::user::LOGGED_IN_NONE; | 475 return ash::user::LOGGED_IN_NONE; |
| 477 } | 476 |
| 478 if (screen_locked_) | 477 if (screen_locked_) |
| 479 return ash::user::LOGGED_IN_LOCKED; | 478 return ash::user::LOGGED_IN_LOCKED; |
| 480 | 479 |
| 481 LoginState::LoggedInUserType user_type = | 480 LoginState::LoggedInUserType user_type = |
| 482 LoginState::Get()->GetLoggedInUserType(); | 481 LoginState::Get()->GetLoggedInUserType(); |
| 483 switch (user_type) { | 482 switch (user_type) { |
| 484 case LoginState::LOGGED_IN_USER_NONE: | 483 case LoginState::LOGGED_IN_USER_NONE: |
| 485 return ash::user::LOGGED_IN_NONE; | 484 return ash::user::LOGGED_IN_NONE; |
| 486 case LoginState::LOGGED_IN_USER_REGULAR: | 485 case LoginState::LOGGED_IN_USER_REGULAR: |
| 487 return ash::user::LOGGED_IN_USER; | 486 return ash::user::LOGGED_IN_USER; |
| 488 case LoginState::LOGGED_IN_USER_OWNER: | 487 case LoginState::LOGGED_IN_USER_OWNER: |
| 489 return ash::user::LOGGED_IN_OWNER; | 488 return ash::user::LOGGED_IN_OWNER; |
| 490 case LoginState::LOGGED_IN_USER_GUEST: | 489 case LoginState::LOGGED_IN_USER_GUEST: |
| 491 return ash::user::LOGGED_IN_GUEST; | 490 return ash::user::LOGGED_IN_GUEST; |
| 492 case LoginState::LOGGED_IN_USER_RETAIL_MODE: | 491 case LoginState::LOGGED_IN_USER_RETAIL_MODE: |
| 493 return ash::user::LOGGED_IN_RETAIL_MODE; | 492 return ash::user::LOGGED_IN_RETAIL_MODE; |
| 494 case LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT: | 493 case LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT: |
| 495 return ash::user::LOGGED_IN_PUBLIC; | 494 return ash::user::LOGGED_IN_PUBLIC; |
| 496 case LoginState::LOGGED_IN_USER_LOCALLY_MANAGED: | 495 case LoginState::LOGGED_IN_USER_LOCALLY_MANAGED: |
| 497 return ash::user::LOGGED_IN_LOCALLY_MANAGED; | 496 return ash::user::LOGGED_IN_LOCALLY_MANAGED; |
| 498 case LoginState::LOGGED_IN_USER_KIOSK_APP: | 497 case LoginState::LOGGED_IN_USER_KIOSK_APP: |
| 499 return ash::user::LOGGED_IN_KIOSK_APP; | 498 return ash::user::LOGGED_IN_KIOSK_APP; |
| 500 } | 499 } |
| 501 NOTREACHED(); | 500 NOTREACHED(); |
| 502 return ash::user::LOGGED_IN_NONE; | 501 return ash::user::LOGGED_IN_NONE; |
| 503 } | 502 } |
| 504 | 503 |
| 505 virtual bool IsOobeCompleted() const OVERRIDE { | 504 virtual bool IsOobeCompleted() const OVERRIDE { |
| 506 if (!base::chromeos::IsRunningOnChromeOS() && | 505 if (!base::chromeos::IsRunningOnChromeOS() && |
| 507 LoginState::Get()->GetLoggedInState() == LoginState::LOGGED_IN_ACTIVE) | 506 LoginState::Get()->IsUserLoggedIn()) |
| 508 return true; | 507 return true; |
| 509 return StartupUtils::IsOobeCompleted(); | 508 return StartupUtils::IsOobeCompleted(); |
| 510 } | 509 } |
| 511 | 510 |
| 512 virtual void ChangeProfilePicture() OVERRIDE { | 511 virtual void ChangeProfilePicture() OVERRIDE { |
| 513 content::RecordAction( | 512 content::RecordAction( |
| 514 content::UserMetricsAction("OpenChangeProfilePictureDialog")); | 513 content::UserMetricsAction("OpenChangeProfilePictureDialog")); |
| 515 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 514 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
| 516 chrome::kChangeProfilePictureSubPage); | 515 chrome::kChangeProfilePictureSubPage); |
| 517 } | 516 } |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 kSessionLengthLimitMinMs), | 1072 kSessionLengthLimitMinMs), |
| 1074 kSessionLengthLimitMaxMs)); | 1073 kSessionLengthLimitMaxMs)); |
| 1075 } else { | 1074 } else { |
| 1076 have_session_length_limit_ = false; | 1075 have_session_length_limit_ = false; |
| 1077 session_length_limit_ = base::TimeDelta(); | 1076 session_length_limit_ = base::TimeDelta(); |
| 1078 } | 1077 } |
| 1079 GetSystemTrayNotifier()->NotifySessionLengthLimitChanged(); | 1078 GetSystemTrayNotifier()->NotifySessionLengthLimitChanged(); |
| 1080 } | 1079 } |
| 1081 | 1080 |
| 1082 // LoginState::Observer overrides. | 1081 // LoginState::Observer overrides. |
| 1083 virtual void LoggedInStateChanged( | 1082 virtual void LoggedInStateChanged() OVERRIDE { |
| 1084 chromeos::LoginState::LoggedInState state) OVERRIDE { | |
| 1085 UpdateClockType(); | 1083 UpdateClockType(); |
| 1086 } | 1084 } |
| 1087 | 1085 |
| 1088 // Overridden from PowerManagerClient::Observer. | 1086 // Overridden from PowerManagerClient::Observer. |
| 1089 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE { | 1087 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE { |
| 1090 double leveld = static_cast<double>(level); | 1088 double leveld = static_cast<double>(level); |
| 1091 GetSystemTrayNotifier()->NotifyBrightnessChanged(leveld, user_initiated); | 1089 GetSystemTrayNotifier()->NotifyBrightnessChanged(leveld, user_initiated); |
| 1092 } | 1090 } |
| 1093 | 1091 |
| 1094 // Overridden from PowerManagerClient::Observer: | 1092 // Overridden from PowerManagerClient::Observer: |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1335 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 1338 }; | 1336 }; |
| 1339 | 1337 |
| 1340 } // namespace | 1338 } // namespace |
| 1341 | 1339 |
| 1342 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1340 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1343 return new chromeos::SystemTrayDelegate(); | 1341 return new chromeos::SystemTrayDelegate(); |
| 1344 } | 1342 } |
| 1345 | 1343 |
| 1346 } // namespace chromeos | 1344 } // namespace chromeos |
| OLD | NEW |