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 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
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" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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|, |type| and | 80 // Requests all extension services matching |action|, |type| and |
81 // |extension_id|. | 81 // |extension_id|. |
82 // |type| must conform to definition as outlined for GetIntentServices. | 82 // |type| must conform to definition as outlined for GetIntentServices. |
83 // |callback| must not be null. | 83 // |callback| must not be null. |
84 void GetIntentServicesForExtensionFilter(const string16& action, | 84 void GetIntentServicesForExtensionFilter(const string16& action, |
85 const string16& type, | 85 const string16& type, |
86 const std::string& extension_id, | 86 const std::string& extension_id, |
87 const QueryCallback& callback); | 87 IntentServiceList* services); |
88 | 88 |
89 // Record the given default service entry. | 89 // Record the given default service entry. |
90 virtual void RegisterDefaultIntentService( | 90 virtual void RegisterDefaultIntentService( |
91 const DefaultWebIntentService& default_service); | 91 const DefaultWebIntentService& default_service); |
92 | 92 |
93 // Delete the given default service entry. Deletes entries matching | 93 // Delete the given default service entry. Deletes entries matching |
94 // the |action|, |type|, and |url_pattern| of |default_service|. | 94 // the |action|, |type|, and |url_pattern| of |default_service|. |
95 virtual void UnregisterDefaultIntentService( | 95 virtual void UnregisterDefaultIntentService( |
96 const DefaultWebIntentService& default_service); | 96 const DefaultWebIntentService& default_service); |
97 | 97 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 void OnAllDefaultIntentServicesReceived( | 136 void OnAllDefaultIntentServicesReceived( |
137 const DefaultIntentServicesCallback& callback, | 137 const DefaultIntentServicesCallback& callback, |
138 const WDTypedResult* result); | 138 const WDTypedResult* result); |
139 | 139 |
140 // Handles default services loaded | 140 // Handles default services loaded |
141 void OnWebIntentsDefaultsResultReceived( | 141 void OnWebIntentsDefaultsResultReceived( |
142 const QueryParams& params, | 142 const QueryParams& params, |
143 const DefaultQueryCallback& callback, | 143 const DefaultQueryCallback& callback, |
144 const WDTypedResult* result); | 144 const WDTypedResult* result); |
145 | 145 |
146 // Implementation of GetIntentServicesForExtensionFilter. | |
147 void DoGetIntentServicesForExtensionFilter( | |
148 const QueryParams& params, | |
149 const std::string& extension_id, | |
150 const QueryCallback& callback); | |
151 | |
152 const extensions::Extension* ExtensionForURL(const std::string& url); | 146 const extensions::Extension* ExtensionForURL(const std::string& url); |
153 | 147 |
154 // Adds a query to the list of pending queries. | 148 // Adds a query to the list of pending queries. |
155 void TrackQuery(QueryAdapter* query); | 149 void TrackQuery(QueryAdapter* query); |
156 | 150 |
157 // Takes ownership of a query. This removes a query from the list | 151 // Takes ownership of a query. This removes a query from the list |
158 // of pending queries. | 152 // of pending queries. |
159 void ReleaseQuery(QueryAdapter* query); | 153 void ReleaseQuery(QueryAdapter* query); |
160 | 154 |
161 // Map for all in-flight web data requests/intent queries. | 155 // Map for all in-flight web data requests/intent queries. |
162 QueryVector pending_queries_; | 156 QueryVector pending_queries_; |
163 | 157 |
164 // Local reference to Web Data Service. | 158 // Local reference to Web Data Service. |
165 scoped_refptr<WebDataService> wds_; | 159 scoped_refptr<WebDataService> wds_; |
166 | 160 |
167 // Local reference to the ExtensionService. | 161 // Local reference to the ExtensionService. |
168 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any | 162 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any |
169 // ProfileKeyedService will be shut down before data on ProfileImpl is | 163 // ProfileKeyedService will be shut down before data on ProfileImpl is |
170 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid | 164 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid |
171 // for the lifetime of the WebIntentsRegistry object. | 165 // for the lifetime of the WebIntentsRegistry object. |
172 ExtensionServiceInterface* extension_service_; | 166 ExtensionServiceInterface* extension_service_; |
173 | 167 |
174 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); | 168 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); |
175 }; | 169 }; |
176 | 170 |
177 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ | 171 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ |
OLD | NEW |