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

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

Issue 10496002: Revert 140102 - Remove old PostDelayedTask interfaces that use int ms instead of TimeDelta. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
Property Changes:
Deleted: svn:eol-style
- LF
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/win/service_state.h" 5 #include "cloud_print/service/win/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.h" 10 #include "base/message_loop.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 net::URLRequest request(url, &fetcher_delegate); 174 net::URLRequest request(url, &fetcher_delegate);
175 175
176 request.AppendBytesToUpload(post_body.c_str(), post_body.size()); 176 request.AppendBytesToUpload(post_body.c_str(), post_body.size());
177 request.SetExtraRequestHeaderByName( 177 request.SetExtraRequestHeaderByName(
178 "Content-Type", "application/x-www-form-urlencoded", true); 178 "Content-Type", "application/x-www-form-urlencoded", true);
179 request.set_context(context.get()); 179 request.set_context(context.get());
180 request.set_method("POST"); 180 request.set_method("POST");
181 request.Start(); 181 request.Start();
182 182
183 MessageLoop::current()->PostDelayedTask(FROM_HERE, 183 MessageLoop::current()->PostDelayedTask(
184 MessageLoop::QuitClosure(), 184 FROM_HERE, MessageLoop::QuitClosure(), kRequestTimeoutMs);
185 base::TimeDelta::FromMilliseconds(kRequestTimeoutMs));
186 185
187 MessageLoop::current()->Run(); 186 MessageLoop::current()->Run();
188 187
189 const char kAuthStart[] = "Auth="; 188 const char kAuthStart[] = "Auth=";
190 std::vector<std::string> lines; 189 std::vector<std::string> lines;
191 Tokenize(fetcher_delegate.data(), "\r\n", &lines); 190 Tokenize(fetcher_delegate.data(), "\r\n", &lines);
192 for (size_t i = 0; i < lines.size(); ++i) { 191 for (size_t i = 0; i < lines.size(); ++i) {
193 std::vector<std::string> tokens; 192 std::vector<std::string> tokens;
194 if (StartsWithASCII(lines[i], kAuthStart, false)) 193 if (StartsWithASCII(lines[i], kAuthStart, false))
195 return lines[i].substr(arraysize(kAuthStart) - 1); 194 return lines[i].substr(arraysize(kAuthStart) - 1);
196 } 195 }
197 196
198 return std::string(); 197 return std::string();
199 } 198 }
200 199
201 bool ServiceState::Configure(const std::string& email, 200 bool ServiceState::Configure(const std::string& email,
202 const std::string& password, 201 const std::string& password,
203 const std::string& proxy_id) { 202 const std::string& proxy_id) {
204 robot_token_.clear(); 203 robot_token_.clear();
205 robot_email_.clear(); 204 robot_email_.clear();
206 email_ = email; 205 email_ = email;
207 proxy_id_ = proxy_id; 206 proxy_id_ = proxy_id;
208 auth_token_ = LoginToGoogle("cloudprint", email_, password); 207 auth_token_ = LoginToGoogle("cloudprint", email_, password);
209 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password); 208 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password);
210 return IsValid(); 209 return IsValid();
211 } 210 }
212 211
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_refresh_scheduler_unittest.cc ('k') | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698