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

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

Issue 2888763004: Network traffic annotation added to CloudPrintUrlFetcher. (Closed)
Patch Set: nits Created 3 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
« no previous file with comments | « no previous file | chrome/service/cloud_print/cloud_print_auth.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_
6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h" 13 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h"
14 #include "google_apis/gaia/gaia_oauth_client.h" 14 #include "google_apis/gaia/gaia_oauth_client.h"
15 #include "net/traffic_annotation/network_traffic_annotation.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace cloud_print { 18 namespace cloud_print {
18 19
19 // CloudPrintAuth is a class to handle login, token refresh, and other 20 // CloudPrintAuth is a class to handle login, token refresh, and other
20 // authentication tasks for Cloud Print. 21 // authentication tasks for Cloud Print.
21 // CloudPrintAuth will create new robot account for this proxy if needed. 22 // CloudPrintAuth will create new robot account for this proxy if needed.
22 // CloudPrintAuth will obtain new OAuth token. 23 // CloudPrintAuth will obtain new OAuth token.
23 // CloudPrintAuth will schedule periodic OAuth token refresh 24 // CloudPrintAuth will schedule periodic OAuth token refresh
24 // It is running in the same thread as CloudPrintProxyBackend::Core. 25 // It is running in the same thread as CloudPrintProxyBackend::Core.
25 class CloudPrintAuth : public base::RefCountedThreadSafe<CloudPrintAuth>, 26 class CloudPrintAuth : public base::RefCountedThreadSafe<CloudPrintAuth>,
26 public CloudPrintURLFetcher::Delegate, 27 public CloudPrintURLFetcher::Delegate,
27 public gaia::GaiaOAuthClient::Delegate { 28 public gaia::GaiaOAuthClient::Delegate {
28 public: 29 public:
29 class Client { 30 class Client {
30 public: 31 public:
31 virtual void OnAuthenticationComplete( 32 virtual void OnAuthenticationComplete(
32 const std::string& access_token, 33 const std::string& access_token,
33 const std::string& robot_oauth_refresh_token, 34 const std::string& robot_oauth_refresh_token,
34 const std::string& robot_email, 35 const std::string& robot_email,
35 const std::string& user_email) = 0; 36 const std::string& user_email) = 0;
36 virtual void OnInvalidCredentials() = 0; 37 virtual void OnInvalidCredentials() = 0;
37 protected: 38 protected:
38 virtual ~Client() {} 39 virtual ~Client() {}
39 }; 40 };
40 41
41 CloudPrintAuth(Client* client, 42 CloudPrintAuth(Client* client,
42 const GURL& cloud_print_server_url, 43 const GURL& cloud_print_server_url,
43 const gaia::OAuthClientInfo& oauth_client_info, 44 const gaia::OAuthClientInfo& oauth_client_info,
44 const std::string& proxy_id); 45 const std::string& proxy_id,
46 const net::PartialNetworkTrafficAnnotationTag&
47 partial_traffic_annotation);
45 48
46 // Note: 49 // Note:
47 // 50 //
48 // The Authenticate* methods are the various entry points from 51 // The Authenticate* methods are the various entry points from
49 // CloudPrintProxyBackend::Core. It calls us on a dedicated thread to 52 // CloudPrintProxyBackend::Core. It calls us on a dedicated thread to
50 // actually perform synchronous (and potentially blocking) operations. 53 // actually perform synchronous (and potentially blocking) operations.
51 void AuthenticateWithToken(const std::string& cloud_print_token); 54 void AuthenticateWithToken(const std::string& cloud_print_token);
52 void AuthenticateWithRobotToken(const std::string& robot_oauth_refresh_token, 55 void AuthenticateWithRobotToken(const std::string& robot_oauth_refresh_token,
53 const std::string& robot_email); 56 const std::string& robot_email);
54 void AuthenticateWithRobotAuthCode(const std::string& robot_oauth_auth_code, 57 void AuthenticateWithRobotAuthCode(const std::string& robot_oauth_auth_code,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 std::string refresh_token_; 96 std::string refresh_token_;
94 // The email address of the user. This is only used during initial 97 // The email address of the user. This is only used during initial
95 // authentication with an LSID. This is only used for storing in prefs for 98 // authentication with an LSID. This is only used for storing in prefs for
96 // display purposes. 99 // display purposes.
97 std::string user_email_; 100 std::string user_email_;
98 // The email address of the robot account. 101 // The email address of the robot account.
99 std::string robot_email_; 102 std::string robot_email_;
100 // client login token used to authenticate request to cloud print server to 103 // client login token used to authenticate request to cloud print server to
101 // get the robot account. 104 // get the robot account.
102 std::string client_login_token_; 105 std::string client_login_token_;
106 // Partial network traffic annotation for network requests.
107 const net::PartialNetworkTrafficAnnotationTag partial_traffic_annotation_;
103 108
104 DISALLOW_COPY_AND_ASSIGN(CloudPrintAuth); 109 DISALLOW_COPY_AND_ASSIGN(CloudPrintAuth);
105 }; 110 };
106 111
107 } // namespace cloud_print 112 } // namespace cloud_print
108 113
109 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ 114 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_
110 115
OLDNEW
« no previous file with comments | « no previous file | chrome/service/cloud_print/cloud_print_auth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698