| OLD | NEW |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 ->GetUsersAllowedForMultiProfile() | 568 ->GetUsersAllowedForMultiProfile() |
| 569 .size()) { | 569 .size()) { |
| 570 // Don't show dialog if any logged in user in multi-profiles session | 570 // Don't show dialog if any logged in user in multi-profiles session |
| 571 // dismissed it. | 571 // dismissed it. |
| 572 bool show_intro = true; | 572 bool show_intro = true; |
| 573 const user_manager::UserList logged_in_users = | 573 const user_manager::UserList logged_in_users = |
| 574 user_manager::UserManager::Get()->GetLoggedInUsers(); | 574 user_manager::UserManager::Get()->GetLoggedInUsers(); |
| 575 for (user_manager::UserList::const_iterator it = logged_in_users.begin(); | 575 for (user_manager::UserList::const_iterator it = logged_in_users.begin(); |
| 576 it != logged_in_users.end(); | 576 it != logged_in_users.end(); |
| 577 ++it) { | 577 ++it) { |
| 578 show_intro &= !multi_user_util::GetProfileFromUserID( | 578 show_intro &= |
| 579 multi_user_util::GetUserIDFromEmail((*it)->email())) | 579 !multi_user_util::GetProfileFromAccountId((*it)->GetAccountId()) |
| 580 ->GetPrefs() | 580 ->GetPrefs() |
| 581 ->GetBoolean(prefs::kMultiProfileNeverShowIntro); | 581 ->GetBoolean(prefs::kMultiProfileNeverShowIntro); |
| 582 if (!show_intro) | 582 if (!show_intro) |
| 583 break; | 583 break; |
| 584 } | 584 } |
| 585 if (show_intro) { | 585 if (show_intro) { |
| 586 base::Callback<void(bool)> on_accept = | 586 base::Callback<void(bool)> on_accept = |
| 587 base::Bind(&OnAcceptMultiprofilesIntro); | 587 base::Bind(&OnAcceptMultiprofilesIntro); |
| 588 ShowMultiprofilesIntroDialog(on_accept); | 588 ShowMultiprofilesIntroDialog(on_accept); |
| 589 } else { | 589 } else { |
| 590 UserAddingScreen::Get()->Start(); | 590 UserAddingScreen::Get()->Start(); |
| 591 } | 591 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 SetProfile(ProfileManager::GetActiveUserProfile()); | 811 SetProfile(ProfileManager::GetActiveUserProfile()); |
| 812 GetSystemTrayNotifier()->NotifyUserUpdate(); | 812 GetSystemTrayNotifier()->NotifyUserUpdate(); |
| 813 } | 813 } |
| 814 | 814 |
| 815 bool SystemTrayDelegateChromeOS::IsSearchKeyMappedToCapsLock() { | 815 bool SystemTrayDelegateChromeOS::IsSearchKeyMappedToCapsLock() { |
| 816 return search_key_mapped_to_ == input_method::kCapsLockKey; | 816 return search_key_mapped_to_ == input_method::kCapsLockKey; |
| 817 } | 817 } |
| 818 | 818 |
| 819 ash::tray::UserAccountsDelegate* | 819 ash::tray::UserAccountsDelegate* |
| 820 SystemTrayDelegateChromeOS::GetUserAccountsDelegate( | 820 SystemTrayDelegateChromeOS::GetUserAccountsDelegate( |
| 821 const std::string& user_id) { | 821 const AccountId& account_id) { |
| 822 if (!accounts_delegates_.contains(user_id)) { | 822 auto it = accounts_delegates_.find(account_id); |
| 823 const user_manager::User* user = user_manager::UserManager::Get()->FindUser( | 823 if (it == accounts_delegates_.end()) { |
| 824 AccountId::FromUserEmail(user_id)); | 824 const user_manager::User* user = |
| 825 user_manager::UserManager::Get()->FindUser(account_id); |
| 825 Profile* user_profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); | 826 Profile* user_profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
| 826 CHECK(user_profile); | 827 CHECK(user_profile); |
| 827 accounts_delegates_.set( | 828 accounts_delegates_.set( |
| 828 user_id, | 829 account_id, scoped_ptr<ash::tray::UserAccountsDelegate>( |
| 829 scoped_ptr<ash::tray::UserAccountsDelegate>( | 830 new UserAccountsDelegateChromeOS(user_profile))); |
| 830 new UserAccountsDelegateChromeOS(user_profile))); | 831 it = accounts_delegates_.find(account_id); |
| 831 } | 832 } |
| 832 return accounts_delegates_.get(user_id); | 833 return it->second; |
| 833 } | 834 } |
| 834 | 835 |
| 835 void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( | 836 void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( |
| 836 ash::CustodianInfoTrayObserver* observer) { | 837 ash::CustodianInfoTrayObserver* observer) { |
| 837 custodian_info_changed_observers_.AddObserver(observer); | 838 custodian_info_changed_observers_.AddObserver(observer); |
| 838 } | 839 } |
| 839 | 840 |
| 840 void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( | 841 void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( |
| 841 ash::CustodianInfoTrayObserver* observer) { | 842 ash::CustodianInfoTrayObserver* observer) { |
| 842 custodian_info_changed_observers_.RemoveObserver(observer); | 843 custodian_info_changed_observers_.RemoveObserver(observer); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 policy::CloudPolicyStore* store) { | 1247 policy::CloudPolicyStore* store) { |
| 1247 UpdateEnterpriseDomain(); | 1248 UpdateEnterpriseDomain(); |
| 1248 } | 1249 } |
| 1249 | 1250 |
| 1250 void SystemTrayDelegateChromeOS::OnStoreError(policy::CloudPolicyStore* store) { | 1251 void SystemTrayDelegateChromeOS::OnStoreError(policy::CloudPolicyStore* store) { |
| 1251 UpdateEnterpriseDomain(); | 1252 UpdateEnterpriseDomain(); |
| 1252 } | 1253 } |
| 1253 | 1254 |
| 1254 // Overridden from ash::SessionStateObserver | 1255 // Overridden from ash::SessionStateObserver |
| 1255 void SystemTrayDelegateChromeOS::UserAddedToSession( | 1256 void SystemTrayDelegateChromeOS::UserAddedToSession( |
| 1256 const std::string& user_id) { | 1257 const AccountId& /*account_id*/) { |
| 1257 GetSystemTrayNotifier()->NotifyUserAddedToSession(); | 1258 GetSystemTrayNotifier()->NotifyUserAddedToSession(); |
| 1258 } | 1259 } |
| 1259 | 1260 |
| 1260 void SystemTrayDelegateChromeOS::ActiveUserChanged( | 1261 void SystemTrayDelegateChromeOS::ActiveUserChanged( |
| 1261 const std::string& /* user_id */) { | 1262 const AccountId& /* user_id */) {} |
| 1262 } | |
| 1263 | 1263 |
| 1264 // Overridden from chrome::BrowserListObserver. | 1264 // Overridden from chrome::BrowserListObserver. |
| 1265 void SystemTrayDelegateChromeOS::OnBrowserRemoved(Browser* browser) { | 1265 void SystemTrayDelegateChromeOS::OnBrowserRemoved(Browser* browser) { |
| 1266 NotifyIfLastWindowClosed(); | 1266 NotifyIfLastWindowClosed(); |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 // Overridden from extensions::AppWindowRegistry::Observer. | 1269 // Overridden from extensions::AppWindowRegistry::Observer. |
| 1270 void SystemTrayDelegateChromeOS::OnAppWindowRemoved( | 1270 void SystemTrayDelegateChromeOS::OnAppWindowRemoved( |
| 1271 extensions::AppWindow* app_window) { | 1271 extensions::AppWindow* app_window) { |
| 1272 NotifyIfLastWindowClosed(); | 1272 NotifyIfLastWindowClosed(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1327 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1328 << "ENABLE_SUPERVISED_USERS undefined."; | 1328 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1329 return base::string16(); | 1329 return base::string16(); |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1332 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1333 return new SystemTrayDelegateChromeOS(); | 1333 return new SystemTrayDelegateChromeOS(); |
| 1334 } | 1334 } |
| 1335 | 1335 |
| 1336 } // namespace chromeos | 1336 } // namespace chromeos |
| OLD | NEW |