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

Side by Side Diff: chrome/browser/chromeos/settings/device_oauth2_token_service.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 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/chromeos/settings/device_oauth2_token_service.h" 5 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 void DeviceOAuth2TokenService::FlushPendingRequests( 108 void DeviceOAuth2TokenService::FlushPendingRequests(
109 bool token_is_valid, 109 bool token_is_valid,
110 GoogleServiceAuthError::State error) { 110 GoogleServiceAuthError::State error) {
111 std::vector<PendingRequest*> requests; 111 std::vector<PendingRequest*> requests;
112 requests.swap(pending_requests_); 112 requests.swap(pending_requests_);
113 for (std::vector<PendingRequest*>::iterator request(requests.begin()); 113 for (std::vector<PendingRequest*>::iterator request(requests.begin());
114 request != requests.end(); 114 request != requests.end();
115 ++request) { 115 ++request) {
116 scoped_ptr<PendingRequest> scoped_request(*request); 116 std::unique_ptr<PendingRequest> scoped_request(*request);
117 if (!scoped_request->request) 117 if (!scoped_request->request)
118 continue; 118 continue;
119 119
120 if (token_is_valid) { 120 if (token_is_valid) {
121 OAuth2TokenService::FetchOAuth2Token( 121 OAuth2TokenService::FetchOAuth2Token(
122 scoped_request->request.get(), 122 scoped_request->request.get(),
123 scoped_request->request->GetAccountId(), 123 scoped_request->request->GetAccountId(),
124 delegate_->GetRequestContext(), scoped_request->client_id, 124 delegate_->GetRequestContext(), scoped_request->client_id,
125 scoped_request->client_secret, scoped_request->scopes); 125 scoped_request->client_secret, scoped_request->scopes);
126 } else { 126 } else {
127 FailRequest(scoped_request->request.get(), error); 127 FailRequest(scoped_request->request.get(), error);
128 } 128 }
129 } 129 }
130 } 130 }
131 131
132 void DeviceOAuth2TokenService::FailRequest( 132 void DeviceOAuth2TokenService::FailRequest(
133 RequestImpl* request, 133 RequestImpl* request,
134 GoogleServiceAuthError::State error) { 134 GoogleServiceAuthError::State error) {
135 GoogleServiceAuthError auth_error(error); 135 GoogleServiceAuthError auth_error(error);
136 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 136 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
137 &RequestImpl::InformConsumer, 137 &RequestImpl::InformConsumer,
138 request->AsWeakPtr(), 138 request->AsWeakPtr(),
139 auth_error, 139 auth_error,
140 std::string(), 140 std::string(),
141 base::Time())); 141 base::Time()));
142 } 142 }
143 143
144 } // namespace chromeos 144 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698