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