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

Side by Side Diff: chrome/browser/intents/web_intents_registry.h

Issue 8417043: Add webkit_glue namespace. Improve some variable and test names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge error Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_INTENTS_WEB_INTENTS_REGISTRY_H_ 5 #ifndef CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_
6 #define CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ 6 #define CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/hash_tables.h" 9 #include "base/hash_tables.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/profiles/profile_keyed_service.h" 12 #include "chrome/browser/profiles/profile_keyed_service.h"
13 #include "chrome/browser/webdata/web_data_service.h" 13 #include "chrome/browser/webdata/web_data_service.h"
14 #include "webkit/glue/web_intent_service_data.h" 14 #include "webkit/glue/web_intent_service_data.h"
15 15
16 // Handles storing and retrieving of web intents in the web database. 16 // Handles storing and retrieving of web intents in the web database.
17 // The registry provides filtering logic to retrieve specific types of intents. 17 // The registry provides filtering logic to retrieve specific types of intents.
18 class WebIntentsRegistry 18 class WebIntentsRegistry
19 : public WebDataServiceConsumer, 19 : public WebDataServiceConsumer,
20 public ProfileKeyedService { 20 public ProfileKeyedService {
21 public: 21 public:
22 // Unique identifier for intent queries. 22 // Unique identifier for intent queries.
23 typedef int QueryID; 23 typedef int QueryID;
24 24
25 typedef std::vector<WebIntentServiceData> IntentList; 25 typedef std::vector<webkit_glue::WebIntentServiceData> IntentServiceList;
26 26
27 // An interface the WebIntentsRegistry uses to notify its clients when 27 // An interface the WebIntentsRegistry uses to notify its clients when
28 // it has finished loading intents data from the web database. 28 // it has finished loading intents data from the web database.
29 class Consumer { 29 class Consumer {
30 public: 30 public:
31 // Notifies the observer that the intents request has been completed. 31 // Notifies the observer that the intents request has been completed.
32 virtual void OnIntentsQueryDone( 32 virtual void OnIntentsQueryDone(
33 QueryID query_id, 33 QueryID query_id,
34 const IntentList& intents) = 0; 34 const IntentServiceList& intents) = 0;
35 35
36 protected: 36 protected:
37 virtual ~Consumer() {} 37 virtual ~Consumer() {}
38 }; 38 };
39 39
40 // Initializes, binds to a valid WebDataService. 40 // Initializes, binds to a valid WebDataService.
41 void Initialize(scoped_refptr<WebDataService> wds, 41 void Initialize(scoped_refptr<WebDataService> wds,
42 ExtensionServiceInterface* extension_service); 42 ExtensionServiceInterface* extension_service);
43 43
44 // Registers a web intent provider. 44 // Registers a web intent provider.
45 virtual void RegisterIntentProvider(const WebIntentServiceData& intent); 45 virtual void RegisterIntentProvider(
46 const webkit_glue::WebIntentServiceData& intent);
46 47
47 // Removes a web intent provider from the registry. 48 // Removes a web intent provider from the registry.
48 void UnregisterIntentProvider(const WebIntentServiceData& intent); 49 void UnregisterIntentProvider(
50 const webkit_glue::WebIntentServiceData& intent);
49 51
50 // Requests all intent providers matching |action| and |mimetype|. 52 // Requests all intent providers matching |action| and |mimetype|.
51 // |mimetype| can contain wildcards, i.e. "image/*" or "*". 53 // |mimetype| can contain wildcards, i.e. "image/*" or "*".
52 // |consumer| must not be NULL. 54 // |consumer| must not be NULL.
53 QueryID GetIntentProviders(const string16& action, 55 QueryID GetIntentProviders(const string16& action,
54 const string16& mimetype, 56 const string16& mimetype,
55 Consumer* consumer); 57 Consumer* consumer);
56 58
57 // Requests all intent providers. |consumer| must not be NULL 59 // Requests all intent providers. |consumer| must not be NULL
58 QueryID GetAllIntentProviders(Consumer* consumer); 60 QueryID GetAllIntentProviders(Consumer* consumer);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any 93 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any
92 // ProfileKeyedService will be shut down before data on ProfileImpl is 94 // ProfileKeyedService will be shut down before data on ProfileImpl is
93 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid 95 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid
94 // for the lifetime of the WebIntentsRegistry object. 96 // for the lifetime of the WebIntentsRegistry object.
95 ExtensionServiceInterface* extension_service_; 97 ExtensionServiceInterface* extension_service_;
96 98
97 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); 99 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry);
98 }; 100 };
99 101
100 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ 102 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698