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

Side by Side Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 14756019: Adding new user menu section to the SystemTrayMenu & refactoring of user access (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 if (policy_manager) 385 if (policy_manager)
386 policy_manager->core()->store()->RemoveObserver(this); 386 policy_manager->core()->store()->RemoveObserver(this);
387 } 387 }
388 388
389 // Overridden from ash::SystemTrayDelegate: 389 // Overridden from ash::SystemTrayDelegate:
390 virtual bool GetTrayVisibilityOnStartup() OVERRIDE { 390 virtual bool GetTrayVisibilityOnStartup() OVERRIDE {
391 // In case of OOBE / sign in screen tray will be shown later. 391 // In case of OOBE / sign in screen tray will be shown later.
392 return LoginState::Get()->IsUserLoggedIn(); 392 return LoginState::Get()->IsUserLoggedIn();
393 } 393 }
394 394
395 virtual const string16 GetUserDisplayName() const OVERRIDE {
396 return UserManager::Get()->GetActiveUser()->GetDisplayName();
397 }
398
399 virtual const std::string GetUserEmail() const OVERRIDE {
400 return UserManager::Get()->GetActiveUser()->display_email();
401 }
402
403 virtual const gfx::ImageSkia& GetUserImage() const OVERRIDE {
404 return UserManager::Get()->GetActiveUser()->image();
405 }
406
407 virtual ash::user::LoginStatus GetUserLoginStatus() const OVERRIDE { 395 virtual ash::user::LoginStatus GetUserLoginStatus() const OVERRIDE {
408 // Map ChromeOS specific LOGGED_IN states to Ash LOGGED_IN states. 396 // Map ChromeOS specific LOGGED_IN states to Ash LOGGED_IN states.
409 LoginState::LoggedInState state = LoginState::Get()->GetLoggedInState(); 397 LoginState::LoggedInState state = LoginState::Get()->GetLoggedInState();
410 if (state == LoginState::LOGGED_IN_OOBE || 398 if (state == LoginState::LOGGED_IN_OOBE ||
411 state == LoginState::LOGGED_IN_NONE) { 399 state == LoginState::LOGGED_IN_NONE) {
412 return ash::user::LOGGED_IN_NONE; 400 return ash::user::LOGGED_IN_NONE;
413 } 401 }
414 if (screen_locked_) 402 if (screen_locked_)
415 return ash::user::LOGGED_IN_LOCKED; 403 return ash::user::LOGGED_IN_LOCKED;
416 404
(...skipping 18 matching lines...) Expand all
435 return ash::user::LOGGED_IN_KIOSK_APP; 423 return ash::user::LOGGED_IN_KIOSK_APP;
436 } 424 }
437 NOTREACHED(); 425 NOTREACHED();
438 return ash::user::LOGGED_IN_NONE; 426 return ash::user::LOGGED_IN_NONE;
439 } 427 }
440 428
441 virtual bool IsOobeCompleted() const OVERRIDE { 429 virtual bool IsOobeCompleted() const OVERRIDE {
442 return StartupUtils::IsOobeCompleted(); 430 return StartupUtils::IsOobeCompleted();
443 } 431 }
444 432
445 virtual void GetLoggedInUsers(ash::UserEmailList* users) OVERRIDE {
446 const UserList& logged_in_users = UserManager::Get()->GetLoggedInUsers();
447 for (UserList::const_iterator it = logged_in_users.begin();
448 it != logged_in_users.end(); ++it) {
449 const User* user = (*it);
450 users->push_back(user->email());
451 }
452 }
453
454 virtual void SwitchActiveUser(const std::string& email) OVERRIDE {
455 UserManager::Get()->SwitchActiveUser(email);
456 }
457
458 virtual void ChangeProfilePicture() OVERRIDE { 433 virtual void ChangeProfilePicture() OVERRIDE {
459 content::RecordAction( 434 content::RecordAction(
460 content::UserMetricsAction("OpenChangeProfilePictureDialog")); 435 content::UserMetricsAction("OpenChangeProfilePictureDialog"));
461 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), 436 chrome::ShowSettingsSubPage(GetAppropriateBrowser(),
462 chrome::kChangeProfilePictureSubPage); 437 chrome::kChangeProfilePictureSubPage);
463 } 438 }
464 439
465 virtual const std::string GetEnterpriseDomain() const OVERRIDE { 440 virtual const std::string GetEnterpriseDomain() const OVERRIDE {
466 return enterprise_domain_; 441 return enterprise_domain_;
467 } 442 }
468 443
469 virtual const string16 GetEnterpriseMessage() const OVERRIDE { 444 virtual const string16 GetEnterpriseMessage() const OVERRIDE {
470 if (GetEnterpriseDomain().empty()) 445 if (GetEnterpriseDomain().empty())
471 return string16(); 446 return string16();
472 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE, 447 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE,
473 UTF8ToUTF16(GetEnterpriseDomain())); 448 UTF8ToUTF16(GetEnterpriseDomain()));
474 } 449 }
475 450
476 virtual const std::string GetLocallyManagedUserManager() const OVERRIDE { 451 virtual const std::string GetLocallyManagedUserManager() const OVERRIDE {
477 if (GetUserLoginStatus() != ash::user::LOGGED_IN_LOCALLY_MANAGED) 452 if (GetUserLoginStatus() != ash::user::LOGGED_IN_LOCALLY_MANAGED)
478 return std::string(); 453 return std::string();
479 return UserManager::Get()->GetManagerForManagedUser(GetUserEmail()); 454 return UserManager::Get()->GetManagerForManagedUser(
455 chromeos::UserManager::Get()->GetActiveUser()->display_email());
480 } 456 }
481 457
482 virtual const string16 GetLocallyManagedUserMessage() const OVERRIDE { 458 virtual const string16 GetLocallyManagedUserMessage() const OVERRIDE {
483 if (GetUserLoginStatus() != ash::user::LOGGED_IN_LOCALLY_MANAGED) 459 if (GetUserLoginStatus() != ash::user::LOGGED_IN_LOCALLY_MANAGED)
484 return string16(); 460 return string16();
485 return l10n_util::GetStringFUTF16(IDS_USER_IS_LOCALLY_MANAGED_BY_NOTICE, 461 return l10n_util::GetStringFUTF16(IDS_USER_IS_LOCALLY_MANAGED_BY_NOTICE,
486 UTF8ToUTF16( 462 UTF8ToUTF16(
487 GetLocallyManagedUserManager())); 463 GetLocallyManagedUserManager()));
488 } 464 }
489 465
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); 1580 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate);
1605 }; 1581 };
1606 1582
1607 } // namespace 1583 } // namespace
1608 1584
1609 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1585 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1610 return new chromeos::SystemTrayDelegate(); 1586 return new chromeos::SystemTrayDelegate();
1611 } 1587 }
1612 1588
1613 } // namespace chromeos 1589 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698