| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 #include "chrome/common/url_constants.h" | 92 #include "chrome/common/url_constants.h" |
| 93 #include "chrome/grit/generated_resources.h" | 93 #include "chrome/grit/generated_resources.h" |
| 94 #include "chrome/grit/locale_settings.h" | 94 #include "chrome/grit/locale_settings.h" |
| 95 #include "chromeos/dbus/dbus_thread_manager.h" | 95 #include "chromeos/dbus/dbus_thread_manager.h" |
| 96 #include "chromeos/dbus/session_manager_client.h" | 96 #include "chromeos/dbus/session_manager_client.h" |
| 97 #include "chromeos/login/login_state.h" | 97 #include "chromeos/login/login_state.h" |
| 98 #include "chromeos/network/portal_detector/network_portal_detector.h" | 98 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 99 #include "components/google/core/browser/google_util.h" | 99 #include "components/google/core/browser/google_util.h" |
| 100 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 100 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 101 #include "components/user_manager/user.h" | 101 #include "components/user_manager/user.h" |
| 102 #include "components/user_manager/user_id.h" |
| 102 #include "components/user_manager/user_manager.h" | 103 #include "components/user_manager/user_manager.h" |
| 103 #include "components/user_manager/user_type.h" | 104 #include "components/user_manager/user_type.h" |
| 104 #include "content/public/browser/notification_observer.h" | 105 #include "content/public/browser/notification_observer.h" |
| 105 #include "content/public/browser/notification_service.h" | 106 #include "content/public/browser/notification_service.h" |
| 106 #include "content/public/browser/user_metrics.h" | 107 #include "content/public/browser/user_metrics.h" |
| 107 #include "content/public/browser/web_contents.h" | 108 #include "content/public/browser/web_contents.h" |
| 108 #include "device/bluetooth/bluetooth_adapter.h" | 109 #include "device/bluetooth/bluetooth_adapter.h" |
| 109 #include "device/bluetooth/bluetooth_adapter_factory.h" | 110 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 110 #include "device/bluetooth/bluetooth_device.h" | 111 #include "device/bluetooth/bluetooth_device.h" |
| 111 #include "net/base/escape.h" | 112 #include "net/base/escape.h" |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 .size()) { | 590 .size()) { |
| 590 // Don't show dialog if any logged in user in multi-profiles session | 591 // Don't show dialog if any logged in user in multi-profiles session |
| 591 // dismissed it. | 592 // dismissed it. |
| 592 bool show_intro = true; | 593 bool show_intro = true; |
| 593 const user_manager::UserList logged_in_users = | 594 const user_manager::UserList logged_in_users = |
| 594 user_manager::UserManager::Get()->GetLoggedInUsers(); | 595 user_manager::UserManager::Get()->GetLoggedInUsers(); |
| 595 for (user_manager::UserList::const_iterator it = logged_in_users.begin(); | 596 for (user_manager::UserList::const_iterator it = logged_in_users.begin(); |
| 596 it != logged_in_users.end(); | 597 it != logged_in_users.end(); |
| 597 ++it) { | 598 ++it) { |
| 598 show_intro &= !multi_user_util::GetProfileFromUserID( | 599 show_intro &= !multi_user_util::GetProfileFromUserID( |
| 599 multi_user_util::GetUserIDFromEmail((*it)->email())) | 600 multi_user_util::GetUserIDFromEmail((*it)->GetUserID().
GetUserEmail())) |
| 600 ->GetPrefs() | 601 ->GetPrefs() |
| 601 ->GetBoolean(prefs::kMultiProfileNeverShowIntro); | 602 ->GetBoolean(prefs::kMultiProfileNeverShowIntro); |
| 602 if (!show_intro) | 603 if (!show_intro) |
| 603 break; | 604 break; |
| 604 } | 605 } |
| 605 if (show_intro) { | 606 if (show_intro) { |
| 606 base::Callback<void(bool)> on_accept = | 607 base::Callback<void(bool)> on_accept = |
| 607 base::Bind(&OnAcceptMultiprofilesIntro); | 608 base::Bind(&OnAcceptMultiprofilesIntro); |
| 608 ShowMultiprofilesIntroDialog(on_accept); | 609 ShowMultiprofilesIntroDialog(on_accept); |
| 609 } else { | 610 } else { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 SetProfile(ProfileManager::GetActiveUserProfile()); | 832 SetProfile(ProfileManager::GetActiveUserProfile()); |
| 832 GetSystemTrayNotifier()->NotifyUserUpdate(); | 833 GetSystemTrayNotifier()->NotifyUserUpdate(); |
| 833 } | 834 } |
| 834 | 835 |
| 835 bool SystemTrayDelegateChromeOS::IsSearchKeyMappedToCapsLock() { | 836 bool SystemTrayDelegateChromeOS::IsSearchKeyMappedToCapsLock() { |
| 836 return search_key_mapped_to_ == input_method::kCapsLockKey; | 837 return search_key_mapped_to_ == input_method::kCapsLockKey; |
| 837 } | 838 } |
| 838 | 839 |
| 839 ash::tray::UserAccountsDelegate* | 840 ash::tray::UserAccountsDelegate* |
| 840 SystemTrayDelegateChromeOS::GetUserAccountsDelegate( | 841 SystemTrayDelegateChromeOS::GetUserAccountsDelegate( |
| 841 const std::string& user_id) { | 842 const user_manager::UserID& user_id) { |
| 842 if (!accounts_delegates_.contains(user_id)) { | 843 if (!accounts_delegates_.contains(user_id)) { |
| 843 const user_manager::User* user = | 844 const user_manager::User* user = |
| 844 user_manager::UserManager::Get()->FindUser(user_id); | 845 user_manager::UserManager::Get()->FindUser(user_id); |
| 845 Profile* user_profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); | 846 Profile* user_profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
| 846 CHECK(user_profile); | 847 CHECK(user_profile); |
| 847 accounts_delegates_.set( | 848 accounts_delegates_.set( |
| 848 user_id, | 849 user_id, |
| 849 scoped_ptr<ash::tray::UserAccountsDelegate>( | 850 scoped_ptr<ash::tray::UserAccountsDelegate>( |
| 850 new UserAccountsDelegateChromeOS(user_profile))); | 851 new UserAccountsDelegateChromeOS(user_profile))); |
| 851 } | 852 } |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 policy::CloudPolicyStore* store) { | 1344 policy::CloudPolicyStore* store) { |
| 1344 UpdateEnterpriseDomain(); | 1345 UpdateEnterpriseDomain(); |
| 1345 } | 1346 } |
| 1346 | 1347 |
| 1347 void SystemTrayDelegateChromeOS::OnStoreError(policy::CloudPolicyStore* store) { | 1348 void SystemTrayDelegateChromeOS::OnStoreError(policy::CloudPolicyStore* store) { |
| 1348 UpdateEnterpriseDomain(); | 1349 UpdateEnterpriseDomain(); |
| 1349 } | 1350 } |
| 1350 | 1351 |
| 1351 // Overridden from ash::SessionStateObserver | 1352 // Overridden from ash::SessionStateObserver |
| 1352 void SystemTrayDelegateChromeOS::UserAddedToSession( | 1353 void SystemTrayDelegateChromeOS::UserAddedToSession( |
| 1353 const std::string& user_id) { | 1354 const user_manager::UserID& user_id) { |
| 1354 GetSystemTrayNotifier()->NotifyUserAddedToSession(); | 1355 GetSystemTrayNotifier()->NotifyUserAddedToSession(); |
| 1355 } | 1356 } |
| 1356 | 1357 |
| 1357 void SystemTrayDelegateChromeOS::ActiveUserChanged( | 1358 void SystemTrayDelegateChromeOS::ActiveUserChanged( |
| 1358 const std::string& /* user_id */) { | 1359 const user_manager::UserID& /* user_id */) { |
| 1359 UpdateClockType(); | 1360 UpdateClockType(); |
| 1360 } | 1361 } |
| 1361 | 1362 |
| 1362 // Overridden from chrome::BrowserListObserver. | 1363 // Overridden from chrome::BrowserListObserver. |
| 1363 void SystemTrayDelegateChromeOS::OnBrowserRemoved(Browser* browser) { | 1364 void SystemTrayDelegateChromeOS::OnBrowserRemoved(Browser* browser) { |
| 1364 NotifyIfLastWindowClosed(); | 1365 NotifyIfLastWindowClosed(); |
| 1365 } | 1366 } |
| 1366 | 1367 |
| 1367 // Overridden from extensions::AppWindowRegistry::Observer. | 1368 // Overridden from extensions::AppWindowRegistry::Observer. |
| 1368 void SystemTrayDelegateChromeOS::OnAppWindowRemoved( | 1369 void SystemTrayDelegateChromeOS::OnAppWindowRemoved( |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1426 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1426 << "ENABLE_SUPERVISED_USERS undefined."; | 1427 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1427 return base::string16(); | 1428 return base::string16(); |
| 1428 } | 1429 } |
| 1429 | 1430 |
| 1430 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1431 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1431 return new SystemTrayDelegateChromeOS(); | 1432 return new SystemTrayDelegateChromeOS(); |
| 1432 } | 1433 } |
| 1433 | 1434 |
| 1434 } // namespace chromeos | 1435 } // namespace chromeos |
| OLD | NEW |