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

Side by Side Diff: chrome/service/cloud_print/cloud_print_auth.cc

Issue 1167163002: chrome: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing message_loop.h includes. Created 5 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 "chrome/service/cloud_print/cloud_print_auth.h" 5 #include "chrome/service/cloud_print/cloud_print_auth.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h"
8 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/single_thread_task_runner.h"
9 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/thread_task_runner_handle.h"
10 #include "chrome/common/cloud_print/cloud_print_constants.h" 13 #include "chrome/common/cloud_print/cloud_print_constants.h"
11 #include "chrome/common/cloud_print/cloud_print_helpers.h" 14 #include "chrome/common/cloud_print/cloud_print_helpers.h"
12 #include "chrome/service/cloud_print/cloud_print_token_store.h" 15 #include "chrome/service/cloud_print/cloud_print_token_store.h"
13 #include "chrome/service/net/service_url_request_context_getter.h" 16 #include "chrome/service/net/service_url_request_context_getter.h"
14 #include "chrome/service/service_process.h" 17 #include "chrome/service/service_process.h"
15 #include "google_apis/gaia/gaia_urls.h" 18 #include "google_apis/gaia/gaia_urls.h"
16 19
17 namespace cloud_print { 20 namespace cloud_print {
18 21
19 namespace { 22 namespace {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 UMA_HISTOGRAM_ENUMERATION("CloudPrint.AuthEvent", AUTH_EVENT_REFRESH_RESPONSE, 130 UMA_HISTOGRAM_ENUMERATION("CloudPrint.AuthEvent", AUTH_EVENT_REFRESH_RESPONSE,
128 AUTH_EVENT_MAX); 131 AUTH_EVENT_MAX);
129 client_->OnAuthenticationComplete(access_token, refresh_token_, 132 client_->OnAuthenticationComplete(access_token, refresh_token_,
130 robot_email_, user_email_); 133 robot_email_, user_email_);
131 134
132 // Schedule a task to refresh the access token again when it is about to 135 // Schedule a task to refresh the access token again when it is about to
133 // expire. 136 // expire.
134 DCHECK(expires_in_seconds > kTokenRefreshGracePeriodSecs); 137 DCHECK(expires_in_seconds > kTokenRefreshGracePeriodSecs);
135 base::TimeDelta refresh_delay = base::TimeDelta::FromSeconds( 138 base::TimeDelta refresh_delay = base::TimeDelta::FromSeconds(
136 expires_in_seconds - kTokenRefreshGracePeriodSecs); 139 expires_in_seconds - kTokenRefreshGracePeriodSecs);
137 base::MessageLoop::current()->PostDelayedTask( 140 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
138 FROM_HERE, 141 FROM_HERE, base::Bind(&CloudPrintAuth::RefreshAccessToken, this),
139 base::Bind(&CloudPrintAuth::RefreshAccessToken, this),
140 refresh_delay); 142 refresh_delay);
141 } 143 }
142 144
143 void CloudPrintAuth::OnOAuthError() { 145 void CloudPrintAuth::OnOAuthError() {
144 UMA_HISTOGRAM_ENUMERATION("CloudPrint.AuthEvent", AUTH_EVENT_AUTH_ERROR, 146 UMA_HISTOGRAM_ENUMERATION("CloudPrint.AuthEvent", AUTH_EVENT_AUTH_ERROR,
145 AUTH_EVENT_MAX); 147 AUTH_EVENT_MAX);
146 // Notify client about authentication error. 148 // Notify client about authentication error.
147 client_->OnInvalidCredentials(); 149 client_->OnInvalidCredentials();
148 } 150 }
149 151
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 DCHECK(!client_login_token_.empty()); 215 DCHECK(!client_login_token_.empty());
214 std::string header; 216 std::string header;
215 header = "Authorization: GoogleLogin auth="; 217 header = "Authorization: GoogleLogin auth=";
216 header += client_login_token_; 218 header += client_login_token_;
217 return header; 219 return header;
218 } 220 }
219 221
220 CloudPrintAuth::~CloudPrintAuth() {} 222 CloudPrintAuth::~CloudPrintAuth() {}
221 223
222 } // namespace cloud_print 224 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/renderer/spellchecker/spellcheck.cc ('k') | chrome/service/cloud_print/cloud_print_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698