OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Requests all services. |consumer| must not be NULL | 70 // Requests all services. |consumer| must not be NULL |
71 QueryID GetAllIntentServices(Consumer* consumer); | 71 QueryID GetAllIntentServices(Consumer* consumer); |
72 | 72 |
73 // Tests for the existence of the given |service|. Calls the | 73 // Tests for the existence of the given |service|. Calls the |
74 // provided |callback| with true if it exists, false if it does not. | 74 // provided |callback| with true if it exists, false if it does not. |
75 // Checks for |service| equality with ==. | 75 // Checks for |service| equality with ==. |
76 QueryID IntentServiceExists( | 76 QueryID IntentServiceExists( |
77 const webkit_glue::WebIntentServiceData& service, | 77 const webkit_glue::WebIntentServiceData& service, |
78 const base::Callback<void(bool)>& callback); | 78 const base::Callback<void(bool)>& callback); |
79 | 79 |
80 // Requests all extension services matching |action|, |mimetype| and | |
81 // |extension_id|. | |
82 // |mimetype| must conform to definition as outlined for GetIntentServices. | |
83 // |consumer| must not be NULL. | |
84 QueryID GetIntentServicesForExtensionFilter(const string16& action, | |
85 const string16& mimetype, | |
86 const std::string& extension_id, | |
87 Consumer* consumer); | |
88 | |
89 // Record the given default service entry. | 80 // Record the given default service entry. |
90 virtual void RegisterDefaultIntentService( | 81 virtual void RegisterDefaultIntentService( |
91 const DefaultWebIntentService& default_service); | 82 const DefaultWebIntentService& default_service); |
92 | 83 |
93 // Delete the given default service entry. Deletes entries matching | 84 // Delete the given default service entry. Deletes entries matching |
94 // the |action|, |type|, and |url_pattern| of |default_service|. | 85 // the |action|, |type|, and |url_pattern| of |default_service|. |
95 virtual void UnregisterDefaultIntentService( | 86 virtual void UnregisterDefaultIntentService( |
96 const DefaultWebIntentService& default_service); | 87 const DefaultWebIntentService& default_service); |
97 | 88 |
98 // Requests the best default intent service for the given invocation | 89 // Requests the best default intent service for the given invocation |
(...skipping 25 matching lines...) Expand all Loading... |
124 // WebDataServiceConsumer implementation. | 115 // WebDataServiceConsumer implementation. |
125 virtual void OnWebDataServiceRequestDone( | 116 virtual void OnWebDataServiceRequestDone( |
126 WebDataService::Handle h, | 117 WebDataService::Handle h, |
127 const WDTypedResult* result) OVERRIDE; | 118 const WDTypedResult* result) OVERRIDE; |
128 | 119 |
129 // Delegate for defaults requests from OnWebDataServiceRequestDone. | 120 // Delegate for defaults requests from OnWebDataServiceRequestDone. |
130 virtual void OnWebDataServiceDefaultsRequestDone( | 121 virtual void OnWebDataServiceDefaultsRequestDone( |
131 WebDataService::Handle h, | 122 WebDataService::Handle h, |
132 const WDTypedResult* result); | 123 const WDTypedResult* result); |
133 | 124 |
134 // Implementation of GetIntentServicesForExtensionFilter. | |
135 void DoGetIntentServicesForExtensionFilter(scoped_ptr<IntentsQuery> query, | |
136 const std::string& extension_id); | |
137 | |
138 // Map for all in-flight web data requests/intent queries. | 125 // Map for all in-flight web data requests/intent queries. |
139 QueryMap queries_; | 126 QueryMap queries_; |
140 | 127 |
141 // Unique identifier for next intent query. | 128 // Unique identifier for next intent query. |
142 QueryID next_query_id_; | 129 QueryID next_query_id_; |
143 | 130 |
144 // Local reference to Web Data Service. | 131 // Local reference to Web Data Service. |
145 scoped_refptr<WebDataService> wds_; | 132 scoped_refptr<WebDataService> wds_; |
146 | 133 |
147 // Local reference to the ExtensionService. | 134 // Local reference to the ExtensionService. |
148 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any | 135 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any |
149 // ProfileKeyedService will be shut down before data on ProfileImpl is | 136 // ProfileKeyedService will be shut down before data on ProfileImpl is |
150 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid | 137 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid |
151 // for the lifetime of the WebIntentsRegistry object. | 138 // for the lifetime of the WebIntentsRegistry object. |
152 ExtensionServiceInterface* extension_service_; | 139 ExtensionServiceInterface* extension_service_; |
153 | 140 |
154 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); | 141 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); |
155 }; | 142 }; |
156 | 143 |
157 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ | 144 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ |
OLD | NEW |