| OLD | NEW |
| 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 "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 post_body += "accountType=GOOGLE"; | 171 post_body += "accountType=GOOGLE"; |
| 172 post_body += "&Email=" + net::EscapeUrlEncodedData(email, true); | 172 post_body += "&Email=" + net::EscapeUrlEncodedData(email, true); |
| 173 post_body += "&Passwd=" + net::EscapeUrlEncodedData(password, true); | 173 post_body += "&Passwd=" + net::EscapeUrlEncodedData(password, true); |
| 174 post_body += "&source=" + net::EscapeUrlEncodedData("CP-Service", true); | 174 post_body += "&source=" + net::EscapeUrlEncodedData("CP-Service", true); |
| 175 post_body += "&service=" + net::EscapeUrlEncodedData(service, true); | 175 post_body += "&service=" + net::EscapeUrlEncodedData(service, true); |
| 176 | 176 |
| 177 net::URLRequest request(url, &fetcher_delegate, context.get()); | 177 net::URLRequest request(url, &fetcher_delegate, context.get()); |
| 178 int load_flags = request.load_flags(); | 178 int load_flags = request.load_flags(); |
| 179 load_flags = load_flags | net::LOAD_DO_NOT_SEND_COOKIES; | 179 load_flags = load_flags | net::LOAD_DO_NOT_SEND_COOKIES; |
| 180 load_flags = load_flags | net::LOAD_DO_NOT_SAVE_COOKIES; | 180 load_flags = load_flags | net::LOAD_DO_NOT_SAVE_COOKIES; |
| 181 request.set_load_flags(load_flags); | 181 request.SetLoadFlags(load_flags); |
| 182 | 182 |
| 183 scoped_ptr<net::UploadElementReader> reader( | 183 scoped_ptr<net::UploadElementReader> reader( |
| 184 net::UploadOwnedBytesElementReader::CreateWithString(post_body)); | 184 net::UploadOwnedBytesElementReader::CreateWithString(post_body)); |
| 185 request.set_upload(make_scoped_ptr( | 185 request.set_upload(make_scoped_ptr( |
| 186 net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); | 186 net::UploadDataStream::CreateWithReader(reader.Pass(), 0))); |
| 187 request.SetExtraRequestHeaderByName( | 187 request.SetExtraRequestHeaderByName( |
| 188 "Content-Type", "application/x-www-form-urlencoded", true); | 188 "Content-Type", "application/x-www-form-urlencoded", true); |
| 189 request.set_method("POST"); | 189 request.set_method("POST"); |
| 190 request.Start(); | 190 request.Start(); |
| 191 | 191 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 211 const std::string& password, | 211 const std::string& password, |
| 212 const std::string& proxy_id) { | 212 const std::string& proxy_id) { |
| 213 robot_token_.clear(); | 213 robot_token_.clear(); |
| 214 robot_email_.clear(); | 214 robot_email_.clear(); |
| 215 email_ = email; | 215 email_ = email; |
| 216 proxy_id_ = proxy_id; | 216 proxy_id_ = proxy_id; |
| 217 auth_token_ = LoginToGoogle("cloudprint", email_, password); | 217 auth_token_ = LoginToGoogle("cloudprint", email_, password); |
| 218 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password); | 218 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password); |
| 219 return IsValid(); | 219 return IsValid(); |
| 220 } | 220 } |
| OLD | NEW |