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

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

Issue 2028823002: Refactor to make BlimpLocationProvider accessible to content layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Makes testing override location provider accessible Created 4 years, 6 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_IMPL_H_ 5 #ifndef CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_
6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ 6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 27 matching lines...) Expand all
38 static const int64_t kFixStaleTimeoutMilliseconds; 38 static const int64_t kFixStaleTimeoutMilliseconds;
39 39
40 typedef base::Callback<void(const Geoposition&)> LocationUpdateCallback; 40 typedef base::Callback<void(const Geoposition&)> LocationUpdateCallback;
41 41
42 explicit LocationArbitratorImpl(const LocationUpdateCallback& callback); 42 explicit LocationArbitratorImpl(const LocationUpdateCallback& callback);
43 ~LocationArbitratorImpl() override; 43 ~LocationArbitratorImpl() override;
44 44
45 static GURL DefaultNetworkProviderURL(); 45 static GURL DefaultNetworkProviderURL();
46 46
47 // LocationArbitrator 47 // LocationArbitrator
48 void StartProviders(bool enable_high_accuracy) override; 48 void StartProviders(bool enable_high_accuracy, bool use_network) override;
49 void StopProviders() override; 49 void StopProviders() override;
50 void OnPermissionGranted() override; 50 void OnPermissionGranted() override;
51 bool HasPermissionBeenGranted() const override; 51 bool HasPermissionBeenGranted() const override;
52 52
53 protected: 53 protected:
54 AccessTokenStore* GetAccessTokenStore(); 54 AccessTokenStore* GetAccessTokenStore();
55 55
56 // These functions are useful for injection of dependencies in derived 56 // These functions are useful for injection of dependencies in derived
57 // testing classes. 57 // testing classes.
58 virtual AccessTokenStore* NewAccessTokenStore(); 58 virtual AccessTokenStore* NewAccessTokenStore();
59 virtual LocationProvider* NewNetworkLocationProvider( 59 virtual LocationProvider* NewNetworkLocationProvider(
60 AccessTokenStore* access_token_store, 60 AccessTokenStore* access_token_store,
61 net::URLRequestContextGetter* context, 61 net::URLRequestContextGetter* context,
62 const GURL& url, 62 const GURL& url,
63 const base::string16& access_token); 63 const base::string16& access_token);
64 virtual LocationProvider* NewSystemLocationProvider(); 64 virtual LocationProvider* NewSystemLocationProvider();
65 virtual LocationProvider* GetOverrideSystemLocationProvider();
65 virtual base::Time GetTimeNow() const; 66 virtual base::Time GetTimeNow() const;
66 67
67 private: 68 private:
68 // Takes ownership of |provider| on entry; it will either be added to 69 // Takes ownership of |provider| on entry; it will either be added to
69 // |providers_| or deleted on error (e.g. it fails to start). 70 // |providers_| or deleted on error (e.g. it fails to start).
70 void RegisterProvider(LocationProvider* provider); 71 void RegisterProvider(LocationProvider* provider);
72 void RegisterSystemProvider();
71 void OnAccessTokenStoresLoaded( 73 void OnAccessTokenStoresLoaded(
72 AccessTokenStore::AccessTokenMap access_token_map, 74 AccessTokenStore::AccessTokenMap access_token_map,
73 net::URLRequestContextGetter* context_getter); 75 net::URLRequestContextGetter* context_getter);
74 void DoStartProviders(); 76 void DoStartProviders();
75 77
76 // Gets called when a provider has a new position. 78 // Gets called when a provider has a new position.
77 void OnLocationUpdate(const LocationProvider* provider, 79 void OnLocationUpdate(const LocationProvider* provider,
78 const Geoposition& new_position); 80 const Geoposition& new_position);
79 81
80 // Returns true if |new_position| is an improvement over |old_position|. 82 // Returns true if |new_position| is an improvement over |old_position|.
(...skipping 20 matching lines...) Expand all
101 DISALLOW_COPY_AND_ASSIGN(LocationArbitratorImpl); 103 DISALLOW_COPY_AND_ASSIGN(LocationArbitratorImpl);
102 }; 104 };
103 105
104 // Factory functions for the various types of location provider to abstract 106 // Factory functions for the various types of location provider to abstract
105 // over the platform-dependent implementations. 107 // over the platform-dependent implementations.
106 LocationProvider* NewSystemLocationProvider(); 108 LocationProvider* NewSystemLocationProvider();
107 109
108 } // namespace content 110 } // namespace content
109 111
110 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ 112 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698