[email protected] | 8b96de12 | 2010-02-15 15:15:22 | [diff] [blame^] | 1 | // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_ |
| 6 | #define CHROME_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_ |
| 7 | |
| 8 | #include "base/ref_counted.h" |
| 9 | #include "base/string16.h" |
| 10 | |
| 11 | class GURL; |
| 12 | class PrefService; |
| 13 | |
| 14 | // Provides storage for the access token used in the network request. |
| 15 | // Provided to allow for mocking for testing, by decoupling deep browser |
| 16 | // dependencies (singleton prefs & threads) from the geolocaiton object. |
| 17 | class AccessTokenStore : public base::RefCounted<AccessTokenStore> { |
| 18 | public: |
| 19 | static void RegisterPrefs(PrefService* prefs); |
| 20 | |
| 21 | virtual bool SetAccessToken(const GURL& url, |
| 22 | const string16& access_token) = 0; |
| 23 | virtual bool GetAccessToken(const GURL& url, string16* access_token) = 0; |
| 24 | |
| 25 | protected: |
| 26 | friend class base::RefCounted<AccessTokenStore>; |
| 27 | virtual ~AccessTokenStore() {} |
| 28 | }; |
| 29 | |
| 30 | // Creates a new access token store backed by the global chome prefs. |
| 31 | AccessTokenStore* NewChromePrefsAccessTokenStore(); |
| 32 | |
| 33 | #endif // CHROME_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_ |