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

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

Issue 9443007: Add Chrome To Mobile Service and Views Page Action. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put shared CloudPrint consts/helpers in chrome/common/; use CloudPrintURL. Created 8 years, 9 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/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/common/cloud_print/cloud_print_helpers.h"
9 #include "chrome/common/net/gaia/gaia_urls.h" 10 #include "chrome/common/net/gaia/gaia_urls.h"
10 #include "chrome/service/cloud_print/cloud_print_consts.h" 11 #include "chrome/service/cloud_print/cloud_print_consts.h"
11 #include "chrome/service/cloud_print/cloud_print_helpers.h" 12 #include "chrome/service/cloud_print/cloud_print_helpers.h"
12 #include "chrome/service/cloud_print/cloud_print_token_store.h" 13 #include "chrome/service/cloud_print/cloud_print_token_store.h"
13 #include "chrome/service/gaia/service_gaia_authenticator.h" 14 #include "chrome/service/gaia/service_gaia_authenticator.h"
14 #include "chrome/service/net/service_url_request_context.h" 15 #include "chrome/service/net/service_url_request_context.h"
15 #include "chrome/service/service_process.h" 16 #include "chrome/service/service_process.h"
16 17
17 CloudPrintAuth::CloudPrintAuth( 18 CloudPrintAuth::CloudPrintAuth(
18 Client* client, 19 Client* client,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 67 }
67 } 68 }
68 69
69 void CloudPrintAuth::AuthenticateWithToken( 70 void CloudPrintAuth::AuthenticateWithToken(
70 const std::string& cloud_print_token) { 71 const std::string& cloud_print_token) {
71 VLOG(1) << "CP_AUTH: Authenticating with token"; 72 VLOG(1) << "CP_AUTH: Authenticating with token";
72 73
73 client_login_token_ = cloud_print_token; 74 client_login_token_ = cloud_print_token;
74 75
75 // We need to get the credentials of the robot here. 76 // We need to get the credentials of the robot here.
76 GURL get_authcode_url = 77 GURL get_authcode_url = cloud_print::GetUrlForGetAuthCode(
77 CloudPrintHelpers::GetUrlForGetAuthCode(cloud_print_server_url_, 78 cloud_print_server_url_, oauth_client_info_.client_id, proxy_id_);
78 oauth_client_info_.client_id,
79 proxy_id_);
80 request_ = new CloudPrintURLFetcher; 79 request_ = new CloudPrintURLFetcher;
81 request_->StartGetRequest(get_authcode_url, 80 request_->StartGetRequest(get_authcode_url,
82 this, 81 this,
83 kCloudPrintAuthMaxRetryCount, 82 kCloudPrintAuthMaxRetryCount,
84 std::string()); 83 std::string());
85 } 84 }
86 85
87 void CloudPrintAuth::AuthenticateWithRobotToken( 86 void CloudPrintAuth::AuthenticateWithRobotToken(
88 const std::string& robot_oauth_refresh_token, 87 const std::string& robot_oauth_refresh_token,
89 const std::string& robot_email) { 88 const std::string& robot_email) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 195 }
197 196
198 std::string CloudPrintAuth::GetAuthHeader() { 197 std::string CloudPrintAuth::GetAuthHeader() {
199 DCHECK(!client_login_token_.empty()); 198 DCHECK(!client_login_token_.empty());
200 std::string header; 199 std::string header;
201 header = "Authorization: GoogleLogin auth="; 200 header = "Authorization: GoogleLogin auth=";
202 header += client_login_token_; 201 header += client_login_token_;
203 return header; 202 return header;
204 } 203 }
205 204
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698