| OLD | NEW |
| 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/callback.h" |
| 9 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/profiles/profile_keyed_service.h" | 13 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 13 #include "chrome/browser/webdata/web_data_service.h" | 14 #include "chrome/browser/webdata/web_data_service.h" |
| 14 #include "webkit/glue/web_intent_service_data.h" | 15 #include "webkit/glue/web_intent_service_data.h" |
| 15 | 16 |
| 16 // Handles storing and retrieving of web intents in the web database. | 17 // Handles storing and retrieving of web intents in the web database. |
| 17 // The registry provides filtering logic to retrieve specific types of intents. | 18 // The registry provides filtering logic to retrieve specific types of intents. |
| 18 class WebIntentsRegistry | 19 class WebIntentsRegistry |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Requests all intent providers matching |action| and |mimetype|. | 53 // Requests all intent providers matching |action| and |mimetype|. |
| 53 // |mimetype| can contain wildcards, i.e. "image/*" or "*". | 54 // |mimetype| can contain wildcards, i.e. "image/*" or "*". |
| 54 // |consumer| must not be NULL. | 55 // |consumer| must not be NULL. |
| 55 QueryID GetIntentProviders(const string16& action, | 56 QueryID GetIntentProviders(const string16& action, |
| 56 const string16& mimetype, | 57 const string16& mimetype, |
| 57 Consumer* consumer); | 58 Consumer* consumer); |
| 58 | 59 |
| 59 // Requests all intent providers. |consumer| must not be NULL | 60 // Requests all intent providers. |consumer| must not be NULL |
| 60 QueryID GetAllIntentProviders(Consumer* consumer); | 61 QueryID GetAllIntentProviders(Consumer* consumer); |
| 61 | 62 |
| 63 // Tests for the existence of the given intent |provider|. Calls the |
| 64 // provided |callback| with true if it exists, false if it does not. |
| 65 // Checks for |provider| equality with ==. |
| 66 QueryID IntentProviderExists( |
| 67 const webkit_glue::WebIntentServiceData& provider, |
| 68 const base::Callback<void(bool)>& callback); |
| 69 |
| 62 protected: | 70 protected: |
| 63 // Make sure that only WebIntentsRegistryFactory can create an instance of | 71 // Make sure that only WebIntentsRegistryFactory can create an instance of |
| 64 // WebIntentsRegistry. | 72 // WebIntentsRegistry. |
| 65 friend class WebIntentsRegistryFactory; | 73 friend class WebIntentsRegistryFactory; |
| 66 friend class WebIntentsRegistryTest; | 74 friend class WebIntentsRegistryTest; |
| 67 friend class WebIntentsModelTest; | 75 friend class WebIntentsModelTest; |
| 68 | 76 |
| 69 WebIntentsRegistry(); | 77 WebIntentsRegistry(); |
| 70 virtual ~WebIntentsRegistry(); | 78 virtual ~WebIntentsRegistry(); |
| 71 | 79 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 93 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any | 101 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any |
| 94 // ProfileKeyedService will be shut down before data on ProfileImpl is | 102 // ProfileKeyedService will be shut down before data on ProfileImpl is |
| 95 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid | 103 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid |
| 96 // for the lifetime of the WebIntentsRegistry object. | 104 // for the lifetime of the WebIntentsRegistry object. |
| 97 ExtensionServiceInterface* extension_service_; | 105 ExtensionServiceInterface* extension_service_; |
| 98 | 106 |
| 99 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); | 107 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); |
| 100 }; | 108 }; |
| 101 | 109 |
| 102 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ | 110 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ |
| OLD | NEW |