| 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 // Defines the Geolocation access token store, and associated factory function. | 5 // Defines the Geolocation access token store, and associated factory function. |
| 6 // An access token store is responsible for providing the API to persist | 6 // An access token store is responsible for providing the API to persist |
| 7 // access tokens, one at a time, and to load them back on mass. | 7 // access tokens, one at a time, and to load them back on mass. |
| 8 // The API is a little more complex than one might wish, due to the need for | 8 // The API is a little more complex than one might wish, due to the need for |
| 9 // prefs access to happen asynchronously on the UI thread. | 9 // prefs access to happen asynchronously on the UI thread. |
| 10 // This API is provided as abstract base classes to allow mocking and testing | 10 // This API is provided as abstract base classes to allow mocking and testing |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 typedef std::map<GURL, string16> AccessTokenSet; | 38 typedef std::map<GURL, string16> AccessTokenSet; |
| 39 typedef Callback2<AccessTokenSet, net::URLRequestContextGetter*>::Type | 39 typedef Callback2<AccessTokenSet, net::URLRequestContextGetter*>::Type |
| 40 LoadAccessTokensCallbackType; | 40 LoadAccessTokensCallbackType; |
| 41 // |callback| will be invoked once per LoadAccessTokens call, after existing | 41 // |callback| will be invoked once per LoadAccessTokens call, after existing |
| 42 // access tokens have been loaded from persistent store. As a convenience the | 42 // access tokens have been loaded from persistent store. As a convenience the |
| 43 // URLRequestContextGetter is also supplied as an argument in |callback|, as | 43 // URLRequestContextGetter is also supplied as an argument in |callback|, as |
| 44 // in Chrome the call to obtain this must also be performed on the UI thread | 44 // in Chrome the call to obtain this must also be performed on the UI thread |
| 45 // so it is efficient to piggyback it onto this request. | 45 // so it is efficient to piggyback it onto this request. |
| 46 // Takes ownership of |callback|. | 46 // Takes ownership of |callback|. |
| 47 // Returns a handle which can subsequently be used with CancelRequest(). | 47 // Returns a handle which can subsequently be used with CancelRequest(). |
| 48 Handle LoadAccessTokens(CancelableRequestConsumerBase* consumer, | 48 CONTENT_EXPORT Handle LoadAccessTokens( |
| 49 LoadAccessTokensCallbackType* callback); | 49 CancelableRequestConsumerBase* consumer, |
| 50 LoadAccessTokensCallbackType* callback); |
| 50 | 51 |
| 51 virtual void SaveAccessToken( | 52 virtual void SaveAccessToken( |
| 52 const GURL& server_url, const string16& access_token) = 0; | 53 const GURL& server_url, const string16& access_token) = 0; |
| 53 | 54 |
| 54 protected: | 55 protected: |
| 55 friend class base::RefCountedThreadSafe<AccessTokenStore>; | 56 friend class base::RefCountedThreadSafe<AccessTokenStore>; |
| 56 CONTENT_EXPORT AccessTokenStore(); | 57 CONTENT_EXPORT AccessTokenStore(); |
| 57 CONTENT_EXPORT virtual ~AccessTokenStore(); | 58 CONTENT_EXPORT virtual ~AccessTokenStore(); |
| 58 | 59 |
| 59 virtual void DoLoadAccessTokens( | 60 virtual void DoLoadAccessTokens( |
| 60 scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > req) = 0; | 61 scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > req) = 0; |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(AccessTokenStore); | 64 DISALLOW_COPY_AND_ASSIGN(AccessTokenStore); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 #endif // CONTENT_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_ | 67 #endif // CONTENT_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_ |
| OLD | NEW |