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_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // Exposed for tests only. | 98 // Exposed for tests only. |
99 void set_model_observer(WebIntentPickerModelObserver* observer) { | 99 void set_model_observer(WebIntentPickerModelObserver* observer) { |
100 picker_model_->set_observer(observer); | 100 picker_model_->set_observer(observer); |
101 } | 101 } |
102 | 102 |
103 // Called by the WebIntentsRegistry, returning |services|, which is | 103 // Called by the WebIntentsRegistry, returning |services|, which is |
104 // a list of WebIntentServiceData matching the query. | 104 // a list of WebIntentServiceData matching the query. |
105 void OnWebIntentServicesAvailable( | 105 void OnWebIntentServicesAvailable( |
106 const std::vector<webkit_glue::WebIntentServiceData>& services); | 106 const std::vector<webkit_glue::WebIntentServiceData>& services); |
107 | 107 |
| 108 // Called when a default service is returned from the WebIntentsRegistry. |
| 109 // (Still called with default_service.service_url empty if there are no |
| 110 // defaults.) |
| 111 void OnWebIntentDefaultsAvailable( |
| 112 const DefaultWebIntentService& default_service); |
| 113 |
| 114 // Coordination method which is delegated to by the registry calls to get |
| 115 // services and defaults. Checks whether the picker should be shown or if |
| 116 // default choices allow it to be skipped. |
| 117 void RegistryCallsCompleted(); |
| 118 |
108 // Called when WebIntentServiceData is ready for checking extensions | 119 // Called when WebIntentServiceData is ready for checking extensions |
109 // when dispatching explicit intents. Gets |services| | 120 // when dispatching explicit intents. Gets |services| |
110 // from the WebIntentsRegistry to check for known urls/extensions and find | 121 // from the WebIntentsRegistry to check for known urls/extensions and find |
111 // disposition data. | 122 // disposition data. |
112 void WebIntentServicesForExplicitIntent( | 123 void WebIntentServicesForExplicitIntent( |
113 const std::vector<webkit_glue::WebIntentServiceData>& services); | 124 const std::vector<webkit_glue::WebIntentServiceData>& services); |
114 | 125 |
115 // Called when FaviconData is returned from the FaviconService. | 126 // Called when FaviconData is returned from the FaviconService. |
116 void OnFaviconDataAvailable(FaviconService::Handle handle, | 127 void OnFaviconDataAvailable(FaviconService::Handle handle, |
117 history::FaviconData favicon_data); | 128 history::FaviconData favicon_data); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // A weak pointer to the picker this controller controls. | 176 // A weak pointer to the picker this controller controls. |
166 WebIntentPicker* picker_; | 177 WebIntentPicker* picker_; |
167 | 178 |
168 // The model for the picker. Owned by this controller. It should not be NULL | 179 // The model for the picker. Owned by this controller. It should not be NULL |
169 // while this controller exists, even if the picker is not shown. | 180 // while this controller exists, even if the picker is not shown. |
170 scoped_ptr<WebIntentPickerModel> picker_model_; | 181 scoped_ptr<WebIntentPickerModel> picker_model_; |
171 | 182 |
172 // A count of the outstanding asynchronous calls. | 183 // A count of the outstanding asynchronous calls. |
173 int pending_async_count_; | 184 int pending_async_count_; |
174 | 185 |
| 186 // A count of outstanding WebIntentsRegistry calls. |
| 187 int pending_registry_calls_count_; |
| 188 |
175 // Is true if the picker is currently visible. | 189 // Is true if the picker is currently visible. |
176 // This bool is not equivalent to picker != NULL in a unit test. In that | 190 // This bool is not equivalent to picker != NULL in a unit test. In that |
177 // case, a picker may be non-NULL before it is shown. | 191 // case, a picker may be non-NULL before it is shown. |
178 bool picker_shown_; | 192 bool picker_shown_; |
179 | 193 |
180 // Weak pointer to the routing object for the renderer which launched the | 194 // Weak pointer to the routing object for the renderer which launched the |
181 // intent. Contains the intent data and a way to signal back to the | 195 // intent. Contains the intent data and a way to signal back to the |
182 // client page. | 196 // client page. |
183 content::WebIntentsDispatcher* intents_dispatcher_; | 197 content::WebIntentsDispatcher* intents_dispatcher_; |
184 | 198 |
185 // Weak pointer to the tab servicing the intent. Remembered in order to | 199 // Weak pointer to the tab servicing the intent. Remembered in order to |
186 // close it when a reply is sent. | 200 // close it when a reply is sent. |
187 content::WebContents* service_tab_; | 201 content::WebContents* service_tab_; |
188 | 202 |
189 // Request consumer used when asynchronously loading favicons. | 203 // Request consumer used when asynchronously loading favicons. |
190 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; | 204 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; |
191 | 205 |
192 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; | 206 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; |
193 | 207 |
194 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); | 208 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); |
195 }; | 209 }; |
196 | 210 |
197 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 211 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
OLD | NEW |