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

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

Issue 9703053: Remove old Sleep and PostDelayedTask interfaces that use int ms instead of TimeDelta. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase onto master. 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
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 "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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 183 MessageLoop::current()->PostDelayedTask(
184 FROM_HERE, MessageLoop::QuitClosure(), kRequestTimeoutMs); 184 FROM_HERE, MessageLoop::QuitClosure(),
185 base::TimeDelta::FromMilliseconds(kRequestTimeoutMs));
185 186
186 MessageLoop::current()->Run(); 187 MessageLoop::current()->Run();
187 188
188 const char kAuthStart[] = "Auth="; 189 const char kAuthStart[] = "Auth=";
189 std::vector<std::string> lines; 190 std::vector<std::string> lines;
190 Tokenize(fetcher_delegate.data(), "\r\n", &lines); 191 Tokenize(fetcher_delegate.data(), "\r\n", &lines);
191 for (size_t i = 0; i < lines.size(); ++i) { 192 for (size_t i = 0; i < lines.size(); ++i) {
192 std::vector<std::string> tokens; 193 std::vector<std::string> tokens;
193 if (StartsWithASCII(lines[i], kAuthStart, false)) 194 if (StartsWithASCII(lines[i], kAuthStart, false))
194 return lines[i].substr(arraysize(kAuthStart) - 1); 195 return lines[i].substr(arraysize(kAuthStart) - 1);
195 } 196 }
196 197
197 return std::string(); 198 return std::string();
198 } 199 }
199 200
200 bool ServiceState::Configure(const std::string& email, 201 bool ServiceState::Configure(const std::string& email,
201 const std::string& password, 202 const std::string& password,
202 const std::string& proxy_id) { 203 const std::string& proxy_id) {
203 robot_token_.clear(); 204 robot_token_.clear();
204 robot_email_.clear(); 205 robot_email_.clear();
205 email_ = email; 206 email_ = email;
206 proxy_id_ = proxy_id; 207 proxy_id_ = proxy_id;
207 auth_token_ = LoginToGoogle("cloudprint", email_, password); 208 auth_token_ = LoginToGoogle("cloudprint", email_, password);
208 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password); 209 xmpp_auth_token_ = LoginToGoogle("chromiumsync", email_, password);
209 return IsValid(); 210 return IsValid();
210 } 211 }
211 212
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