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

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 1534173003: ChromeOS user_manager: move all KnownUser code to separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/FindUsingSAML/IsUsingSAML/ Created 5 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/login/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "chromeos/login/user_names.h" 56 #include "chromeos/login/user_names.h"
57 #include "chromeos/settings/cros_settings_names.h" 57 #include "chromeos/settings/cros_settings_names.h"
58 #include "components/google/core/browser/google_util.h" 58 #include "components/google/core/browser/google_util.h"
59 #include "components/policy/core/common/cloud/cloud_policy_core.h" 59 #include "components/policy/core/common/cloud/cloud_policy_core.h"
60 #include "components/policy/core/common/cloud/cloud_policy_store.h" 60 #include "components/policy/core/common/cloud/cloud_policy_store.h"
61 #include "components/policy/core/common/policy_map.h" 61 #include "components/policy/core/common/policy_map.h"
62 #include "components/policy/core/common/policy_service.h" 62 #include "components/policy/core/common/policy_service.h"
63 #include "components/policy/core/common/policy_types.h" 63 #include "components/policy/core/common/policy_types.h"
64 #include "components/signin/core/account_id/account_id.h" 64 #include "components/signin/core/account_id/account_id.h"
65 #include "components/signin/core/browser/signin_client.h" 65 #include "components/signin/core/browser/signin_client.h"
66 #include "components/user_manager/known_user.h"
66 #include "components/user_manager/user_manager.h" 67 #include "components/user_manager/user_manager.h"
67 #include "components/user_manager/user_type.h" 68 #include "components/user_manager/user_type.h"
68 #include "content/public/browser/browser_thread.h" 69 #include "content/public/browser/browser_thread.h"
69 #include "content/public/browser/notification_service.h" 70 #include "content/public/browser/notification_service.h"
70 #include "content/public/browser/notification_types.h" 71 #include "content/public/browser/notification_types.h"
71 #include "content/public/browser/user_metrics.h" 72 #include "content/public/browser/user_metrics.h"
72 #include "google_apis/gaia/gaia_auth_util.h" 73 #include "google_apis/gaia/gaia_auth_util.h"
73 #include "google_apis/gaia/google_service_auth_error.h" 74 #include "google_apis/gaia/google_service_auth_error.h"
74 #include "net/http/http_auth_cache.h" 75 #include "net/http/http_auth_cache.h"
75 #include "net/http/http_network_session.h" 76 #include "net/http/http_network_session.h"
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 return; 1059 return;
1059 } 1060 }
1060 1061
1061 continuation.Run(); 1062 continuation.Run();
1062 } 1063 }
1063 1064
1064 void ExistingUserController::DoCompleteLogin( 1065 void ExistingUserController::DoCompleteLogin(
1065 const UserContext& user_context_wo_device_id) { 1066 const UserContext& user_context_wo_device_id) {
1066 UserContext user_context = user_context_wo_device_id; 1067 UserContext user_context = user_context_wo_device_id;
1067 std::string device_id = 1068 std::string device_id =
1068 user_manager::UserManager::Get()->GetKnownUserDeviceId( 1069 user_manager::known_user::GetDeviceId(user_context.GetAccountId());
1069 user_context.GetAccountId());
1070 if (device_id.empty()) { 1070 if (device_id.empty()) {
1071 bool is_ephemeral = ChromeUserManager::Get()->AreEphemeralUsersEnabled() && 1071 bool is_ephemeral = ChromeUserManager::Get()->AreEphemeralUsersEnabled() &&
1072 user_context.GetAccountId() != 1072 user_context.GetAccountId() !=
1073 ChromeUserManager::Get()->GetOwnerAccountId(); 1073 ChromeUserManager::Get()->GetOwnerAccountId();
1074 device_id = SigninClient::GenerateSigninScopedDeviceID(is_ephemeral); 1074 device_id = SigninClient::GenerateSigninScopedDeviceID(is_ephemeral);
1075 } 1075 }
1076 user_context.SetDeviceId(device_id); 1076 user_context.SetDeviceId(device_id);
1077 1077
1078 const std::string& gaps_cookie = user_context.GetGAPSCookie(); 1078 const std::string& gaps_cookie = user_context.GetGAPSCookie();
1079 if (!gaps_cookie.empty()) { 1079 if (!gaps_cookie.empty()) {
1080 user_manager::UserManager::Get()->SetKnownUserGAPSCookie( 1080 user_manager::known_user::SetGAPSCookie(user_context.GetAccountId(),
1081 user_context.GetAccountId(), gaps_cookie); 1081 gaps_cookie);
1082 } 1082 }
1083 1083
1084 PerformPreLoginActions(user_context); 1084 PerformPreLoginActions(user_context);
1085 1085
1086 if (!time_init_.is_null()) { 1086 if (!time_init_.is_null()) {
1087 base::TimeDelta delta = base::Time::Now() - time_init_; 1087 base::TimeDelta delta = base::Time::Now() - time_init_;
1088 UMA_HISTOGRAM_MEDIUM_TIMES("Login.PromptToCompleteLoginTime", delta); 1088 UMA_HISTOGRAM_MEDIUM_TIMES("Login.PromptToCompleteLoginTime", delta);
1089 time_init_ = base::Time(); // Reset to null. 1089 time_init_ = base::Time(); // Reset to null.
1090 } 1090 }
1091 1091
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 if (!success) { 1196 if (!success) {
1197 LOG(ERROR) << "OAuth2 token fetch failed."; 1197 LOG(ERROR) << "OAuth2 token fetch failed.";
1198 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN)); 1198 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN));
1199 return; 1199 return;
1200 } 1200 }
1201 UserSessionManager::GetInstance()->OnOAuth2TokensFetched(user_context); 1201 UserSessionManager::GetInstance()->OnOAuth2TokensFetched(user_context);
1202 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); 1202 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
1203 } 1203 }
1204 1204
1205 } // namespace chromeos 1205 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698