| OLD | NEW |
| 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 // Chromium settings and storage represent user-selected preferences and | 5 // Chromium settings and storage represent user-selected preferences and |
| 6 // information and MUST not be extracted, overwritten or modified except | 6 // information and MUST not be extracted, overwritten or modified except |
| 7 // through Chromium defined APIs. | 7 // through Chromium defined APIs. |
| 8 | 8 |
| 9 #ifndef CHROME_BROWSER_WEBDATA_TOKEN_WEB_DATA_H__ | 9 #ifndef CHROME_BROWSER_WEBDATA_TOKEN_WEB_DATA_H__ |
| 10 #define CHROME_BROWSER_WEBDATA_TOKEN_WEB_DATA_H__ | 10 #define CHROME_BROWSER_WEBDATA_TOKEN_WEB_DATA_H__ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 class BrowserContext; | 30 class BrowserContext; |
| 31 } | 31 } |
| 32 | 32 |
| 33 // TokenWebData is a data repository for storage of authentication tokens. | 33 // TokenWebData is a data repository for storage of authentication tokens. |
| 34 | 34 |
| 35 class TokenWebData : public WebDataServiceBase { | 35 class TokenWebData : public WebDataServiceBase { |
| 36 public: | 36 public: |
| 37 // Retrieve a WebDataService for the given context. | 37 // Retrieve a WebDataService for the given context. |
| 38 static scoped_refptr<TokenWebData> FromBrowserContext( | 38 static TokenWebData* FromBrowserContext(content::BrowserContext* context); |
| 39 content::BrowserContext* context); | |
| 40 | 39 |
| 41 TokenWebData(scoped_refptr<WebDatabaseService> wdbs, | 40 TokenWebData(scoped_refptr<WebDatabaseService> wdbs, |
| 42 const ProfileErrorCallback& callback); | 41 const ProfileErrorCallback& callback); |
| 43 | 42 |
| 43 virtual ~TokenWebData(); |
| 44 |
| 44 // Set a token to use for a specified service. | 45 // Set a token to use for a specified service. |
| 45 void SetTokenForService(const std::string& service, | 46 void SetTokenForService(const std::string& service, |
| 46 const std::string& token); | 47 const std::string& token); |
| 47 | 48 |
| 48 // Remove all tokens stored in the web database. | 49 // Remove all tokens stored in the web database. |
| 49 void RemoveAllTokens(); | 50 void RemoveAllTokens(); |
| 50 | 51 |
| 51 // Null on failure. Success is WDResult<std::vector<std::string> > | 52 // Null on failure. Success is WDResult<std::vector<std::string> > |
| 52 virtual Handle GetAllTokens(WebDataServiceConsumer* consumer); | 53 virtual Handle GetAllTokens(WebDataServiceConsumer* consumer); |
| 53 | 54 |
| 54 protected: | 55 protected: |
| 55 // For unit tests, passes a null callback. | 56 // For unit tests, passes a null callback. |
| 56 TokenWebData(); | 57 TokenWebData(); |
| 57 | 58 |
| 58 virtual ~TokenWebData(); | |
| 59 | |
| 60 private: | 59 private: |
| 61 scoped_refptr<TokenWebDataBackend> token_backend_; | 60 scoped_refptr<TokenWebDataBackend> token_backend_; |
| 62 | 61 |
| 63 DISALLOW_COPY_AND_ASSIGN(TokenWebData); | 62 DISALLOW_COPY_AND_ASSIGN(TokenWebData); |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 #endif // CHROME_BROWSER_WEBDATA_TOKEN_WEB_DATA_H__ | 65 #endif // CHROME_BROWSER_WEBDATA_TOKEN_WEB_DATA_H__ |
| OLD | NEW |