diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-21 15:04:47 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-21 15:04:47 +0000 |
commit | c8c77183bf200f031954e3f4aebf8881ec3fc41d (patch) | |
tree | a960fb1196852b8d15932334228fe0a5539f45ed | |
parent | ecf1acef2857dbe88f28d6a722b4cab3d8045f1d (diff) | |
download | chromium_src-c8c77183bf200f031954e3f4aebf8881ec3fc41d.zip chromium_src-c8c77183bf200f031954e3f4aebf8881ec3fc41d.tar.gz chromium_src-c8c77183bf200f031954e3f4aebf8881ec3fc41d.tar.bz2 |
Move AccessTokenStore to Content API, now that it is a pure-virtual class.
BUG=98716
Review URL: http://codereview.chromium.org/8997008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115335 0039d316-1c4b-4281-b951-d872f2087c98
23 files changed, 76 insertions, 27 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index bbdd8fb..7269b0a 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -135,6 +135,7 @@ #include "content/browser/renderer_host/render_widget_host_view_mac.h" #endif +using content::AccessTokenStore; using content::BrowserThread; namespace { diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 243b804..16097cd 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -125,7 +125,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { virtual MHTMLGenerationManager* GetMHTMLGenerationManager() OVERRIDE; virtual net::NetLog* GetNetLog() OVERRIDE; virtual speech_input::SpeechInputManager* GetSpeechInputManager() OVERRIDE; - virtual AccessTokenStore* CreateAccessTokenStore() OVERRIDE; + virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE; virtual bool IsFastShutdownPossible() OVERRIDE; virtual WebPreferences GetWebkitPrefs(RenderViewHost* rvh) OVERRIDE; virtual void UpdateInspectorSetting(RenderViewHost* rvh, diff --git a/chrome/browser/geolocation/access_token_store_browsertest.cc b/chrome/browser/geolocation/access_token_store_browsertest.cc index b9ede22..2fd5fa9 100644 --- a/chrome/browser/geolocation/access_token_store_browsertest.cc +++ b/chrome/browser/geolocation/access_token_store_browsertest.cc @@ -10,7 +10,9 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/test/test_browser_thread.h" +#include "content/public/browser/access_token_store.h" +using content::AccessTokenStore; using content::BrowserThread; namespace { diff --git a/chrome/browser/geolocation/chrome_access_token_store.cc b/chrome/browser/geolocation/chrome_access_token_store.cc index fb0c281..7a23269 100644 --- a/chrome/browser/geolocation/chrome_access_token_store.cc +++ b/chrome/browser/geolocation/chrome_access_token_store.cc @@ -15,6 +15,7 @@ #include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" +using content::AccessTokenStore; using content::BrowserThread; namespace { diff --git a/chrome/browser/geolocation/chrome_access_token_store.h b/chrome/browser/geolocation/chrome_access_token_store.h index 49c143e..dacd0ec 100644 --- a/chrome/browser/geolocation/chrome_access_token_store.h +++ b/chrome/browser/geolocation/chrome_access_token_store.h @@ -7,12 +7,12 @@ #pragma once #include "base/memory/ref_counted.h" -#include "content/browser/geolocation/access_token_store.h" +#include "content/public/browser/access_token_store.h" class PrefService; // Creates a new access token store backed by the global chome prefs. -class ChromeAccessTokenStore : public AccessTokenStore { +class ChromeAccessTokenStore : public content::AccessTokenStore { public: static void RegisterPrefs(PrefService* prefs); diff --git a/content/browser/geolocation/arbitrator_dependency_factories_for_test.cc b/content/browser/geolocation/arbitrator_dependency_factories_for_test.cc index 210d6139..8b2f700 100644 --- a/content/browser/geolocation/arbitrator_dependency_factories_for_test.cc +++ b/content/browser/geolocation/arbitrator_dependency_factories_for_test.cc @@ -4,6 +4,8 @@ #include "content/browser/geolocation/arbitrator_dependency_factories_for_test.h" +using content::AccessTokenStore; + GeolocationArbitratorDependencyFactoryWithLocationProvider:: GeolocationArbitratorDependencyFactoryWithLocationProvider( LocationProviderFactoryFunction factory_function) diff --git a/content/browser/geolocation/arbitrator_dependency_factories_for_test.h b/content/browser/geolocation/arbitrator_dependency_factories_for_test.h index a28719d..8e0e18f 100644 --- a/content/browser/geolocation/arbitrator_dependency_factories_for_test.h +++ b/content/browser/geolocation/arbitrator_dependency_factories_for_test.h @@ -18,7 +18,7 @@ class GeolocationArbitratorDependencyFactoryWithLocationProvider virtual ~GeolocationArbitratorDependencyFactoryWithLocationProvider(); virtual LocationProviderBase* NewNetworkLocationProvider( - AccessTokenStore* access_token_store, + content::AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, const string16& access_token) OVERRIDE; diff --git a/content/browser/geolocation/arbitrator_dependency_factory.cc b/content/browser/geolocation/arbitrator_dependency_factory.cc index 88fccfc..0be268e 100644 --- a/content/browser/geolocation/arbitrator_dependency_factory.cc +++ b/content/browser/geolocation/arbitrator_dependency_factory.cc @@ -5,10 +5,12 @@ #include "content/browser/geolocation/arbitrator_dependency_factory.h" #include "base/time.h" -#include "content/browser/geolocation/access_token_store.h" #include "content/browser/geolocation/location_provider.h" +#include "content/public/browser/access_token_store.h" #include "content/public/browser/content_browser_client.h" +using content::AccessTokenStore; + // GeolocationArbitratorDependencyFactory GeolocationArbitratorDependencyFactory:: ~GeolocationArbitratorDependencyFactory() { diff --git a/content/browser/geolocation/arbitrator_dependency_factory.h b/content/browser/geolocation/arbitrator_dependency_factory.h index 2aaf4aa..3d3de98 100644 --- a/content/browser/geolocation/arbitrator_dependency_factory.h +++ b/content/browser/geolocation/arbitrator_dependency_factory.h @@ -10,7 +10,6 @@ #include "base/string16.h" #include "content/common/content_export.h" -class AccessTokenStore; class GURL; class LocationProviderBase; @@ -18,6 +17,10 @@ namespace base { class Time; } +namespace content { +class AccessTokenStore; +} + namespace net { class URLRequestContextGetter; } @@ -31,9 +34,9 @@ class CONTENT_EXPORT GeolocationArbitratorDependencyFactory typedef base::Time (*GetTimeNow)(); virtual GetTimeNow GetTimeFunction() = 0; - virtual AccessTokenStore* NewAccessTokenStore() = 0; + virtual content::AccessTokenStore* NewAccessTokenStore() = 0; virtual LocationProviderBase* NewNetworkLocationProvider( - AccessTokenStore* access_token_store, + content::AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, const string16& access_token) = 0; @@ -51,9 +54,9 @@ class CONTENT_EXPORT DefaultGeolocationArbitratorDependencyFactory public: // GeolocationArbitratorDependencyFactory virtual GetTimeNow GetTimeFunction() OVERRIDE; - virtual AccessTokenStore* NewAccessTokenStore() OVERRIDE; + virtual content::AccessTokenStore* NewAccessTokenStore() OVERRIDE; virtual LocationProviderBase* NewNetworkLocationProvider( - AccessTokenStore* access_token_store, + content::AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, const string16& access_token) OVERRIDE; diff --git a/content/browser/geolocation/fake_access_token_store.cc b/content/browser/geolocation/fake_access_token_store.cc index 257c8e5..6e7a523 100644 --- a/content/browser/geolocation/fake_access_token_store.cc +++ b/content/browser/geolocation/fake_access_token_store.cc @@ -13,6 +13,8 @@ using base::MessageLoopProxy; using testing::_; using testing::Invoke; +namespace content { + FakeAccessTokenStore::FakeAccessTokenStore() : originating_message_loop_(NULL) { ON_CALL(*this, LoadAccessTokens(_)) @@ -49,3 +51,5 @@ void FakeAccessTokenStore::DefaultSaveAccessToken( } FakeAccessTokenStore::~FakeAccessTokenStore() {} + +} // namespace content diff --git a/content/browser/geolocation/fake_access_token_store.h b/content/browser/geolocation/fake_access_token_store.h index 4426e59..a5e0700 100644 --- a/content/browser/geolocation/fake_access_token_store.h +++ b/content/browser/geolocation/fake_access_token_store.h @@ -7,10 +7,12 @@ #pragma once #include "base/message_loop_proxy.h" -#include "content/browser/geolocation/access_token_store.h" +#include "content/public/browser/access_token_store.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +namespace content { + // A fake (non-persisted) access token store instance useful for testing. class FakeAccessTokenStore : public AccessTokenStore { public: @@ -43,4 +45,6 @@ class FakeAccessTokenStore : public AccessTokenStore { DISALLOW_COPY_AND_ASSIGN(FakeAccessTokenStore); }; +} // namespace content + #endif // CONTENT_BROWSER_GEOLOCATION_FAKE_ACCESS_TOKEN_STORE_H_ diff --git a/content/browser/geolocation/geolocation_provider_unittest.cc b/content/browser/geolocation/geolocation_provider_unittest.cc index 089de94..b214f01 100644 --- a/content/browser/geolocation/geolocation_provider_unittest.cc +++ b/content/browser/geolocation/geolocation_provider_unittest.cc @@ -12,6 +12,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using content::AccessTokenStore; +using content::FakeAccessTokenStore; using testing::_; using testing::DoAll; using testing::DoDefault; diff --git a/content/browser/geolocation/location_arbitrator.cc b/content/browser/geolocation/location_arbitrator.cc index 1c06244..4927a04c 100644 --- a/content/browser/geolocation/location_arbitrator.cc +++ b/content/browser/geolocation/location_arbitrator.cc @@ -9,6 +9,9 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "content/browser/geolocation/arbitrator_dependency_factory.h" +#include "content/public/browser/access_token_store.h" + +using content::AccessTokenStore; namespace { diff --git a/content/browser/geolocation/location_arbitrator.h b/content/browser/geolocation/location_arbitrator.h index 68d6e11..bf9efe0 100644 --- a/content/browser/geolocation/location_arbitrator.h +++ b/content/browser/geolocation/location_arbitrator.h @@ -9,19 +9,22 @@ #include "base/memory/scoped_vector.h" #include "base/string16.h" #include "base/time.h" -#include "content/browser/geolocation/access_token_store.h" #include "content/browser/geolocation/location_provider.h" #include "content/browser/geolocation/geolocation_observer.h" #include "content/common/content_export.h" #include "content/common/geoposition.h" +#include "content/public/browser/access_token_store.h" #include "googleurl/src/gurl.h" #include "net/url_request/url_request_context_getter.h" -class AccessTokenStore; class GeolocationArbitratorDependencyFactory; class GURL; class LocationProviderBase; +namespace content { +class AccessTokenStore; +} + namespace net { class URLRequestContextGetter; } @@ -77,7 +80,7 @@ class CONTENT_EXPORT GeolocationArbitrator // |providers_| or deleted on error (e.g. it fails to start). void RegisterProvider(LocationProviderBase* provider); void OnAccessTokenStoresLoaded( - AccessTokenStore::AccessTokenSet access_token_store, + content::AccessTokenStore::AccessTokenSet access_token_store, net::URLRequestContextGetter* context_getter); void DoStartProviders(); // Returns true if |new_position| is an improvement over |old_position|. @@ -88,7 +91,7 @@ class CONTENT_EXPORT GeolocationArbitrator bool from_same_provider) const; scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory_; - scoped_refptr<AccessTokenStore> access_token_store_; + scoped_refptr<content::AccessTokenStore> access_token_store_; GetTimeNow get_time_now_; GeolocationObserver* observer_; ScopedVector<LocationProviderBase> providers_; diff --git a/content/browser/geolocation/location_arbitrator_unittest.cc b/content/browser/geolocation/location_arbitrator_unittest.cc index f730dc5..432cb12 100644 --- a/content/browser/geolocation/location_arbitrator_unittest.cc +++ b/content/browser/geolocation/location_arbitrator_unittest.cc @@ -12,6 +12,9 @@ #include "content/common/geoposition.h" #include "testing/gtest/include/gtest/gtest.h" +using content::AccessTokenStore; +using content::FakeAccessTokenStore; + namespace { class MockLocationObserver : public GeolocationObserver { diff --git a/content/browser/geolocation/location_provider.h b/content/browser/geolocation/location_provider.h index b282527..f0f666c 100644 --- a/content/browser/geolocation/location_provider.h +++ b/content/browser/geolocation/location_provider.h @@ -19,10 +19,13 @@ #include "base/threading/non_thread_safe.h" #include "content/common/content_export.h" -class AccessTokenStore; struct Geoposition; class GURL; +namespace content { +class AccessTokenStore; +} + namespace net { class URLRequestContextGetter; } @@ -93,7 +96,7 @@ class CONTENT_EXPORT LocationProviderBase // Factory functions for the various types of location provider to abstract // over the platform-dependent implementations. CONTENT_EXPORT LocationProviderBase* NewNetworkLocationProvider( - AccessTokenStore* access_token_store, + content::AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, const string16& access_token); diff --git a/content/browser/geolocation/network_location_provider.cc b/content/browser/geolocation/network_location_provider.cc index 3041300..d4c83fe 100644 --- a/content/browser/geolocation/network_location_provider.cc +++ b/content/browser/geolocation/network_location_provider.cc @@ -7,7 +7,9 @@ #include "base/bind.h" #include "base/time.h" #include "base/utf_string_conversions.h" -#include "content/browser/geolocation/access_token_store.h" +#include "content/public/browser/access_token_store.h" + +using content::AccessTokenStore; namespace { // The maximum period of time we'll wait for a complete set of device data diff --git a/content/browser/geolocation/network_location_provider.h b/content/browser/geolocation/network_location_provider.h index 8f6e360..787adb6 100644 --- a/content/browser/geolocation/network_location_provider.h +++ b/content/browser/geolocation/network_location_provider.h @@ -21,6 +21,10 @@ #include "content/common/content_export.h" #include "content/common/geoposition.h" +namespace content { +class AccessTokenStore; +} + class NetworkLocationProvider : public LocationProviderBase, public RadioDataProvider::ListenerInterface, @@ -64,7 +68,7 @@ class NetworkLocationProvider CacheAgeList cache_age_list_; // Oldest first. }; - NetworkLocationProvider(AccessTokenStore* access_token_store, + NetworkLocationProvider(content::AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, const string16& access_token); @@ -97,7 +101,7 @@ class NetworkLocationProvider const RadioData& radio_data, const WifiData& wifi_data) OVERRIDE; - scoped_refptr<AccessTokenStore> access_token_store_; + scoped_refptr<content::AccessTokenStore> access_token_store_; // The device data providers, acquired via global factories. RadioDataProvider* radio_data_provider_; diff --git a/content/browser/geolocation/network_location_provider_unittest.cc b/content/browser/geolocation/network_location_provider_unittest.cc index 0a446b4..ae75a73 100644 --- a/content/browser/geolocation/network_location_provider_unittest.cc +++ b/content/browser/geolocation/network_location_provider_unittest.cc @@ -15,6 +15,8 @@ #include "net/url_request/url_request_status.h" #include "testing/gtest/include/gtest/gtest.h" +using content::FakeAccessTokenStore; + namespace { // Constants used in multiple tests. diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 2cb61fb..a3ebd47 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -25,6 +25,8 @@ '<(INTERMEDIATE_DIR)', ], 'sources': [ + 'public/browser/access_token_store.cc', + 'public/browser/access_token_store.h', 'public/browser/browser_context.h', 'public/browser/browser_main_parts.h', 'public/browser/browser_message_filter.cc', @@ -221,8 +223,6 @@ 'browser/gamepad/gamepad_provider.h', 'browser/gamepad/gamepad_service.cc', 'browser/gamepad/gamepad_service.h', - 'browser/geolocation/access_token_store.cc', - 'browser/geolocation/access_token_store.h', 'browser/geolocation/arbitrator_dependency_factory.cc', 'browser/geolocation/arbitrator_dependency_factory.h', 'browser/geolocation/core_location_data_provider_mac.h', diff --git a/content/browser/geolocation/access_token_store.cc b/content/public/browser/access_token_store.cc index 5345661..ba563f4 100644 --- a/content/browser/geolocation/access_token_store.cc +++ b/content/public/browser/access_token_store.cc @@ -2,10 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/geolocation/access_token_store.h" +#include "content/public/browser/access_token_store.h" + +namespace content { AccessTokenStore::AccessTokenStore() { } AccessTokenStore::~AccessTokenStore() { } + +} // namespace content diff --git a/content/browser/geolocation/access_token_store.h b/content/public/browser/access_token_store.h index 5fc2c57..1dfaabf 100644 --- a/content/browser/geolocation/access_token_store.h +++ b/content/public/browser/access_token_store.h @@ -10,8 +10,8 @@ // This API is provided as abstract base classes to allow mocking and testing // of clients, without dependency on browser process singleton objects etc. -#ifndef CONTENT_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_ -#define CONTENT_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_ +#ifndef CONTENT_PUBLIC_BROWSER_ACCESS_TOKEN_STORE_H_ +#define CONTENT_PUBLIC_BROWSER_ACCESS_TOKEN_STORE_H_ #pragma once #include <map> @@ -28,6 +28,8 @@ namespace net { class URLRequestContextGetter; } +namespace content { + // Provides storage for the access token used in the network request. class AccessTokenStore : public base::RefCountedThreadSafe<AccessTokenStore> { public: @@ -57,4 +59,6 @@ class AccessTokenStore : public base::RefCountedThreadSafe<AccessTokenStore> { DISALLOW_COPY_AND_ASSIGN(AccessTokenStore); }; -#endif // CONTENT_BROWSER_GEOLOCATION_ACCESS_TOKEN_STORE_H_ +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_ACCESS_TOKEN_STORE_H_ diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index d987fc0..17ac85a 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -14,7 +14,6 @@ #include "content/public/common/content_client.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresenter.h" -class AccessTokenStore; class BrowserURLHandler; class CommandLine; class FilePath; @@ -36,6 +35,7 @@ class WorkerProcessHost; struct WebPreferences; namespace content { +class AccessTokenStore; class BrowserMainParts; struct MainFunctionParams; struct ShowDesktopNotificationHostMsgParams; |