OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 virtual void OnInvalidCredentials() = 0; | 34 virtual void OnInvalidCredentials() = 0; |
35 protected: | 35 protected: |
36 virtual ~Client() {} | 36 virtual ~Client() {} |
37 }; | 37 }; |
38 | 38 |
39 CloudPrintAuth(Client* client, | 39 CloudPrintAuth(Client* client, |
40 const GURL& cloud_print_server_url, | 40 const GURL& cloud_print_server_url, |
41 const base::DictionaryValue* print_sys_settings, | 41 const base::DictionaryValue* print_sys_settings, |
42 const gaia::OAuthClientInfo& oauth_client_info, | 42 const gaia::OAuthClientInfo& oauth_client_info, |
43 const std::string& proxy_id); | 43 const std::string& proxy_id); |
44 virtual ~CloudPrintAuth(); | |
45 | 44 |
46 // Note: | 45 // Note: |
47 // | 46 // |
48 // The Authenticate* methods are the various entry points from | 47 // The Authenticate* methods are the various entry points from |
49 // CloudPrintProxyBackend::Core. It calls us on a dedicated thread to | 48 // CloudPrintProxyBackend::Core. It calls us on a dedicated thread to |
50 // actually perform synchronous (and potentially blocking) operations. | 49 // actually perform synchronous (and potentially blocking) operations. |
51 // | 50 // |
52 // When we are passed in an LSID we authenticate using that | 51 // When we are passed in an LSID we authenticate using that |
53 // and retrieve new auth tokens. | 52 // and retrieve new auth tokens. |
54 void AuthenticateWithLsid(const std::string& lsid, | 53 void AuthenticateWithLsid(const std::string& lsid, |
(...skipping 21 matching lines...) Expand all Loading... |
76 // CloudPrintURLFetcher::Delegate implementation. | 75 // CloudPrintURLFetcher::Delegate implementation. |
77 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData( | 76 virtual CloudPrintURLFetcher::ResponseAction HandleJSONData( |
78 const content::URLFetcher* source, | 77 const content::URLFetcher* source, |
79 const GURL& url, | 78 const GURL& url, |
80 base::DictionaryValue* json_data, | 79 base::DictionaryValue* json_data, |
81 bool succeeded) OVERRIDE; | 80 bool succeeded) OVERRIDE; |
82 virtual CloudPrintURLFetcher::ResponseAction OnRequestAuthError() OVERRIDE; | 81 virtual CloudPrintURLFetcher::ResponseAction OnRequestAuthError() OVERRIDE; |
83 virtual std::string GetAuthHeader() OVERRIDE; | 82 virtual std::string GetAuthHeader() OVERRIDE; |
84 | 83 |
85 private: | 84 private: |
| 85 friend class base::RefCountedThreadSafe<CloudPrintAuth>; |
| 86 virtual ~CloudPrintAuth(); |
| 87 |
86 Client* client_; | 88 Client* client_; |
87 gaia::OAuthClientInfo oauth_client_info_; | 89 gaia::OAuthClientInfo oauth_client_info_; |
88 scoped_ptr<gaia::GaiaOAuthClient> oauth_client_; | 90 scoped_ptr<gaia::GaiaOAuthClient> oauth_client_; |
89 scoped_ptr<DictionaryValue> print_system_settings_; | 91 scoped_ptr<DictionaryValue> print_system_settings_; |
90 | 92 |
91 // The CloudPrintURLFetcher instance for the current request. | 93 // The CloudPrintURLFetcher instance for the current request. |
92 scoped_refptr<CloudPrintURLFetcher> request_; | 94 scoped_refptr<CloudPrintURLFetcher> request_; |
93 | 95 |
94 GURL cloud_print_server_url_; | 96 GURL cloud_print_server_url_; |
95 // Proxy id, need to send to the cloud print server to find and update | 97 // Proxy id, need to send to the cloud print server to find and update |
96 // necessary printers during the migration process. | 98 // necessary printers during the migration process. |
97 const std::string& proxy_id_; | 99 const std::string& proxy_id_; |
98 // The OAuth2 refresh token for the robot. | 100 // The OAuth2 refresh token for the robot. |
99 std::string refresh_token_; | 101 std::string refresh_token_; |
100 // The email address of the user. This is only used during initial | 102 // The email address of the user. This is only used during initial |
101 // authentication with an LSID. This is only used for storing in prefs for | 103 // authentication with an LSID. This is only used for storing in prefs for |
102 // display purposes. | 104 // display purposes. |
103 std::string user_email_; | 105 std::string user_email_; |
104 // The email address of the robot account. | 106 // The email address of the robot account. |
105 std::string robot_email_; | 107 std::string robot_email_; |
106 // client login token used to authenticate request to cloud print server to | 108 // client login token used to authenticate request to cloud print server to |
107 // get the robot account. | 109 // get the robot account. |
108 std::string client_login_token_; | 110 std::string client_login_token_; |
109 | 111 |
110 DISALLOW_COPY_AND_ASSIGN(CloudPrintAuth); | 112 DISALLOW_COPY_AND_ASSIGN(CloudPrintAuth); |
111 }; | 113 }; |
112 | 114 |
113 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ | 115 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_AUTH_H_ |
114 | 116 |
OLD | NEW |