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

Side by Side Diff: chrome/browser/ui/ash/multi_user/multi_user_util.cc

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 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/multi_user/multi_user_util.h" 5 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "google_apis/gaia/gaia_auth_util.h" 13 #include "google_apis/gaia/gaia_auth_util.h"
14 14
15 #if defined(OS_CHROMEOS) 15 #if defined(OS_CHROMEOS)
16 #include "chrome/browser/chromeos/login/users/user_manager.h"
17 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 16 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
17 #include "components/user_manager/user_manager.h"
18 #endif 18 #endif
19 19
20 namespace multi_user_util { 20 namespace multi_user_util {
21 21
22 std::string GetUserIDFromProfile(Profile* profile) { 22 std::string GetUserIDFromProfile(Profile* profile) {
23 return GetUserIDFromEmail(profile->GetOriginalProfile()->GetProfileName()); 23 return GetUserIDFromEmail(profile->GetOriginalProfile()->GetProfileName());
24 } 24 }
25 25
26 std::string GetUserIDFromEmail(const std::string& email) { 26 std::string GetUserIDFromEmail(const std::string& email) {
27 // |email| and profile name could be empty if not yet logged in or guest mode. 27 // |email| and profile name could be empty if not yet logged in or guest mode.
(...skipping 28 matching lines...) Expand all
56 return user_id.empty() ? NULL : 56 return user_id.empty() ? NULL :
57 multi_user_util::GetProfileFromUserID(user_id); 57 multi_user_util::GetProfileFromUserID(user_id);
58 #else 58 #else
59 return NULL; 59 return NULL;
60 #endif 60 #endif
61 } 61 }
62 62
63 bool IsProfileFromActiveUser(Profile* profile) { 63 bool IsProfileFromActiveUser(Profile* profile) {
64 #if defined(OS_CHROMEOS) 64 #if defined(OS_CHROMEOS)
65 return GetUserIDFromProfile(profile) == 65 return GetUserIDFromProfile(profile) ==
66 chromeos::UserManager::Get()->GetActiveUser()->email(); 66 user_manager::UserManager::Get()->GetActiveUser()->email();
67 #else 67 #else
68 // In non Chrome OS configurations this will be always true since this only 68 // In non Chrome OS configurations this will be always true since this only
69 // makes sense in separate desktop mode. 69 // makes sense in separate desktop mode.
70 return true; 70 return true;
71 #endif 71 #endif
72 } 72 }
73 73
74 const std::string& GetCurrentUserId() { 74 const std::string& GetCurrentUserId() {
75 #if defined(OS_CHROMEOS) 75 #if defined(OS_CHROMEOS)
76 return chromeos::UserManager::Get()->GetActiveUser()->email(); 76 return user_manager::UserManager::Get()->GetActiveUser()->email();
77 #else 77 #else
78 return base::EmptyString(); 78 return base::EmptyString();
79 #endif 79 #endif
80 } 80 }
81 81
82 // Move the window to the current user's desktop. 82 // Move the window to the current user's desktop.
83 void MoveWindowToCurrentDesktop(aura::Window* window) { 83 void MoveWindowToCurrentDesktop(aura::Window* window) {
84 #if defined(OS_CHROMEOS) 84 #if defined(OS_CHROMEOS)
85 chrome::MultiUserWindowManager::GetInstance()->ShowWindowForUser( 85 chrome::MultiUserWindowManager::GetInstance()->ShowWindowForUser(
86 window, 86 window,
87 GetCurrentUserId()); 87 GetCurrentUserId());
88 #endif 88 #endif
89 } 89 }
90 90
91 } // namespace multi_user_util 91 } // namespace multi_user_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698