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

Unified Diff: chrome/browser/ui/ash/multi_user/multi_user_util.cc

Issue 1960293003: Remove OS_CHROMEOS from ui/ash code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/multi_user/multi_user_util.cc
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_util.cc b/chrome/browser/ui/ash/multi_user/multi_user_util.cc
index c273936497f34c1a98de094902c66fd42c4c2eea..ef2e7cd29a88a8eae74fe71ff9bd7183a89c488e 100644
--- a/chrome/browser/ui/ash/multi_user/multi_user_util.cc
+++ b/chrome/browser/ui/ash/multi_user/multi_user_util.cc
@@ -9,16 +9,13 @@
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "components/signin/core/account_id/account_id.h"
-#include "google_apis/gaia/gaia_auth_util.h"
-
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
+#include "components/signin/core/account_id/account_id.h"
#include "components/user_manager/user_manager.h"
-#endif
+#include "google_apis/gaia/gaia_auth_util.h"
namespace multi_user_util {
@@ -48,7 +45,6 @@ Profile* GetProfileFromAccountId(const AccountId& account_id) {
return *profile_iterator;
}
-#if defined(OS_CHROMEOS)
// If in a session the refresh token is revoked, GetAccountIdFromProfile()
// returns an empty account id which will cause the profile not being fetched
// properly. In this case we fall back to use GetProfileByUser() function.
@@ -59,13 +55,11 @@ Profile* GetProfileFromAccountId(const AccountId& account_id) {
user_manager::UserManager::Get()->FindUser(account_id);
if (user)
return chromeos::ProfileHelper::Get()->GetProfileByUser(user);
-#endif
return nullptr;
}
Profile* GetProfileFromWindow(aura::Window* window) {
-#if defined(OS_CHROMEOS)
chrome::MultiUserWindowManager* manager =
chrome::MultiUserWindowManager::GetInstance();
// We might come here before the manager got created - or in a unit test.
@@ -73,42 +67,27 @@ Profile* GetProfileFromWindow(aura::Window* window) {
return nullptr;
const AccountId account_id = manager->GetUserPresentingWindow(window);
return account_id.is_valid() ? GetProfileFromAccountId(account_id) : nullptr;
-#else
- return nullptr;
-#endif
}
bool IsProfileFromActiveUser(Profile* profile) {
-#if defined(OS_CHROMEOS)
return GetAccountIdFromProfile(profile) ==
user_manager::UserManager::Get()->GetActiveUser()->GetAccountId();
-#else
- // In non Chrome OS configurations this will be always true since this only
- // makes sense in separate desktop mode.
- return true;
-#endif
}
const AccountId GetCurrentAccountId() {
-#if defined(OS_CHROMEOS)
const user_manager::User* user =
user_manager::UserManager::Get()->GetActiveUser();
// In unit tests user login phase is usually skipped.
- if (user)
- return user->GetAccountId();
-#endif
- return EmptyAccountId();
+ return user ? user->GetAccountId() : EmptyAccountId();
}
// Move the window to the current user's desktop.
void MoveWindowToCurrentDesktop(aura::Window* window) {
-#if defined(OS_CHROMEOS)
if (!chrome::MultiUserWindowManager::GetInstance()->IsWindowOnDesktopOfUser(
window, GetCurrentAccountId())) {
chrome::MultiUserWindowManager::GetInstance()->ShowWindowForUser(
window, GetCurrentAccountId());
}
-#endif
}
} // namespace multi_user_util

Powered by Google App Engine
This is Rietveld 408576698