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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "chrome/browser/extensions/webstore_installer.h" | 15 #include "chrome/browser/extensions/webstore_installer.h" |
16 #include "chrome/browser/favicon/favicon_service.h" | |
17 #include "chrome/browser/intents/cws_intents_registry.h" | 16 #include "chrome/browser/intents/cws_intents_registry.h" |
18 #include "chrome/browser/intents/web_intents_registry.h" | 17 #include "chrome/browser/intents/web_intents_registry.h" |
19 #include "chrome/browser/intents/web_intents_reporting.h" | 18 #include "chrome/browser/intents/web_intents_reporting.h" |
20 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" | 19 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" |
21 #include "content/public/browser/download_id.h" | 20 #include "content/public/browser/download_id.h" |
22 #include "content/public/browser/web_contents_user_data.h" | 21 #include "content/public/browser/web_contents_user_data.h" |
23 #include "webkit/glue/web_intent_data.h" | 22 #include "webkit/glue/web_intent_data.h" |
24 #include "webkit/glue/web_intent_reply_data.h" | 23 #include "webkit/glue/web_intent_reply_data.h" |
25 #include "webkit/glue/web_intent_service_data.h" | 24 #include "webkit/glue/web_intent_service_data.h" |
26 | 25 |
27 class Browser; | 26 class Browser; |
28 struct DefaultWebIntentService; | 27 struct DefaultWebIntentService; |
29 class GURL; | 28 class GURL; |
30 class Profile; | 29 class Profile; |
31 class WebIntentPicker; | 30 class WebIntentPicker; |
32 class WebIntentPickerModel; | 31 class WebIntentPickerModel; |
33 | 32 |
34 namespace content { | 33 namespace content { |
35 class WebContents; | 34 class WebContents; |
36 class WebIntentsDispatcher; | 35 class WebIntentsDispatcher; |
37 } | 36 } |
38 | 37 |
39 namespace web_intents { | 38 namespace web_intents { |
40 class NativeServiceFactory; | 39 class NativeServiceFactory; |
40 class IconLoader; | |
41 } | 41 } |
42 | 42 |
43 namespace webkit_glue { | 43 namespace webkit_glue { |
44 struct WebIntentServiceData; | 44 struct WebIntentServiceData; |
45 } | 45 } |
46 | 46 |
47 // Controls the creation of the WebIntentPicker UI and forwards the user's | 47 // Controls the creation of the WebIntentPicker UI and forwards the user's |
48 // intent handler choice back to the WebContents object. | 48 // intent handler choice back to the WebContents object. |
49 class WebIntentPickerController | 49 class WebIntentPickerController |
50 : public WebIntentPickerDelegate, | 50 : public WebIntentPickerDelegate, |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 // default choices allow it to be skipped. | 200 // default choices allow it to be skipped. |
201 void RegistryCallsCompleted(); | 201 void RegistryCallsCompleted(); |
202 | 202 |
203 // Called when WebIntentServiceData is ready for checking extensions | 203 // Called when WebIntentServiceData is ready for checking extensions |
204 // when dispatching explicit intents. Gets |services| | 204 // when dispatching explicit intents. Gets |services| |
205 // from the WebIntentsRegistry to check for known urls/extensions and find | 205 // from the WebIntentsRegistry to check for known urls/extensions and find |
206 // disposition data. | 206 // disposition data. |
207 void OnWebIntentServicesAvailableForExplicitIntent( | 207 void OnWebIntentServicesAvailableForExplicitIntent( |
208 const std::vector<webkit_glue::WebIntentServiceData>& services); | 208 const std::vector<webkit_glue::WebIntentServiceData>& services); |
209 | 209 |
210 // Called when a favicon is returned from the FaviconService. | |
211 void OnFaviconDataAvailable( | |
212 FaviconService::Handle handle, | |
213 const history::FaviconImageResult& image_result); | |
214 | |
215 // Called when IntentExtensionInfo is returned from the CWSIntentsRegistry. | 210 // Called when IntentExtensionInfo is returned from the CWSIntentsRegistry. |
216 void OnCWSIntentServicesAvailable( | 211 void OnCWSIntentServicesAvailable( |
217 const CWSIntentsRegistry::IntentExtensionList& extensions); | 212 const CWSIntentsRegistry::IntentExtensionList& extensions); |
218 | 213 |
219 // Called when a suggested extension's icon is fetched. | 214 // Called when a suggested extension's icon is fetched. |
220 void OnExtensionIconURLFetchComplete(const std::string& extension_id, | 215 void OnExtensionIconURLFetchComplete(const std::string& extension_id, |
221 const net::URLFetcher* source); | 216 const net::URLFetcher* source); |
222 | 217 |
223 // Called whenever intent data (both from registry and CWS) arrives. | 218 // Called whenever intent data (both from registry and CWS) arrives. |
224 void OnIntentDataArrived(); | 219 void OnIntentDataArrived(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 content::WebIntentsDispatcher* intents_dispatcher_; | 329 content::WebIntentsDispatcher* intents_dispatcher_; |
335 | 330 |
336 // Saves whether the use-another-service button has been | 331 // Saves whether the use-another-service button has been |
337 // animated on the location bar. | 332 // animated on the location bar. |
338 bool location_bar_button_indicated_; | 333 bool location_bar_button_indicated_; |
339 | 334 |
340 // Weak pointer to the tab servicing the intent. Remembered in order to | 335 // Weak pointer to the tab servicing the intent. Remembered in order to |
341 // close it when a reply is sent. | 336 // close it when a reply is sent. |
342 content::WebContents* service_tab_; | 337 content::WebContents* service_tab_; |
343 | 338 |
344 // Request consumer used when asynchronously loading favicons. | 339 // Object managing the details of icon loading. |
James Hawkins
2012/10/17 03:38:39
Object that manages the details...
| |
345 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; | 340 scoped_ptr<web_intents::IconLoader> icon_loader_; |
346 | 341 |
347 // Factory for weak pointers used in callbacks for async calls to load the | 342 // Factory for weak pointers used in callbacks for async calls to load the |
348 // picker model. | 343 // picker model. |
349 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; | 344 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; |
350 | 345 |
351 // Timer factory for minimum display time of "waiting" dialog. | 346 // Timer factory for minimum display time of "waiting" dialog. |
352 base::WeakPtrFactory<WebIntentPickerController> timer_factory_; | 347 base::WeakPtrFactory<WebIntentPickerController> timer_factory_; |
353 | 348 |
354 // Weak pointers for the dispatcher OnSendReturnMessage will not be | 349 // Weak pointers for the dispatcher OnSendReturnMessage will not be |
355 // cancelled on picker close. | 350 // cancelled on picker close. |
356 base::WeakPtrFactory<WebIntentPickerController> dispatcher_factory_; | 351 base::WeakPtrFactory<WebIntentPickerController> dispatcher_factory_; |
357 | 352 |
358 // Bucket identifier for UMA reporting. Saved off in a field | 353 // Bucket identifier for UMA reporting. Saved off in a field |
359 // to avoid repeated calculation of the bucket across | 354 // to avoid repeated calculation of the bucket across |
360 // multiple UMA calls. Should be recalculated each time | 355 // multiple UMA calls. Should be recalculated each time |
361 // |intents_dispatcher_| is set. | 356 // |intents_dispatcher_| is set. |
362 web_intents::UMABucket uma_bucket_; | 357 web_intents::UMABucket uma_bucket_; |
363 | 358 |
364 // Factory used to obtain instance of native services. | 359 // Factory used to obtain instance of native services. |
365 scoped_ptr<web_intents::NativeServiceFactory> native_services_; | 360 scoped_ptr<web_intents::NativeServiceFactory> native_services_; |
366 | 361 |
367 // The ID of a pending extension download. | 362 // The ID of a pending extension download. |
368 content::DownloadId download_id_; | 363 content::DownloadId download_id_; |
369 | 364 |
370 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); | 365 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); |
371 }; | 366 }; |
372 | 367 |
373 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 368 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
OLD | NEW |