OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // A wifi data provider provides wifi data from the device that is used by a | 5 // A wifi data provider provides wifi data from the device that is used by a |
6 // NetworkLocationProvider to obtain a position fix. We use a singleton | 6 // NetworkLocationProvider to obtain a position fix. We use a singleton |
7 // instance of the wifi data provider manager, which is used by multiple | 7 // instance of the wifi data provider manager, which is used by multiple |
8 // NetworkLocationProvider objects. | 8 // NetworkLocationProvider objects. |
9 // | 9 // |
10 // This file provides WifiDataProviderManager, which provides static methods to | 10 // This file provides WifiDataProviderManager, which provides static methods to |
11 // access the singleton instance. The singleton instance uses a private | 11 // access the singleton instance. The singleton instance uses a private |
12 // implementation of WifiDataProvider to abstract across platforms and also to | 12 // implementation of WifiDataProvider to abstract across platforms and also to |
13 // allow mock providers to be used for testing. | 13 // allow mock providers to be used for testing. |
14 | 14 |
15 #ifndef DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_MANAGER_H_ | 15 #ifndef CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_MANAGER_H_ |
16 #define DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_MANAGER_H_ | 16 #define CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_MANAGER_H_ |
17 | 17 |
18 #include <set> | 18 #include <set> |
19 | 19 |
20 #include "base/bind.h" | 20 #include "base/bind.h" |
21 #include "base/callback.h" | 21 #include "base/callback.h" |
22 #include "base/macros.h" | 22 #include "base/macros.h" |
23 #include "base/memory/ref_counted.h" | 23 #include "base/memory/ref_counted.h" |
24 #include "base/strings/string16.h" | 24 #include "base/strings/string16.h" |
25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
26 #include "device/geolocation/geolocation_export.h" | 26 #include "content/browser/geolocation/wifi_data.h" |
27 #include "device/geolocation/wifi_data.h" | 27 #include "content/common/content_export.h" |
28 | 28 |
29 namespace device { | 29 namespace content { |
30 | 30 |
31 class WifiDataProvider; | 31 class WifiDataProvider; |
32 | 32 |
33 // A manager for wifi data providers. | 33 // A manager for wifi data providers. |
34 // | 34 // |
35 // We use a singleton instance of this class which is shared by multiple network | 35 // We use a singleton instance of this class which is shared by multiple network |
36 // location providers. These location providers access the instance through the | 36 // location providers. These location providers access the instance through the |
37 // Register and Unregister methods. | 37 // Register and Unregister methods. |
38 class DEVICE_GEOLOCATION_EXPORT WifiDataProviderManager { | 38 class CONTENT_EXPORT WifiDataProviderManager { |
39 public: | 39 public: |
40 typedef WifiDataProvider* (*ImplFactoryFunction)(void); | 40 typedef WifiDataProvider* (*ImplFactoryFunction)(void); |
41 | 41 |
42 // Sets the factory function which will be used by Register to create the | 42 // Sets the factory function which will be used by Register to create the |
43 // implementation used by the singleton instance. This factory approach is | 43 // implementation used by the singleton instance. This factory approach is |
44 // used both to abstract accross platform-specific implementations and to | 44 // used both to abstract accross platform-specific implementations and to |
45 // inject mock implementations for testing. | 45 // inject mock implementations for testing. |
46 static void SetFactoryForTesting(ImplFactoryFunction factory_function_in); | 46 static void SetFactoryForTesting(ImplFactoryFunction factory_function_in); |
47 | 47 |
48 // Resets the factory function to the default. | 48 // Resets the factory function to the default. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // The factory function used to create the singleton instance. | 86 // The factory function used to create the singleton instance. |
87 static ImplFactoryFunction factory_function_; | 87 static ImplFactoryFunction factory_function_; |
88 | 88 |
89 // The internal implementation. | 89 // The internal implementation. |
90 scoped_refptr<WifiDataProvider> impl_; | 90 scoped_refptr<WifiDataProvider> impl_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderManager); | 92 DISALLOW_COPY_AND_ASSIGN(WifiDataProviderManager); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace device | 95 } // namespace content |
96 | 96 |
97 #endif // DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_MANAGER_H_ | 97 #endif // CONTENT_BROWSER_GEOLOCATION_WIFI_DATA_PROVIDER_MANAGER_H_ |
OLD | NEW |