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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
index 0e6b955ca7a33a7ad24c4ca7b359b655f1ffe04c..b0fe448519ea5c10fb0c0cc4add3ac79e85eba18 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -67,6 +67,7 @@
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/favicon/content/content_favicon_driver.h"
+#include "components/user_manager/user_id.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
@@ -315,7 +316,7 @@ class ChromeLauncherControllerUserSwitchObserverChromeOS
// Users which were just added to the system, but which profiles were not yet
// (fully) loaded.
- std::set<std::string> added_user_ids_waiting_for_profiles_;
+ std::set<user_manager::UserID> added_user_ids_waiting_for_profiles_;
DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerUserSwitchObserverChromeOS);
};
@@ -323,11 +324,11 @@ class ChromeLauncherControllerUserSwitchObserverChromeOS
void ChromeLauncherControllerUserSwitchObserverChromeOS::UserAddedToSession(
const user_manager::User* active_user) {
Profile* profile = multi_user_util::GetProfileFromUserID(
- active_user->email());
+ active_user->GetUserID());
// If we do not have a profile yet, we postpone forwarding the notification
// until it is loaded.
if (!profile)
- added_user_ids_waiting_for_profiles_.insert(active_user->email());
+ added_user_ids_waiting_for_profiles_.insert(active_user->GetUserID());
else
AddUser(profile);
}
@@ -340,8 +341,8 @@ void ChromeLauncherControllerUserSwitchObserverChromeOS::Observe(
!added_user_ids_waiting_for_profiles_.empty()) {
// Check if the profile is from a user which was on the waiting list.
Profile* profile = content::Source<Profile>(source).ptr();
- std::string user_id = multi_user_util::GetUserIDFromProfile(profile);
- std::set<std::string>::iterator it = std::find(
+ user_manager::UserID user_id = multi_user_util::GetUserIDFromProfile(profile);
+ std::set<user_manager::UserID>::iterator it = std::find(
added_user_ids_waiting_for_profiles_.begin(),
added_user_ids_waiting_for_profiles_.end(),
user_id);
@@ -1100,7 +1101,7 @@ ChromeLauncherController::ActivateWindowOrMinimizeIfActive(
if (chrome::MultiUserWindowManager::GetMultiProfileMode() ==
chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) {
aura::Window* native_window = window->GetNativeWindow();
- const std::string& current_user =
+ const user_manager::UserID& current_user =
multi_user_util::GetUserIDFromProfile(profile());
chrome::MultiUserWindowManager* manager =
chrome::MultiUserWindowManager::GetInstance();
@@ -1180,7 +1181,7 @@ void ChromeLauncherController::ShelfStatusChanged() {
}
void ChromeLauncherController::ActiveUserChanged(
- const std::string& user_email) {
+ const user_manager::UserID& user_id) {
// Store the order of running applications for the user which gets inactive.
RememberUnpinnedRunningApplicationOrder();
// Coming here the default profile is already switched. All profile specific
@@ -1190,9 +1191,9 @@ void ChromeLauncherController::ActiveUserChanged(
// set it as active.
AttachProfile(ProfileManager::GetActiveUserProfile());
// Update the V1 applications.
- browser_status_monitor_->ActiveUserChanged(user_email);
+ browser_status_monitor_->ActiveUserChanged(user_id);
// Switch the running applications to the new user.
- app_window_controller_->ActiveUserChanged(user_email);
+ app_window_controller_->ActiveUserChanged(user_id);
// Update the user specific shell properties from the new user profile.
UpdateAppLaunchersFromPref();
SetShelfAlignmentFromPrefs();
@@ -1203,7 +1204,7 @@ void ChromeLauncherController::ActiveUserChanged(
#endif // defined(OS_CHROMEOS)
// Restore the order of running, but unpinned applications for the activated
// user.
- RestoreUnpinnedRunningApplicationOrder(user_email);
+ RestoreUnpinnedRunningApplicationOrder(user_id);
// Inform the system tray of the change.
ash::Shell::GetInstance()->system_tray_delegate()->ActiveUserWasChanged();
// Force on-screen keyboard to reset.
@@ -1453,7 +1454,7 @@ void ChromeLauncherController::RememberUnpinnedRunningApplicationOrder() {
}
void ChromeLauncherController::RestoreUnpinnedRunningApplicationOrder(
- const std::string& user_id) {
+ const user_manager::UserID& user_id) {
const RunningAppListIdMap::iterator app_id_list =
last_used_running_application_order_.find(user_id);
if (app_id_list == last_used_running_application_order_.end())
@@ -1506,7 +1507,7 @@ bool ChromeLauncherController::IsBrowserFromActiveUser(Browser* browser) {
bool ChromeLauncherController::ShelfBoundsChangesProbablyWithUser(
aura::Window* root_window,
- const std::string& user_id) const {
+ const user_manager::UserID& user_id) const {
Profile* other_profile = multi_user_util::GetProfileFromUserID(user_id);
DCHECK_NE(other_profile, profile_);

Powered by Google App Engine
This is Rietveld 408576698