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

Side by Side Diff: chrome/browser/chromeos/settings/device_oauth2_token_service.h

Issue 892633003: Do not announce robot account token before account ID is available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/browser/chromeos/settings/cros_settings.h"
18 #include "google_apis/gaia/gaia_oauth_client.h" 19 #include "google_apis/gaia/gaia_oauth_client.h"
19 #include "google_apis/gaia/oauth2_token_service.h" 20 #include "google_apis/gaia/oauth2_token_service.h"
20 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
21 22
22 namespace gaia { 23 namespace gaia {
23 class GaiaOAuthClient; 24 class GaiaOAuthClient;
24 } 25 }
25 26
26 namespace net { 27 namespace net {
27 class URLRequestContextGetter; 28 class URLRequestContextGetter;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // System salt loaded, validation not started yet. 98 // System salt loaded, validation not started yet.
98 STATE_VALIDATION_PENDING, 99 STATE_VALIDATION_PENDING,
99 // Refresh token validation underway. 100 // Refresh token validation underway.
100 STATE_VALIDATION_STARTED, 101 STATE_VALIDATION_STARTED,
101 // Token validation failed. 102 // Token validation failed.
102 STATE_TOKEN_INVALID, 103 STATE_TOKEN_INVALID,
103 // Refresh token is valid. 104 // Refresh token is valid.
104 STATE_TOKEN_VALID, 105 STATE_TOKEN_VALID,
105 }; 106 };
106 107
108 // Invoked by CrosSettings when the robot account ID becomes available.
109 void OnServiceAccountIdentityChanged();
110
107 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class. 111 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class.
108 // Ownership of |token_encryptor| will be taken. 112 // Ownership of |token_encryptor| will be taken.
109 explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter, 113 explicit DeviceOAuth2TokenService(net::URLRequestContextGetter* getter,
110 PrefService* local_state); 114 PrefService* local_state);
111 ~DeviceOAuth2TokenService() override; 115 ~DeviceOAuth2TokenService() override;
112 116
113 // Returns the refresh token for account_id. 117 // Returns the refresh token for account_id.
114 std::string GetRefreshToken(const std::string& account_id) const; 118 std::string GetRefreshToken(const std::string& account_id) const;
115 119
116 // Handles completion of the system salt input. 120 // Handles completion of the system salt input.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // The system salt for encrypting and decrypting the refresh token. 158 // The system salt for encrypting and decrypting the refresh token.
155 std::string system_salt_; 159 std::string system_salt_;
156 160
157 int max_refresh_token_validation_retries_; 161 int max_refresh_token_validation_retries_;
158 162
159 // Cache the decrypted refresh token, so we only decrypt once. 163 // Cache the decrypted refresh token, so we only decrypt once.
160 std::string refresh_token_; 164 std::string refresh_token_;
161 165
162 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; 166 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_;
163 167
168 scoped_ptr<CrosSettings::ObserverSubscription>
169 service_account_identity_subscription_;
170
164 base::WeakPtrFactory<DeviceOAuth2TokenService> weak_ptr_factory_; 171 base::WeakPtrFactory<DeviceOAuth2TokenService> weak_ptr_factory_;
165 172
166 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); 173 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService);
167 }; 174 };
168 175
169 } // namespace chromeos 176 } // namespace chromeos
170 177
171 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ 178 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698