Index: chrome/browser/intents/web_intents_registry.h |
diff --git a/chrome/browser/intents/web_intents_registry.h b/chrome/browser/intents/web_intents_registry.h |
index 76c01dbd6b6fbf110f063ae8f95a4b6d472793ca..1fdae628c7c4219ccf67f1031d4e1b9e2f183b00 100644 |
--- a/chrome/browser/intents/web_intents_registry.h |
+++ b/chrome/browser/intents/web_intents_registry.h |
@@ -13,7 +13,9 @@ |
// Handles storing and retrieving of web intents in the web database. |
// The registry provides filtering logic to retrieve specific types of intents. |
-class WebIntentsRegistry : public WebDataServiceConsumer { |
+class WebIntentsRegistry |
+ : public WebDataServiceConsumer, |
+ public base::RefCountedThreadSafe<WebIntentsRegistry> { |
public: |
// Unique identifier for intent queries. |
typedef int QueryID; |
@@ -31,14 +33,11 @@ class WebIntentsRegistry : public WebDataServiceConsumer { |
virtual ~Consumer() {} |
}; |
- WebIntentsRegistry(); |
- virtual ~WebIntentsRegistry(); |
- |
// Initializes, binds to a valid WebDataService. |
void Initialize(scoped_refptr<WebDataService> wds); |
// Registers a web intent provider. |
- void RegisterIntentProvider(const WebIntentData& intent); |
+ virtual void RegisterIntentProvider(const WebIntentData& intent); |
groby-ooo-7-16
2011/08/09 01:58:15
Would you mind making the rest of the API virtual,
James Hawkins
2011/08/09 02:26:52
Hmm, I'd like to wait until tests are added for th
|
// Removes a web intent provider from the registry. |
void UnregisterIntentProvider(const WebIntentData& intent); |
@@ -47,11 +46,20 @@ class WebIntentsRegistry : public WebDataServiceConsumer { |
// |consumer| must not be NULL. |
QueryID GetIntentProviders(const string16& action, Consumer* consumer); |
+ protected: |
+ // Make sure that only Profile can create an instance of WebIntentsRegistry. |
+ friend class base::RefCountedThreadSafe<WebIntentsRegistry>; |
+ friend class ProfileImpl; |
+ friend class WebIntentsRegistryTest; |
+ |
+ WebIntentsRegistry(); |
+ virtual ~WebIntentsRegistry(); |
+ |
private: |
struct IntentsQuery; |
// Maps web data requests to intents queries. |
- // Allows OnWebDataServiceRequestDone to forward to appropiate consumer. |
+ // Allows OnWebDataServiceRequestDone to forward to appropriate consumer. |
typedef base::hash_map<WebDataService::Handle, IntentsQuery*> QueryMap; |
// WebDataServiceConsumer implementation. |