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

Side by Side Diff: chrome/browser/managed_mode/managed_user_refresh_token_fetcher.cc

Issue 316863002: Rename "managed (mode|user)" to "supervised user" (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 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/managed_mode/managed_user_refresh_token_fetcher.h" 5 #include "chrome/browser/managed_mode/managed_user_refresh_token_fetcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "google_apis/gaia/gaia_constants.h" 12 #include "google_apis/gaia/gaia_constants.h"
13 #include "google_apis/gaia/gaia_oauth_client.h" 13 #include "google_apis/gaia/gaia_oauth_client.h"
14 #include "google_apis/gaia/gaia_urls.h" 14 #include "google_apis/gaia/gaia_urls.h"
15 #include "google_apis/gaia/google_service_auth_error.h" 15 #include "google_apis/gaia/google_service_auth_error.h"
16 #include "google_apis/gaia/oauth2_api_call_flow.h" 16 #include "google_apis/gaia/oauth2_api_call_flow.h"
17 #include "google_apis/gaia/oauth2_token_service.h" 17 #include "google_apis/gaia/oauth2_token_service.h"
18 #include "net/base/escape.h" 18 #include "net/base/escape.h"
19 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
20 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
21 #include "net/http/http_status_code.h" 21 #include "net/http/http_status_code.h"
22 #include "net/url_request/url_fetcher.h" 22 #include "net/url_request/url_fetcher.h"
23 #include "net/url_request/url_request_status.h" 23 #include "net/url_request/url_request_status.h"
24 24
25 using GaiaConstants::kChromeSyncManagedOAuth2Scope; 25 using GaiaConstants::kChromeSyncSupervisedOAuth2Scope;
26 using base::Time; 26 using base::Time;
27 using gaia::GaiaOAuthClient; 27 using gaia::GaiaOAuthClient;
28 using net::URLFetcher; 28 using net::URLFetcher;
29 using net::URLFetcherDelegate; 29 using net::URLFetcherDelegate;
30 using net::URLRequestContextGetter; 30 using net::URLRequestContextGetter;
31 31
32 namespace { 32 namespace {
33 33
34 const int kNumRetries = 1; 34 const int kNumRetries = 1;
35 35
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 152 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
153 net::LOAD_DO_NOT_SAVE_COOKIES); 153 net::LOAD_DO_NOT_SAVE_COOKIES);
154 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(kNumRetries); 154 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(kNumRetries);
155 url_fetcher_->AddExtraRequestHeader( 155 url_fetcher_->AddExtraRequestHeader(
156 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); 156 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str()));
157 157
158 std::string body = base::StringPrintf( 158 std::string body = base::StringPrintf(
159 kIssueTokenBodyFormat, 159 kIssueTokenBodyFormat,
160 net::EscapeUrlEncodedData( 160 net::EscapeUrlEncodedData(
161 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), true).c_str(), 161 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), true).c_str(),
162 net::EscapeUrlEncodedData(kChromeSyncManagedOAuth2Scope, true).c_str(), 162 net::EscapeUrlEncodedData(kChromeSyncSupervisedOAuth2Scope, true).c_str(),
163 net::EscapeUrlEncodedData(managed_user_id_, true).c_str(), 163 net::EscapeUrlEncodedData(managed_user_id_, true).c_str(),
164 net::EscapeUrlEncodedData(device_name_, true).c_str()); 164 net::EscapeUrlEncodedData(device_name_, true).c_str());
165 url_fetcher_->SetUploadData("application/x-www-form-urlencoded", body); 165 url_fetcher_->SetUploadData("application/x-www-form-urlencoded", body);
166 166
167 url_fetcher_->Start(); 167 url_fetcher_->Start();
168 } 168 }
169 169
170 void ManagedUserRefreshTokenFetcherImpl::OnGetTokenFailure( 170 void ManagedUserRefreshTokenFetcherImpl::OnGetTokenFailure(
171 const OAuth2TokenService::Request* request, 171 const OAuth2TokenService::Request* request,
172 const GoogleServiceAuthError& error) { 172 const GoogleServiceAuthError& error) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 ManagedUserRefreshTokenFetcher::Create(OAuth2TokenService* oauth2_token_service, 274 ManagedUserRefreshTokenFetcher::Create(OAuth2TokenService* oauth2_token_service,
275 const std::string& account_id, 275 const std::string& account_id,
276 URLRequestContextGetter* context) { 276 URLRequestContextGetter* context) {
277 scoped_ptr<ManagedUserRefreshTokenFetcher> fetcher( 277 scoped_ptr<ManagedUserRefreshTokenFetcher> fetcher(
278 new ManagedUserRefreshTokenFetcherImpl(oauth2_token_service, account_id, 278 new ManagedUserRefreshTokenFetcherImpl(oauth2_token_service, account_id,
279 context)); 279 context));
280 return fetcher.Pass(); 280 return fetcher.Pass();
281 } 281 }
282 282
283 ManagedUserRefreshTokenFetcher::~ManagedUserRefreshTokenFetcher() {} 283 ManagedUserRefreshTokenFetcher::~ManagedUserRefreshTokenFetcher() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698