| 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 |
| 80 // Record the given default service entry. | 89 // Record the given default service entry. |
| 81 virtual void RegisterDefaultIntentService( | 90 virtual void RegisterDefaultIntentService( |
| 82 const DefaultWebIntentService& default_service); | 91 const DefaultWebIntentService& default_service); |
| 83 | 92 |
| 84 // Delete the given default service entry. Deletes entries matching | 93 // Delete the given default service entry. Deletes entries matching |
| 85 // the |action|, |type|, and |url_pattern| of |default_service|. | 94 // the |action|, |type|, and |url_pattern| of |default_service|. |
| 86 virtual void UnregisterDefaultIntentService( | 95 virtual void UnregisterDefaultIntentService( |
| 87 const DefaultWebIntentService& default_service); | 96 const DefaultWebIntentService& default_service); |
| 88 | 97 |
| 89 // Requests the best default intent service for the given invocation | 98 // Requests the best default intent service for the given invocation |
| (...skipping 25 matching lines...) Expand all Loading... |
| 115 // WebDataServiceConsumer implementation. | 124 // WebDataServiceConsumer implementation. |
| 116 virtual void OnWebDataServiceRequestDone( | 125 virtual void OnWebDataServiceRequestDone( |
| 117 WebDataService::Handle h, | 126 WebDataService::Handle h, |
| 118 const WDTypedResult* result) OVERRIDE; | 127 const WDTypedResult* result) OVERRIDE; |
| 119 | 128 |
| 120 // Delegate for defaults requests from OnWebDataServiceRequestDone. | 129 // Delegate for defaults requests from OnWebDataServiceRequestDone. |
| 121 virtual void OnWebDataServiceDefaultsRequestDone( | 130 virtual void OnWebDataServiceDefaultsRequestDone( |
| 122 WebDataService::Handle h, | 131 WebDataService::Handle h, |
| 123 const WDTypedResult* result); | 132 const WDTypedResult* result); |
| 124 | 133 |
| 134 // Implementation of GetIntentServicesForExtensionFilter. |
| 135 void DoGetIntentServicesForExtensionFilter(scoped_ptr<IntentsQuery> query, |
| 136 const std::string& extension_id); |
| 137 |
| 125 // Map for all in-flight web data requests/intent queries. | 138 // Map for all in-flight web data requests/intent queries. |
| 126 QueryMap queries_; | 139 QueryMap queries_; |
| 127 | 140 |
| 128 // Unique identifier for next intent query. | 141 // Unique identifier for next intent query. |
| 129 QueryID next_query_id_; | 142 QueryID next_query_id_; |
| 130 | 143 |
| 131 // Local reference to Web Data Service. | 144 // Local reference to Web Data Service. |
| 132 scoped_refptr<WebDataService> wds_; | 145 scoped_refptr<WebDataService> wds_; |
| 133 | 146 |
| 134 // Local reference to the ExtensionService. | 147 // Local reference to the ExtensionService. |
| 135 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any | 148 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any |
| 136 // ProfileKeyedService will be shut down before data on ProfileImpl is | 149 // ProfileKeyedService will be shut down before data on ProfileImpl is |
| 137 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid | 150 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid |
| 138 // for the lifetime of the WebIntentsRegistry object. | 151 // for the lifetime of the WebIntentsRegistry object. |
| 139 ExtensionServiceInterface* extension_service_; | 152 ExtensionServiceInterface* extension_service_; |
| 140 | 153 |
| 141 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); | 154 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); |
| 142 }; | 155 }; |
| 143 | 156 |
| 144 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ | 157 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ |
| OLD | NEW |