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

Side by Side Diff: chrome/browser/local_discovery/gcd_api_flow_impl.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 "chrome/browser/local_discovery/gcd_api_flow_impl.h" 5 #include "chrome/browser/local_discovery/gcd_api_flow_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility>
8 9
9 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
10 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "chrome/browser/local_discovery/gcd_constants.h" 14 #include "chrome/browser/local_discovery/gcd_constants.h"
14 #include "chrome/common/cloud_print/cloud_print_constants.h" 15 #include "chrome/common/cloud_print/cloud_print_constants.h"
15 #include "components/cloud_devices/common/cloud_devices_urls.h" 16 #include "components/cloud_devices/common/cloud_devices_urls.h"
16 #include "google_apis/gaia/google_service_auth_error.h" 17 #include "google_apis/gaia/google_service_auth_error.h"
17 #include "net/base/load_flags.h" 18 #include "net/base/load_flags.h"
18 #include "net/base/url_util.h" 19 #include "net/base/url_util.h"
19 #include "net/http/http_status_code.h" 20 #include "net/http/http_status_code.h"
20 #include "net/url_request/url_request_status.h" 21 #include "net/url_request/url_request_status.h"
21 22
22 namespace local_discovery { 23 namespace local_discovery {
23 24
24 GCDApiFlowImpl::GCDApiFlowImpl(net::URLRequestContextGetter* request_context, 25 GCDApiFlowImpl::GCDApiFlowImpl(net::URLRequestContextGetter* request_context,
25 OAuth2TokenService* token_service, 26 OAuth2TokenService* token_service,
26 const std::string& account_id) 27 const std::string& account_id)
27 : OAuth2TokenService::Consumer("cloud_print"), 28 : OAuth2TokenService::Consumer("cloud_print"),
28 request_context_(request_context), 29 request_context_(request_context),
29 token_service_(token_service), 30 token_service_(token_service),
30 account_id_(account_id) { 31 account_id_(account_id) {
31 } 32 }
32 33
33 GCDApiFlowImpl::~GCDApiFlowImpl() { 34 GCDApiFlowImpl::~GCDApiFlowImpl() {
34 } 35 }
35 36
36 void GCDApiFlowImpl::Start(scoped_ptr<Request> request) { 37 void GCDApiFlowImpl::Start(scoped_ptr<Request> request) {
37 request_ = request.Pass(); 38 request_ = std::move(request);
38 OAuth2TokenService::ScopeSet oauth_scopes; 39 OAuth2TokenService::ScopeSet oauth_scopes;
39 oauth_scopes.insert(request_->GetOAuthScope()); 40 oauth_scopes.insert(request_->GetOAuthScope());
40 oauth_request_ = 41 oauth_request_ =
41 token_service_->StartRequest(account_id_, oauth_scopes, this); 42 token_service_->StartRequest(account_id_, oauth_scopes, this);
42 } 43 }
43 44
44 void GCDApiFlowImpl::OnGetTokenSuccess( 45 void GCDApiFlowImpl::OnGetTokenSuccess(
45 const OAuth2TokenService::Request* request, 46 const OAuth2TokenService::Request* request,
46 const std::string& access_token, 47 const std::string& access_token,
47 const base::Time& expiration_time) { 48 const base::Time& expiration_time) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 106
106 if (!value || !value->GetAsDictionary(&dictionary_value)) { 107 if (!value || !value->GetAsDictionary(&dictionary_value)) {
107 request_->OnGCDAPIFlowError(ERROR_MALFORMED_RESPONSE); 108 request_->OnGCDAPIFlowError(ERROR_MALFORMED_RESPONSE);
108 return; 109 return;
109 } 110 }
110 111
111 request_->OnGCDAPIFlowComplete(*dictionary_value); 112 request_->OnGCDAPIFlowComplete(*dictionary_value);
112 } 113 }
113 114
114 } // namespace local_discovery 115 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698