OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_EXTENSIONS_API_LOCATION_LOCATION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_LOCATION_LOCATION_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_LOCATION_LOCATION_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_LOCATION_LOCATION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/weak_ptr.h" | |
12 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
14 #include "extensions/browser/browser_context_keyed_api_factory.h" | 13 #include "extensions/browser/browser_context_keyed_api_factory.h" |
15 | 14 |
16 class Profile; | 15 class Profile; |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 class BrowserContext; | 18 class BrowserContext; |
20 struct Geoposition; | 19 struct Geoposition; |
21 } // namespace content | 20 } // namespace content |
22 | 21 |
23 namespace extensions { | 22 namespace extensions { |
24 class LocationManager; | 23 class LocationManager; |
25 class LocationRequest; | 24 class LocationRequest; |
26 | 25 |
27 namespace api { | 26 namespace api { |
28 namespace location { | 27 namespace location { |
29 | 28 |
30 struct Coordinates; | 29 struct Coordinates; |
31 | 30 |
32 } // namespace location | 31 } // namespace location |
33 } // namespace api | 32 } // namespace api |
34 | 33 |
35 // Profile's manager of all location watch requests created by chrome.location | 34 // Profile's manager of all location watch requests created by chrome.location |
36 // API. Lives in the UI thread. | 35 // API. Lives in the UI thread. |
37 class LocationManager : public BrowserContextKeyedAPI, | 36 class LocationManager : public BrowserContextKeyedAPI, |
38 public content::NotificationObserver, | 37 public content::NotificationObserver { |
39 public base::SupportsWeakPtr<LocationManager> { | |
40 public: | 38 public: |
41 explicit LocationManager(content::BrowserContext* context); | 39 explicit LocationManager(content::BrowserContext* context); |
42 virtual ~LocationManager(); | 40 virtual ~LocationManager(); |
43 | 41 |
44 // Adds location request for the given extension, and starts the location | 42 // Adds location request for the given extension, and starts the location |
45 // tracking. | 43 // tracking. |
46 void AddLocationRequest( | 44 void AddLocationRequest( |
47 const std::string& extension_id, | 45 const std::string& extension_id, |
48 const std::string& request_name, | 46 const std::string& request_name, |
49 const double* distance_update_threshold_meters, | 47 const double* distance_update_threshold_meters, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 95 |
98 // Used for tracking registrations to profile's extensions events. | 96 // Used for tracking registrations to profile's extensions events. |
99 content::NotificationRegistrar registrar_; | 97 content::NotificationRegistrar registrar_; |
100 | 98 |
101 DISALLOW_COPY_AND_ASSIGN(LocationManager); | 99 DISALLOW_COPY_AND_ASSIGN(LocationManager); |
102 }; | 100 }; |
103 | 101 |
104 } // namespace extensions | 102 } // namespace extensions |
105 | 103 |
106 #endif // CHROME_BROWSER_EXTENSIONS_API_LOCATION_LOCATION_MANAGER_H_ | 104 #endif // CHROME_BROWSER_EXTENSIONS_API_LOCATION_LOCATION_MANAGER_H_ |
OLD | NEW |