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

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

Issue 2685123002: Make OAuth2TokenService and subclasses take delegate by unique_ptr (Closed)
Patch Set: Created 3 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
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 private: 60 private:
61 friend class DeviceOAuth2TokenServiceFactory; 61 friend class DeviceOAuth2TokenServiceFactory;
62 friend class DeviceOAuth2TokenServiceTest; 62 friend class DeviceOAuth2TokenServiceTest;
63 struct PendingRequest; 63 struct PendingRequest;
64 64
65 // Implementation of 65 // Implementation of
66 // DeviceOAuth2TokenServiceDelegate::ValidationStatusDelegate. 66 // DeviceOAuth2TokenServiceDelegate::ValidationStatusDelegate.
67 void OnValidationCompleted(GoogleServiceAuthError::State error) override; 67 void OnValidationCompleted(GoogleServiceAuthError::State error) override;
68 68
69 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class. 69 // Use DeviceOAuth2TokenServiceFactory to get an instance of this class.
70 // Ownership of |token_encryptor| will be taken. 70 explicit DeviceOAuth2TokenService(
71 explicit DeviceOAuth2TokenService(DeviceOAuth2TokenServiceDelegate* delegate); 71 std::unique_ptr<DeviceOAuth2TokenServiceDelegate> delegate);
72 ~DeviceOAuth2TokenService() override; 72 ~DeviceOAuth2TokenService() override;
73 73
74 // Flushes |pending_requests_|, indicating the specified result. 74 // Flushes |pending_requests_|, indicating the specified result.
75 void FlushPendingRequests(bool token_is_valid, 75 void FlushPendingRequests(bool token_is_valid,
76 GoogleServiceAuthError::State error); 76 GoogleServiceAuthError::State error);
77 77
78 // Signals failure on the specified request, passing |error| as the reason. 78 // Signals failure on the specified request, passing |error| as the reason.
79 void FailRequest(RequestImpl* request, GoogleServiceAuthError::State error); 79 void FailRequest(RequestImpl* request, GoogleServiceAuthError::State error);
80 80
81 DeviceOAuth2TokenServiceDelegate* GetDeviceDelegate();
82 const DeviceOAuth2TokenServiceDelegate* GetDeviceDelegate() const;
83
81 // Currently open requests that are waiting while loading the system salt or 84 // Currently open requests that are waiting while loading the system salt or
82 // validating the token. 85 // validating the token.
83 std::vector<PendingRequest*> pending_requests_; 86 std::vector<PendingRequest*> pending_requests_;
84 87
85 DeviceOAuth2TokenServiceDelegate* delegate_;
86
87 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService); 88 DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService);
88 }; 89 };
89 90
90 } // namespace chromeos 91 } // namespace chromeos
91 92
92 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ 93 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698