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

Unified Diff: chrome/browser/extensions/api/location/location_manager.h

Issue 330383003: Remove deprecated extension notifications from APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/location/location_manager.h
diff --git a/chrome/browser/extensions/api/location/location_manager.h b/chrome/browser/extensions/api/location/location_manager.h
index 233fa224f37d8baff7d4021dcff97f1882c97985..bca23e6066b292201972614c8a7707ce5ca40835 100644
--- a/chrome/browser/extensions/api/location/location_manager.h
+++ b/chrome/browser/extensions/api/location/location_manager.h
@@ -8,11 +8,9 @@
#include <map>
#include <string>
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
+#include "base/scoped_observer.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
-
-class Profile;
+#include "extensions/browser/extension_registry_observer.h"
namespace content {
class BrowserContext;
@@ -20,6 +18,7 @@ struct Geoposition;
} // namespace content
namespace extensions {
+class ExtensionRegistry;
class LocationManager;
class LocationRequest;
@@ -31,10 +30,11 @@ struct Coordinates;
} // namespace location
} // namespace api
-// Profile's manager of all location watch requests created by chrome.location
+// BrowserContext's manager of all location watch requests created by
+// chrome.location
Devlin 2014/06/17 16:28:31 nit: Fix line wrapping.
limasdf 2014/06/17 18:25:48 Sorry.
// API. Lives in the UI thread.
class LocationManager : public BrowserContextKeyedAPI,
- public content::NotificationObserver {
+ public ExtensionRegistryObserver {
public:
explicit LocationManager(content::BrowserContext* context);
virtual ~LocationManager();
@@ -55,7 +55,7 @@ class LocationManager : public BrowserContextKeyedAPI,
// BrowserContextKeyedAPI implementation.
static BrowserContextKeyedAPIFactory<LocationManager>* GetFactoryInstance();
- // Convenience method to get the LocationManager for a profile.
+ // Convenience method to get the LocationManager for a context.
static LocationManager* Get(content::BrowserContext* context);
private:
@@ -78,23 +78,25 @@ class LocationManager : public BrowserContextKeyedAPI,
const std::string& request_name,
const content::Geoposition& position);
- // NotificationObserver:
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
+ // ExtensionRegistryObserver implementation.
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
// BrowserContextKeyedAPI implementation.
static const char* service_name() { return "LocationManager"; }
- // Profile for this location manager.
- Profile* const profile_;
+ content::BrowserContext* const browser_context_;
// A map of our pending location requests, per extension.
// Invariant: None of the LocationRequestLists are empty.
LocationRequestMap location_requests_;
- // Used for tracking registrations to profile's extensions events.
- content::NotificationRegistrar registrar_;
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
DISALLOW_COPY_AND_ASSIGN(LocationManager);
};

Powered by Google App Engine
This is Rietveld 408576698