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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 WebIntentsRegistry(); | 101 WebIntentsRegistry(); |
102 virtual ~WebIntentsRegistry(); | 102 virtual ~WebIntentsRegistry(); |
103 | 103 |
104 // Collapses a list of IntentServices by joining intents that have identical | 104 // Collapses a list of IntentServices by joining intents that have identical |
105 // service URLs, actions, and mime types. | 105 // service URLs, actions, and mime types. |
106 // |services| is the list of intent services to be collapsed when passed in | 106 // |services| is the list of intent services to be collapsed when passed in |
107 // and will be modified with the new list in-place. | 107 // and will be modified with the new list in-place. |
108 void CollapseIntents(IntentServiceList* services); | 108 void CollapseIntents(IntentServiceList* services); |
109 | 109 |
110 private: | 110 private: |
111 struct IntentsQuery; | 111 struct QueryParams; |
112 typedef std::vector<IntentsQuery*> QueryVector; | 112 class QueryAdapter; |
| 113 typedef std::vector<QueryAdapter*> QueryVector; |
113 | 114 |
114 // Handles services loaded | 115 // Handles services loaded |
115 void OnWebIntentsResultReceived( | 116 void OnWebIntentsResultReceived( |
116 IntentsQuery* query, | 117 const QueryParams& params, |
| 118 const QueryCallback& callback, |
117 const WDTypedResult* result); | 119 const WDTypedResult* result); |
118 | 120 |
119 // Handles default services loaded | 121 // Handles default services loaded |
120 void OnWebIntentsDefaultsResultReceived( | 122 void OnWebIntentsDefaultsResultReceived( |
121 IntentsQuery* query, | 123 const QueryParams& params, |
| 124 const DefaultQueryCallback& callback, |
122 const WDTypedResult* result); | 125 const WDTypedResult* result); |
123 | 126 |
124 // Implementation of GetIntentServicesForExtensionFilter. | 127 // Implementation of GetIntentServicesForExtensionFilter. |
125 void DoGetIntentServicesForExtensionFilter(scoped_ptr<IntentsQuery> query, | 128 void DoGetIntentServicesForExtensionFilter( |
126 const std::string& extension_id); | 129 const QueryParams& params, |
| 130 const std::string& extension_id, |
| 131 const QueryCallback& callback); |
127 | 132 |
128 const extensions::Extension* ExtensionForURL(const std::string& url); | 133 const extensions::Extension* ExtensionForURL(const std::string& url); |
129 | 134 |
130 // Adds a query to the list of pending queries. | 135 // Adds a query to the list of pending queries. |
131 void TrackQuery(IntentsQuery* query); | 136 void TrackQuery(QueryAdapter* query); |
132 | 137 |
133 // Takes ownership of a query. This removes a query from the list | 138 // Takes ownership of a query. This removes a query from the list |
134 // of pending queries. | 139 // of pending queries. |
135 void ReleaseQuery(IntentsQuery* query); | 140 void ReleaseQuery(QueryAdapter* query); |
136 | 141 |
137 // Map for all in-flight web data requests/intent queries. | 142 // Map for all in-flight web data requests/intent queries. |
138 QueryVector pending_queries_; | 143 QueryVector pending_queries_; |
139 | 144 |
140 // Local reference to Web Data Service. | 145 // Local reference to Web Data Service. |
141 scoped_refptr<WebDataService> wds_; | 146 scoped_refptr<WebDataService> wds_; |
142 | 147 |
143 // Local reference to the ExtensionService. | 148 // Local reference to the ExtensionService. |
144 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any | 149 // Shutdown/cleanup is handled by ProfileImpl. We are guaranteed that any |
145 // ProfileKeyedService will be shut down before data on ProfileImpl is | 150 // ProfileKeyedService will be shut down before data on ProfileImpl is |
146 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid | 151 // destroyed (i.e. |extension_service_|), so |extension_service_| is valid |
147 // for the lifetime of the WebIntentsRegistry object. | 152 // for the lifetime of the WebIntentsRegistry object. |
148 ExtensionServiceInterface* extension_service_; | 153 ExtensionServiceInterface* extension_service_; |
149 | 154 |
150 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); | 155 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); |
151 }; | 156 }; |
152 | 157 |
153 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ | 158 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ |
OLD | NEW |