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

Side by Side Diff: content/browser/geolocation/location_arbitrator.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
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 #ifndef CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ 5 #ifndef CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_
6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ 6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "content/browser/geolocation/access_token_store.h"
13 #include "content/browser/geolocation/location_provider.h" 12 #include "content/browser/geolocation/location_provider.h"
14 #include "content/browser/geolocation/geolocation_observer.h" 13 #include "content/browser/geolocation/geolocation_observer.h"
15 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
16 #include "content/common/geoposition.h" 15 #include "content/common/geoposition.h"
16 #include "content/public/browser/access_token_store.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "net/url_request/url_request_context_getter.h" 18 #include "net/url_request/url_request_context_getter.h"
19 19
20 class AccessTokenStore;
21 class GeolocationArbitratorDependencyFactory; 20 class GeolocationArbitratorDependencyFactory;
22 class GURL; 21 class GURL;
23 class LocationProviderBase; 22 class LocationProviderBase;
24 23
24 namespace content {
25 class AccessTokenStore;
26 }
27
25 namespace net { 28 namespace net {
26 class URLRequestContextGetter; 29 class URLRequestContextGetter;
27 } 30 }
28 31
29 struct Geoposition; 32 struct Geoposition;
30 33
31 // This class is responsible for handling updates from multiple underlying 34 // This class is responsible for handling updates from multiple underlying
32 // providers and resolving them to a single 'best' location fix at any given 35 // providers and resolving them to a single 'best' location fix at any given
33 // moment. 36 // moment.
34 class CONTENT_EXPORT GeolocationArbitrator 37 class CONTENT_EXPORT GeolocationArbitrator
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 virtual void LocationUpdateAvailable(LocationProviderBase* provider) OVERRIDE; 73 virtual void LocationUpdateAvailable(LocationProviderBase* provider) OVERRIDE;
71 74
72 private: 75 private:
73 GeolocationArbitrator( 76 GeolocationArbitrator(
74 GeolocationArbitratorDependencyFactory* dependency_factory, 77 GeolocationArbitratorDependencyFactory* dependency_factory,
75 GeolocationObserver* observer); 78 GeolocationObserver* observer);
76 // Takes ownership of |provider| on entry; it will either be added to 79 // Takes ownership of |provider| on entry; it will either be added to
77 // |providers_| or deleted on error (e.g. it fails to start). 80 // |providers_| or deleted on error (e.g. it fails to start).
78 void RegisterProvider(LocationProviderBase* provider); 81 void RegisterProvider(LocationProviderBase* provider);
79 void OnAccessTokenStoresLoaded( 82 void OnAccessTokenStoresLoaded(
80 AccessTokenStore::AccessTokenSet access_token_store, 83 content::AccessTokenStore::AccessTokenSet access_token_store,
81 net::URLRequestContextGetter* context_getter); 84 net::URLRequestContextGetter* context_getter);
82 void DoStartProviders(); 85 void DoStartProviders();
83 // Returns true if |new_position| is an improvement over |old_position|. 86 // Returns true if |new_position| is an improvement over |old_position|.
84 // Set |from_same_provider| to true if both the positions came from the same 87 // Set |from_same_provider| to true if both the positions came from the same
85 // provider. 88 // provider.
86 bool IsNewPositionBetter(const Geoposition& old_position, 89 bool IsNewPositionBetter(const Geoposition& old_position,
87 const Geoposition& new_position, 90 const Geoposition& new_position,
88 bool from_same_provider) const; 91 bool from_same_provider) const;
89 92
90 scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory_; 93 scoped_refptr<GeolocationArbitratorDependencyFactory> dependency_factory_;
91 scoped_refptr<AccessTokenStore> access_token_store_; 94 scoped_refptr<content::AccessTokenStore> access_token_store_;
92 GetTimeNow get_time_now_; 95 GetTimeNow get_time_now_;
93 GeolocationObserver* observer_; 96 GeolocationObserver* observer_;
94 ScopedVector<LocationProviderBase> providers_; 97 ScopedVector<LocationProviderBase> providers_;
95 GeolocationObserverOptions current_provider_options_; 98 GeolocationObserverOptions current_provider_options_;
96 // The provider which supplied the current |position_| 99 // The provider which supplied the current |position_|
97 const LocationProviderBase* position_provider_; 100 const LocationProviderBase* position_provider_;
98 GURL most_recent_authorized_frame_; 101 GURL most_recent_authorized_frame_;
99 // The current best estimate of our position. 102 // The current best estimate of our position.
100 Geoposition position_; 103 Geoposition position_;
101 104
102 DISALLOW_COPY_AND_ASSIGN(GeolocationArbitrator); 105 DISALLOW_COPY_AND_ASSIGN(GeolocationArbitrator);
103 }; 106 };
104 107
105 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_ 108 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_H_
OLDNEW
« no previous file with comments | « content/browser/geolocation/geolocation_provider_unittest.cc ('k') | content/browser/geolocation/location_arbitrator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698