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

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

Issue 10823208: Reverting this as it causes browser tests on the Linux ChromiumOS builder to fail. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 (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/policy_oauth_fetcher.h" 5 #include "chrome/browser/chromeos/login/policy_oauth_fetcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/policy/browser_policy_connector.h" 9 #include "chrome/browser/policy/browser_policy_connector.h"
10 #include "chrome/browser/policy/user_cloud_policy_manager.h"
11 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/common/net/gaia/gaia_constants.h" 11 #include "chrome/common/net/gaia/gaia_constants.h"
14 #include "chrome/common/net/gaia/google_service_auth_error.h" 12 #include "chrome/common/net/gaia/google_service_auth_error.h"
15 13
16 namespace chromeos { 14 namespace chromeos {
17 15
18 namespace { 16 namespace {
19 const char kServiceScopeChromeOSDeviceManagement[] = 17 const char kServiceScopeChromeOSDeviceManagement[] =
20 "https://www.googleapis.com/auth/chromeosdevicemanagement"; 18 "https://www.googleapis.com/auth/chromeosdevicemanagement";
21 } // namespace 19 } // namespace
22 20
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 const std::string& service_name, 87 const std::string& service_name,
90 const GoogleServiceAuthError& error) { 88 const GoogleServiceAuthError& error) {
91 LOG(WARNING) << "Failed to get OAuth access token for " << service_name 89 LOG(WARNING) << "Failed to get OAuth access token for " << service_name
92 << ", error: " << error.state(); 90 << ", error: " << error.state();
93 SetPolicyToken(""); 91 SetPolicyToken("");
94 } 92 }
95 93
96 void PolicyOAuthFetcher::SetPolicyToken(const std::string& token) { 94 void PolicyOAuthFetcher::SetPolicyToken(const std::string& token) {
97 policy_token_ = token; 95 policy_token_ = token;
98 g_browser_process->browser_policy_connector()->RegisterForUserPolicy(token); 96 g_browser_process->browser_policy_connector()->RegisterForUserPolicy(token);
99
100 // The Profile object passed in to the constructor is destroyed after the
101 // login process is complete. Get the UserCloudPolicyManager from the user's
102 // default profile instead.
103 policy::UserCloudPolicyManager* cloud_policy_manager =
104 ProfileManager::GetDefaultProfile()->GetUserCloudPolicyManager();
105 if (cloud_policy_manager) {
106 if (token.empty())
107 cloud_policy_manager->CancelWaitForPolicyFetch();
108 else
109 cloud_policy_manager->RegisterClient(token);
110 }
111 } 97 }
112 98
113 } // namespace chromeos 99 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils_browsertest.cc ('k') | chrome/browser/policy/auto_enrollment_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698