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

Side by Side Diff: components/signin/core/browser/refresh_token_annotation_request.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/signin/core/browser/refresh_token_annotation_request.h" 5 #include "components/signin/core/browser/refresh_token_annotation_request.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 RefreshTokenAnnotationRequest::SendIfNeeded( 49 RefreshTokenAnnotationRequest::SendIfNeeded(
50 PrefService* pref_service, 50 PrefService* pref_service,
51 OAuth2TokenService* token_service, 51 OAuth2TokenService* token_service,
52 SigninClient* signin_client, 52 SigninClient* signin_client,
53 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, 53 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter,
54 const std::string& account_id, 54 const std::string& account_id,
55 const base::Closure& request_callback) { 55 const base::Closure& request_callback) {
56 scoped_ptr<RefreshTokenAnnotationRequest> request; 56 scoped_ptr<RefreshTokenAnnotationRequest> request;
57 57
58 if (!ShouldSendNow(pref_service)) 58 if (!ShouldSendNow(pref_service))
59 return request.Pass(); 59 return request;
60 60
61 // Don't send request if device_id is disabled. 61 // Don't send request if device_id is disabled.
62 std::string device_id = signin_client->GetSigninScopedDeviceId(); 62 std::string device_id = signin_client->GetSigninScopedDeviceId();
63 if (device_id.empty()) 63 if (device_id.empty())
64 return request.Pass(); 64 return request;
65 65
66 request.reset(new RefreshTokenAnnotationRequest( 66 request.reset(new RefreshTokenAnnotationRequest(
67 request_context_getter, signin_client->GetProductVersion(), device_id, 67 request_context_getter, signin_client->GetProductVersion(), device_id,
68 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), request_callback)); 68 GaiaUrls::GetInstance()->oauth2_chrome_client_id(), request_callback));
69 request->RequestAccessToken(token_service, account_id); 69 request->RequestAccessToken(token_service, account_id);
70 return request.Pass(); 70 return request;
71 } 71 }
72 72
73 // static 73 // static
74 bool RefreshTokenAnnotationRequest::ShouldSendNow(PrefService* pref_service) { 74 bool RefreshTokenAnnotationRequest::ShouldSendNow(PrefService* pref_service) {
75 bool should_send_now = false; 75 bool should_send_now = false;
76 // Read scheduled time from prefs. 76 // Read scheduled time from prefs.
77 base::Time scheduled_time = 77 base::Time scheduled_time =
78 base::Time::FromInternalValue(pref_service->GetInt64( 78 base::Time::FromInternalValue(pref_service->GetInt64(
79 prefs::kGoogleServicesRefreshTokenAnnotateScheduledTime)); 79 prefs::kGoogleServicesRefreshTokenAnnotateScheduledTime));
80 80
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 165
166 void RefreshTokenAnnotationRequest::ProcessApiCallFailure( 166 void RefreshTokenAnnotationRequest::ProcessApiCallFailure(
167 const net::URLFetcher* source) { 167 const net::URLFetcher* source) {
168 DCHECK(CalledOnValidThread()); 168 DCHECK(CalledOnValidThread());
169 DVLOG(2) << "Request failed"; 169 DVLOG(2) << "Request failed";
170 RecordRequestStatusHistogram(false); 170 RecordRequestStatusHistogram(false);
171 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, request_callback_); 171 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, request_callback_);
172 request_callback_.Reset(); 172 request_callback_.Reset();
173 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698