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

Side by Side Diff: cloud_print/service/service_state.cc

Issue 1550693002: Global conversion of Pass()→std::move() on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « apps/saved_files_service.cc ('k') | crypto/nss_key_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cloud_print/service/service_state.h" 5 #include "cloud_print/service/service_state.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility>
8 9
9 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
13 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "net/base/elements_upload_data_stream.h" 17 #include "net/base/elements_upload_data_stream.h"
17 #include "net/base/escape.h" 18 #include "net/base/escape.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 SetNotEmptyJsonString(cloud_print.get(), kEmailOptionName, email_); 144 SetNotEmptyJsonString(cloud_print.get(), kEmailOptionName, email_);
144 SetNotEmptyJsonString(cloud_print.get(), kProxyIdOptionName, proxy_id_); 145 SetNotEmptyJsonString(cloud_print.get(), kProxyIdOptionName, proxy_id_);
145 SetNotEmptyJsonString(cloud_print.get(), kRobotEmailOptionName, robot_email_); 146 SetNotEmptyJsonString(cloud_print.get(), kRobotEmailOptionName, robot_email_);
146 SetNotEmptyJsonString(cloud_print.get(), kRobotTokenOptionName, robot_token_); 147 SetNotEmptyJsonString(cloud_print.get(), kRobotTokenOptionName, robot_token_);
147 SetNotEmptyJsonString(cloud_print.get(), kAuthTokenOptionName, auth_token_); 148 SetNotEmptyJsonString(cloud_print.get(), kAuthTokenOptionName, auth_token_);
148 SetNotEmptyJsonString(cloud_print.get(), kXmppAuthTokenOptionName, 149 SetNotEmptyJsonString(cloud_print.get(), kXmppAuthTokenOptionName,
149 xmpp_auth_token_); 150 xmpp_auth_token_);
150 151
151 base::DictionaryValue services; 152 base::DictionaryValue services;
152 services.Set(kCloudPrintJsonName, cloud_print.Pass()); 153 services.Set(kCloudPrintJsonName, std::move(cloud_print));
153 154
154 std::string json; 155 std::string json;
155 base::JSONWriter::WriteWithOptions( 156 base::JSONWriter::WriteWithOptions(
156 services, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); 157 services, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json);
157 return json; 158 return json;
158 } 159 }
159 160
160 std::string ServiceState::LoginToGoogle(const std::string& service, 161 std::string ServiceState::LoginToGoogle(const std::string& service,
161 const std::string& email, 162 const std::string& email,
162 const std::string& password) { 163 const std::string& password) {
(...skipping 15 matching lines...) Expand all
178 scoped_ptr<net::URLRequest> request(context->CreateRequest( 179 scoped_ptr<net::URLRequest> request(context->CreateRequest(
179 url, net::DEFAULT_PRIORITY, &fetcher_delegate)); 180 url, net::DEFAULT_PRIORITY, &fetcher_delegate));
180 int load_flags = request->load_flags(); 181 int load_flags = request->load_flags();
181 load_flags = load_flags | net::LOAD_DO_NOT_SEND_COOKIES; 182 load_flags = load_flags | net::LOAD_DO_NOT_SEND_COOKIES;
182 load_flags = load_flags | net::LOAD_DO_NOT_SAVE_COOKIES; 183 load_flags = load_flags | net::LOAD_DO_NOT_SAVE_COOKIES;
183 request->SetLoadFlags(load_flags); 184 request->SetLoadFlags(load_flags);
184 185
185 scoped_ptr<net::UploadElementReader> reader( 186 scoped_ptr<net::UploadElementReader> reader(
186 net::UploadOwnedBytesElementReader::CreateWithString(post_body)); 187 net::UploadOwnedBytesElementReader::CreateWithString(post_body));
187 request->set_upload( 188 request->set_upload(
188 net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); 189 net::ElementsUploadDataStream::CreateWithReader(std::move(reader), 0));
189 request->SetExtraRequestHeaderByName( 190 request->SetExtraRequestHeaderByName(
190 "Content-Type", "application/x-www-form-urlencoded", true); 191 "Content-Type", "application/x-www-form-urlencoded", true);
191 request->set_method("POST"); 192 request->set_method("POST");
192 request->Start(); 193 request->Start();
193 194
194 base::MessageLoop::current()->PostDelayedTask( 195 base::MessageLoop::current()->PostDelayedTask(
195 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 196 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
196 base::TimeDelta::FromMilliseconds(kRequestTimeoutMs)); 197 base::TimeDelta::FromMilliseconds(kRequestTimeoutMs));
197 198
198 base::MessageLoop::current()->Run(); 199 base::MessageLoop::current()->Run();
(...skipping 15 matching lines...) Expand all
214 const std::string& password, 215 const std::string& password,
215 const std::string& proxy_id) { 216 const std::string& proxy_id) {
216 robot_token_.clear(); 217 robot_token_.clear();
217 robot_email_.clear(); 218 robot_email_.clear();
218 email_ = email; 219 email_ = email;
219 proxy_id_ = proxy_id; 220 proxy_id_ = proxy_id;
220 auth_token_ = LoginToGoogle("cloudprint", email_, password); 221 auth_token_ = LoginToGoogle("cloudprint", email_, password);
221 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password); 222 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password);
222 return IsValid(); 223 return IsValid();
223 } 224 }
OLDNEW
« no previous file with comments | « apps/saved_files_service.cc ('k') | crypto/nss_key_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698