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

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

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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
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/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "chrome/common/cloud_print/cloud_print_constants.h" 9 #include "chrome/common/cloud_print/cloud_print_constants.h"
10 #include "chrome/common/cloud_print/cloud_print_helpers.h" 10 #include "chrome/common/cloud_print/cloud_print_helpers.h"
(...skipping 20 matching lines...) Expand all
31 void CloudPrintAuth::AuthenticateWithLsid( 31 void CloudPrintAuth::AuthenticateWithLsid(
32 const std::string& lsid, 32 const std::string& lsid,
33 const std::string& last_robot_refresh_token, 33 const std::string& last_robot_refresh_token,
34 const std::string& last_robot_email, 34 const std::string& last_robot_email,
35 const std::string& last_user_email) { 35 const std::string& last_user_email) {
36 // Keeping VLOGs for Cloud Print proxy logging. It is convinient for finding 36 // Keeping VLOGs for Cloud Print proxy logging. It is convinient for finding
37 // issues with GCP in the field, where only release version is avaialble. 37 // issues with GCP in the field, where only release version is avaialble.
38 VLOG(1) << "CP_AUTH: Authenticating with LSID"; 38 VLOG(1) << "CP_AUTH: Authenticating with LSID";
39 scoped_refptr<ServiceGaiaAuthenticator> gaia_auth_for_print( 39 scoped_refptr<ServiceGaiaAuthenticator> gaia_auth_for_print(
40 new ServiceGaiaAuthenticator( 40 new ServiceGaiaAuthenticator(
41 kProxyAuthUserAgent, kCloudPrintGaiaServiceId, 41 kProxyAuthUserAgent,
42 kCloudPrintGaiaServiceId,
42 GaiaUrls::GetInstance()->client_login_url(), 43 GaiaUrls::GetInstance()->client_login_url(),
43 g_service_process->io_thread()->message_loop_proxy())); 44 g_service_process->io_thread()->message_loop_proxy().get()));
44 gaia_auth_for_print->set_message_loop(base::MessageLoop::current()); 45 gaia_auth_for_print->set_message_loop(base::MessageLoop::current());
45 if (gaia_auth_for_print->AuthenticateWithLsid(lsid)) { 46 if (gaia_auth_for_print->AuthenticateWithLsid(lsid)) {
46 // Stash away the user email so we can save it in prefs. 47 // Stash away the user email so we can save it in prefs.
47 user_email_ = gaia_auth_for_print->email(); 48 user_email_ = gaia_auth_for_print->email();
48 // If the same user is re-enabling Cloud Print and we have stashed robot 49 // If the same user is re-enabling Cloud Print and we have stashed robot
49 // credentials, we will use those. 50 // credentials, we will use those.
50 if ((0 == base::strcasecmp(user_email_.c_str(), last_user_email.c_str())) && 51 if ((0 == base::strcasecmp(user_email_.c_str(), last_user_email.c_str())) &&
51 !last_robot_refresh_token.empty() && 52 !last_robot_refresh_token.empty() &&
52 !last_robot_email.empty()) { 53 !last_robot_email.empty()) {
53 AuthenticateWithRobotToken(last_robot_refresh_token, 54 AuthenticateWithRobotToken(last_robot_refresh_token,
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 DCHECK(!client_login_token_.empty()); 194 DCHECK(!client_login_token_.empty());
194 std::string header; 195 std::string header;
195 header = "Authorization: GoogleLogin auth="; 196 header = "Authorization: GoogleLogin auth=";
196 header += client_login_token_; 197 header += client_login_token_;
197 return header; 198 return header;
198 } 199 }
199 200
200 CloudPrintAuth::~CloudPrintAuth() {} 201 CloudPrintAuth::~CloudPrintAuth() {}
201 202
202 } // namespace cloud_print 203 } // namespace cloud_print
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698