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

Side by Side Diff: content/browser/geolocation/access_token_store.h

Issue 8997008: Move AccessTokenStore to Content API, now that it is a pure-virtual class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head (pure merge). Created 9 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Defines the Geolocation access token store, and associated factory function.
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.
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.
10 // This API is provided as abstract base classes to allow mocking and testing
11 // of clients, without dependency on browser process singleton objects etc.
12
13 #ifndef CONTENT_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_
14 #define CONTENT_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_
15 #pragma once
16
17 #include <map>
18
19 #include "base/callback.h"
20 #include "base/memory/ref_counted.h"
21 #include "base/string16.h"
22 #include "content/common/content_export.h"
23 #include "googleurl/src/gurl.h"
24
25 class GURL;
26
27 namespace net {
28 class URLRequestContextGetter;
29 }
30
31 // Provides storage for the access token used in the network request.
32 class AccessTokenStore : public base::RefCountedThreadSafe<AccessTokenStore> {
33 public:
34 // Map of server URLs to associated access token.
35 typedef std::map<GURL, string16> AccessTokenSet;
36 typedef base::Callback<void(AccessTokenSet, net::URLRequestContextGetter*)>
37 LoadAccessTokensCallbackType;
38
39 // |callback| will be invoked once per LoadAccessTokens call, after existing
40 // access tokens have been loaded from persistent store. As a convenience the
41 // URLRequestContextGetter is also supplied as an argument in |callback|, as
42 // in Chrome the call to obtain this must also be performed on the UI thread
43 // so it is efficient to piggyback it onto this request.
44 // Takes ownership of |callback|.
45 CONTENT_EXPORT virtual void LoadAccessTokens(
46 const LoadAccessTokensCallbackType& callback) = 0;
47
48 virtual void SaveAccessToken(
49 const GURL& server_url, const string16& access_token) = 0;
50
51 protected:
52 friend class base::RefCountedThreadSafe<AccessTokenStore>;
53 CONTENT_EXPORT AccessTokenStore();
54 CONTENT_EXPORT virtual ~AccessTokenStore();
55
56 private:
57 DISALLOW_COPY_AND_ASSIGN(AccessTokenStore);
58 };
59
60 #endif // CONTENT_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/chrome_access_token_store.cc ('k') | content/browser/geolocation/access_token_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698