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

Side by Side Diff: components/policy/core/common/cloud/user_info_fetcher.cc

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 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 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 "components/policy/core/common/cloud/user_info_fetcher.h" 5 #include "components/policy/core/common/cloud/user_info_fetcher.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 23 matching lines...) Expand all
34 : delegate_(delegate), 34 : delegate_(delegate),
35 context_(context) { 35 context_(context) {
36 DCHECK(delegate); 36 DCHECK(delegate);
37 } 37 }
38 38
39 UserInfoFetcher::~UserInfoFetcher() { 39 UserInfoFetcher::~UserInfoFetcher() {
40 } 40 }
41 41
42 void UserInfoFetcher::Start(const std::string& access_token) { 42 void UserInfoFetcher::Start(const std::string& access_token) {
43 // Create a URLFetcher and start it. 43 // Create a URLFetcher and start it.
44 url_fetcher_.reset(net::URLFetcher::Create( 44 url_fetcher_ =
45 0, GaiaUrls::GetInstance()->oauth_user_info_url(), 45 net::URLFetcher::Create(0, GaiaUrls::GetInstance()->oauth_user_info_url(),
46 net::URLFetcher::GET, this)); 46 net::URLFetcher::GET, this);
47 url_fetcher_->SetRequestContext(context_); 47 url_fetcher_->SetRequestContext(context_);
48 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 48 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
49 net::LOAD_DO_NOT_SAVE_COOKIES); 49 net::LOAD_DO_NOT_SAVE_COOKIES);
50 url_fetcher_->AddExtraRequestHeader(MakeAuthorizationHeader(access_token)); 50 url_fetcher_->AddExtraRequestHeader(MakeAuthorizationHeader(access_token));
51 url_fetcher_->Start(); // Results in a call to OnURLFetchComplete(). 51 url_fetcher_->Start(); // Results in a call to OnURLFetchComplete().
52 } 52 }
53 53
54 void UserInfoFetcher::OnURLFetchComplete(const net::URLFetcher* source) { 54 void UserInfoFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
55 net::URLRequestStatus status = source->GetStatus(); 55 net::URLRequestStatus status = source->GetStatus();
56 GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone(); 56 GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone();
(...skipping 23 matching lines...) Expand all
80 if (parsed_value.get() && parsed_value->GetAsDictionary(&dict)) { 80 if (parsed_value.get() && parsed_value->GetAsDictionary(&dict)) {
81 delegate_->OnGetUserInfoSuccess(dict); 81 delegate_->OnGetUserInfoSuccess(dict);
82 } else { 82 } else {
83 NOTREACHED() << "Could not parse userinfo response from server"; 83 NOTREACHED() << "Could not parse userinfo response from server";
84 delegate_->OnGetUserInfoFailure(GoogleServiceAuthError( 84 delegate_->OnGetUserInfoFailure(GoogleServiceAuthError(
85 GoogleServiceAuthError::CONNECTION_FAILED)); 85 GoogleServiceAuthError::CONNECTION_FAILED));
86 } 86 }
87 } 87 }
88 88
89 }; // namespace policy 89 }; // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/cloud/external_policy_data_fetcher.cc ('k') | components/precache/core/precache_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698