Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 2041233005: Moves ash::user::LoginStatus to ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/ash/system_tray_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime, 139 void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime,
140 const input_method::InputMethodUtil& util, 140 const input_method::InputMethodUtil& util,
141 ash::IMEInfo* info) { 141 ash::IMEInfo* info) {
142 info->id = ime.id(); 142 info->id = ime.id();
143 info->name = util.GetInputMethodLongName(ime); 143 info->name = util.GetInputMethodLongName(ime);
144 info->medium_name = util.GetInputMethodMediumName(ime); 144 info->medium_name = util.GetInputMethodMediumName(ime);
145 info->short_name = util.GetInputMethodShortName(ime); 145 info->short_name = util.GetInputMethodShortName(ime);
146 info->third_party = extension_ime_util::IsExtensionIME(ime.id()); 146 info->third_party = extension_ime_util::IsExtensionIME(ime.id());
147 } 147 }
148 148
149 gfx::NativeWindow GetNativeWindowByStatus(ash::user::LoginStatus login_status, 149 gfx::NativeWindow GetNativeWindowByStatus(ash::LoginStatus login_status,
150 bool session_started) { 150 bool session_started) {
151 bool isUserAddingRunning = ash::Shell::GetInstance() 151 bool isUserAddingRunning = ash::Shell::GetInstance()
152 ->session_state_delegate() 152 ->session_state_delegate()
153 ->IsInSecondaryLoginScreen(); 153 ->IsInSecondaryLoginScreen();
154 154
155 int container_id = 155 int container_id =
156 (!session_started || login_status == ash::user::LOGGED_IN_NONE || 156 (!session_started || login_status == ash::LoginStatus::NOT_LOGGED_IN ||
157 login_status == ash::user::LOGGED_IN_LOCKED || isUserAddingRunning) 157 login_status == ash::LoginStatus::LOCKED || isUserAddingRunning)
158 ? ash::kShellWindowId_LockSystemModalContainer 158 ? ash::kShellWindowId_LockSystemModalContainer
159 : ash::kShellWindowId_SystemModalContainer; 159 : ash::kShellWindowId_SystemModalContainer;
160 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), 160 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
161 container_id); 161 container_id);
162 } 162 }
163 163
164 void BluetoothSetDiscoveringError() { 164 void BluetoothSetDiscoveringError() {
165 LOG(ERROR) << "BluetoothSetDiscovering failed."; 165 LOG(ERROR) << "BluetoothSetDiscovering failed.";
166 } 166 }
167 167
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 weak_ptr_factory_(this) { 204 weak_ptr_factory_(this) {
205 // Register notifications on construction so that events such as 205 // Register notifications on construction so that events such as
206 // PROFILE_CREATED do not get missed if they happen before Initialize(). 206 // PROFILE_CREATED do not get missed if they happen before Initialize().
207 registrar_.reset(new content::NotificationRegistrar); 207 registrar_.reset(new content::NotificationRegistrar);
208 registrar_->Add(this, 208 registrar_->Add(this,
209 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 209 chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
210 content::NotificationService::AllSources()); 210 content::NotificationService::AllSources());
211 registrar_->Add(this, 211 registrar_->Add(this,
212 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, 212 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
213 content::NotificationService::AllSources()); 213 content::NotificationService::AllSources());
214 if (GetUserLoginStatus() == ash::user::LOGGED_IN_NONE) { 214 if (GetUserLoginStatus() == ash::LoginStatus::NOT_LOGGED_IN) {
215 registrar_->Add(this, 215 registrar_->Add(this,
216 chrome::NOTIFICATION_SESSION_STARTED, 216 chrome::NOTIFICATION_SESSION_STARTED,
217 content::NotificationService::AllSources()); 217 content::NotificationService::AllSources());
218 } 218 }
219 registrar_->Add(this, 219 registrar_->Add(this,
220 chrome::NOTIFICATION_PROFILE_CREATED, 220 chrome::NOTIFICATION_PROFILE_CREATED,
221 content::NotificationService::AllSources()); 221 content::NotificationService::AllSources());
222 registrar_->Add(this, 222 registrar_->Add(this,
223 chrome::NOTIFICATION_PROFILE_DESTROYED, 223 chrome::NOTIFICATION_PROFILE_DESTROYED,
224 content::NotificationService::AllSources()); 224 content::NotificationService::AllSources());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 user_manager::UserManager::Get()->RemoveSessionStateObserver(this); 328 user_manager::UserManager::Get()->RemoveSessionStateObserver(this);
329 } 329 }
330 330
331 // Overridden from ash::SystemTrayDelegate: 331 // Overridden from ash::SystemTrayDelegate:
332 bool SystemTrayDelegateChromeOS::GetTrayVisibilityOnStartup() { 332 bool SystemTrayDelegateChromeOS::GetTrayVisibilityOnStartup() {
333 // In case of OOBE / sign in screen tray will be shown later. 333 // In case of OOBE / sign in screen tray will be shown later.
334 return LoginState::Get()->IsUserLoggedIn(); 334 return LoginState::Get()->IsUserLoggedIn();
335 } 335 }
336 336
337 ash::user::LoginStatus SystemTrayDelegateChromeOS::GetUserLoginStatus() const { 337 ash::LoginStatus SystemTrayDelegateChromeOS::GetUserLoginStatus() const {
338 // All non-logged in ChromeOS specific LOGGED_IN states map to the same 338 // All non-logged in ChromeOS specific LOGGED_IN states map to the same
339 // Ash specific LOGGED_IN state. 339 // Ash specific LOGGED_IN state.
James Cook 2016/06/08 00:14:06 nit: LOGGED_IN -> LoginStatus. Or just delete the
sky 2016/06/08 04:01:58 Done.
340 if (!LoginState::Get()->IsUserLoggedIn()) 340 if (!LoginState::Get()->IsUserLoggedIn())
341 return ash::user::LOGGED_IN_NONE; 341 return ash::LoginStatus::NOT_LOGGED_IN;
342 342
343 if (screen_locked_) 343 if (screen_locked_)
344 return ash::user::LOGGED_IN_LOCKED; 344 return ash::LoginStatus::LOCKED;
345 345
346 LoginState::LoggedInUserType user_type = 346 LoginState::LoggedInUserType user_type =
347 LoginState::Get()->GetLoggedInUserType(); 347 LoginState::Get()->GetLoggedInUserType();
348 switch (user_type) { 348 switch (user_type) {
349 case LoginState::LOGGED_IN_USER_NONE: 349 case LoginState::LOGGED_IN_USER_NONE:
350 return ash::user::LOGGED_IN_NONE; 350 return ash::LoginStatus::NOT_LOGGED_IN;
351 case LoginState::LOGGED_IN_USER_REGULAR: 351 case LoginState::LOGGED_IN_USER_REGULAR:
352 return ash::user::LOGGED_IN_USER; 352 return ash::LoginStatus::USER;
353 case LoginState::LOGGED_IN_USER_OWNER: 353 case LoginState::LOGGED_IN_USER_OWNER:
354 return ash::user::LOGGED_IN_OWNER; 354 return ash::LoginStatus::OWNER;
355 case LoginState::LOGGED_IN_USER_GUEST: 355 case LoginState::LOGGED_IN_USER_GUEST:
356 return ash::user::LOGGED_IN_GUEST; 356 return ash::LoginStatus::GUEST;
357 case LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT: 357 case LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT:
358 return ash::user::LOGGED_IN_PUBLIC; 358 return ash::LoginStatus::PUBLIC;
359 case LoginState::LOGGED_IN_USER_SUPERVISED: 359 case LoginState::LOGGED_IN_USER_SUPERVISED:
360 return ash::user::LOGGED_IN_SUPERVISED; 360 return ash::LoginStatus::SUPERVISED;
361 case LoginState::LOGGED_IN_USER_KIOSK_APP: 361 case LoginState::LOGGED_IN_USER_KIOSK_APP:
362 return ash::user::LOGGED_IN_KIOSK_APP; 362 return ash::LoginStatus::KIOSK_APP;
363 } 363 }
364 NOTREACHED(); 364 NOTREACHED();
365 return ash::user::LOGGED_IN_NONE; 365 return ash::LoginStatus::NOT_LOGGED_IN;
366 } 366 }
367 367
368 void SystemTrayDelegateChromeOS::ChangeProfilePicture() { 368 void SystemTrayDelegateChromeOS::ChangeProfilePicture() {
369 content::RecordAction( 369 content::RecordAction(
370 base::UserMetricsAction("OpenChangeProfilePictureDialog")); 370 base::UserMetricsAction("OpenChangeProfilePictureDialog"));
371 ShowSettingsSubPageForActiveUser(chrome::kChangeProfilePictureSubPage); 371 ShowSettingsSubPageForActiveUser(chrome::kChangeProfilePictureSubPage);
372 } 372 }
373 373
374 std::string SystemTrayDelegateChromeOS::GetEnterpriseDomain() const { 374 std::string SystemTrayDelegateChromeOS::GetEnterpriseDomain() const {
375 return enterprise_domain_; 375 return enterprise_domain_;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 ProfileManager::GetActiveUserProfile()); 533 ProfileManager::GetActiveUserProfile());
534 chrome::ShowPolicy(displayer.browser()); 534 chrome::ShowPolicy(displayer.browser());
535 } 535 }
536 536
537 void SystemTrayDelegateChromeOS::ShowSupervisedUserInfo() { 537 void SystemTrayDelegateChromeOS::ShowSupervisedUserInfo() {
538 // TODO(antrim): find out what should we show in this case. 538 // TODO(antrim): find out what should we show in this case.
539 // http://crbug.com/229762 539 // http://crbug.com/229762
540 } 540 }
541 541
542 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { 542 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() {
543 ash::user::LoginStatus status = GetUserLoginStatus(); 543 ash::LoginStatus status = GetUserLoginStatus();
544 bool userAddingRunning = ash::Shell::GetInstance() 544 bool userAddingRunning = ash::Shell::GetInstance()
545 ->session_state_delegate() 545 ->session_state_delegate()
546 ->IsInSecondaryLoginScreen(); 546 ->IsInSecondaryLoginScreen();
547 547
548 if (status == ash::user::LOGGED_IN_NONE || 548 if (status == ash::LoginStatus::NOT_LOGGED_IN ||
549 status == ash::user::LOGGED_IN_LOCKED || userAddingRunning) { 549 status == ash::LoginStatus::LOCKED || userAddingRunning) {
550 scoped_refptr<chromeos::HelpAppLauncher> help_app( 550 scoped_refptr<chromeos::HelpAppLauncher> help_app(
551 new chromeos::HelpAppLauncher(GetNativeWindow())); 551 new chromeos::HelpAppLauncher(GetNativeWindow()));
552 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); 552 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE);
553 } else { 553 } else {
554 chrome::ScopedTabbedBrowserDisplayer displayer( 554 chrome::ScopedTabbedBrowserDisplayer displayer(
555 ProfileManager::GetActiveUserProfile()); 555 ProfileManager::GetActiveUserProfile());
556 chrome::ShowSingletonTab(displayer.browser(), 556 chrome::ShowSingletonTab(displayer.browser(),
557 GURL(chrome::kLearnMoreEnterpriseURL)); 557 GURL(chrome::kLearnMoreEnterpriseURL));
558 } 558 }
559 } 559 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { 770 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() {
771 return bluetooth_adapter_->IsPowered(); 771 return bluetooth_adapter_->IsPowered();
772 } 772 }
773 773
774 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { 774 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() {
775 return (bluetooth_discovery_session_.get() && 775 return (bluetooth_discovery_session_.get() &&
776 bluetooth_discovery_session_->IsActive()); 776 bluetooth_discovery_session_->IsActive());
777 } 777 }
778 778
779 void SystemTrayDelegateChromeOS::ChangeProxySettings() { 779 void SystemTrayDelegateChromeOS::ChangeProxySettings() {
780 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE); 780 CHECK(GetUserLoginStatus() == ash::LoginStatus::NOT_LOGGED_IN);
781 LoginDisplayHost::default_host()->OpenProxySettings(); 781 LoginDisplayHost::default_host()->OpenProxySettings();
782 } 782 }
783 783
784 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() { 784 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() {
785 if (!cast_config_delegate_) 785 if (!cast_config_delegate_)
786 cast_config_delegate_ = CreateCastConfigDelegate(); 786 cast_config_delegate_ = CreateCastConfigDelegate();
787 return cast_config_delegate_.get(); 787 return cast_config_delegate_.get();
788 } 788 }
789 789
790 ash::NetworkingConfigDelegate* 790 ash::NetworkingConfigDelegate*
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 switch (type) { 1077 switch (type) {
1078 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { 1078 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: {
1079 ash::UpdateInfo info; 1079 ash::UpdateInfo info;
1080 GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info); 1080 GetUpdateInfo(content::Source<UpgradeDetector>(source).ptr(), &info);
1081 GetSystemTrayNotifier()->NotifyUpdateRecommended(info); 1081 GetSystemTrayNotifier()->NotifyUpdateRecommended(info);
1082 break; 1082 break;
1083 } 1083 }
1084 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { 1084 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: {
1085 // This notification is also sent on login screen when user avatar 1085 // This notification is also sent on login screen when user avatar
1086 // is loaded from file. 1086 // is loaded from file.
1087 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { 1087 if (GetUserLoginStatus() != ash::LoginStatus::NOT_LOGGED_IN) {
1088 GetSystemTrayNotifier()->NotifyUserUpdate(); 1088 GetSystemTrayNotifier()->NotifyUserUpdate();
1089 } 1089 }
1090 break; 1090 break;
1091 } 1091 }
1092 case chrome::NOTIFICATION_PROFILE_CREATED: { 1092 case chrome::NOTIFICATION_PROFILE_CREATED: {
1093 SetProfile(content::Source<Profile>(source).ptr()); 1093 SetProfile(content::Source<Profile>(source).ptr());
1094 registrar_->Remove(this, 1094 registrar_->Remove(this,
1095 chrome::NOTIFICATION_PROFILE_CREATED, 1095 chrome::NOTIFICATION_PROFILE_CREATED,
1096 content::NotificationService::AllSources()); 1096 content::NotificationService::AllSources());
1097 break; 1097 break;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 1331 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1332 << "ENABLE_SUPERVISED_USERS undefined."; 1332 << "ENABLE_SUPERVISED_USERS undefined.";
1333 return base::string16(); 1333 return base::string16();
1334 } 1334 }
1335 1335
1336 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1336 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1337 return new SystemTrayDelegateChromeOS(); 1337 return new SystemTrayDelegateChromeOS();
1338 } 1338 }
1339 1339
1340 } // namespace chromeos 1340 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698