Chromium Code Reviews| Index: chrome/browser/ui/intents/web_intent_picker_controller.h |
| diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.h b/chrome/browser/ui/intents/web_intent_picker_controller.h |
| index ee6ce0e3b2254810c5e33c01c3bf3fc9f6d898ed..ea0fde9876a4fc492dc0d8a2224e0351f0ce9a9f 100644 |
| --- a/chrome/browser/ui/intents/web_intent_picker_controller.h |
| +++ b/chrome/browser/ui/intents/web_intent_picker_controller.h |
| @@ -9,9 +9,11 @@ |
| #include <vector> |
| #include "base/compiler_specific.h" |
| +#include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/string16.h" |
| +#include "chrome/browser/extensions/webstore_installer.h" |
| #include "chrome/browser/favicon/favicon_service.h" |
| #include "chrome/browser/intents/web_intents_registry.h" |
| #include "chrome/browser/intents/cws_intents_registry.h" |
| @@ -27,6 +29,7 @@ class GURL; |
| class TabContentsWrapper; |
| class WebIntentPicker; |
| class WebIntentPickerModel; |
| +class WebstoreInstaller; |
| namespace content { |
| class WebContents; |
| @@ -41,7 +44,7 @@ struct WebIntentServiceData; |
| // intent handler choice back to the TabContents object. |
| class WebIntentPickerController : public content::NotificationObserver, |
| public WebIntentPickerDelegate, |
| - public WebIntentsRegistry::Consumer { |
| + public WebstoreInstaller::Delegate { |
| public: |
| // Takes ownership of |factory|. |
| explicit WebIntentPickerController(TabContentsWrapper* wrapper); |
| @@ -69,9 +72,15 @@ class WebIntentPickerController : public content::NotificationObserver, |
| Disposition disposition) OVERRIDE; |
| virtual void OnInlineDispositionWebContentsCreated( |
| content::WebContents* web_contents) OVERRIDE; |
| + virtual void OnExtensionInstallRequested(const std::string& id) OVERRIDE; |
| virtual void OnCancelled() OVERRIDE; |
| virtual void OnClosing() OVERRIDE; |
| + // WebstoreInstaller::Delegate implementation. |
| + virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; |
| + virtual void OnExtensionInstallFailure(const std::string& id, |
| + const std::string& error) OVERRIDE; |
| + |
| private: |
| friend class WebIntentPickerControllerTest; |
| friend class WebIntentPickerControllerBrowserTest; |
| @@ -90,14 +99,8 @@ class WebIntentPickerController : public content::NotificationObserver, |
| } |
| // Called when WebIntentServiceData is returned from the WebIntentsRegistry. |
| - virtual void OnIntentsQueryDone( |
| - WebIntentsRegistry::QueryID, |
| - const std::vector<webkit_glue::WebIntentServiceData>& services) OVERRIDE; |
| - |
| - // Called when the WebIntentsRegistry returns responses to a defaults request. |
| - virtual void OnIntentsDefaultsQueryDone( |
| - WebIntentsRegistry::QueryID, |
| - const DefaultWebIntentService& default_service) OVERRIDE; |
| + void OnWebIntentServicesAvailable( |
| + const std::vector<webkit_glue::WebIntentServiceData>& services); |
| // Called when FaviconData is returned from the FaviconService. |
| void OnFaviconDataAvailable(FaviconService::Handle handle, |
| @@ -126,6 +129,11 @@ class WebIntentPickerController : public content::NotificationObserver, |
| // Called when an extension's icon failed to be decoded or resized. |
| void OnExtensionIconUnavailable(const string16& extension_id); |
| + // When an extension is installed, all that is known is the extension id. |
| + // This callback receives the intent service data for that extension. |
| + void OnExtensionInstallServiceAvailable( |
| + const std::vector<webkit_glue::WebIntentServiceData>& services); |
| + |
| // Decrements the |pending_async_count_| and notifies the picker if it |
| // reaches zero. |
| void AsyncOperationFinished(); |
| @@ -167,6 +175,10 @@ class WebIntentPickerController : public content::NotificationObserver, |
| // Request consumer used when asynchronously loading favicons. |
| CancelableRequestConsumerTSimple<size_t> favicon_consumer_; |
| + // Pointer to the WebstoreInstaller, used to install extensions from the |
|
James Hawkins
2012/03/15 01:05:20
You can take out the "Pointer to the WebStoreInsta
binji
2012/03/15 17:53:14
Done.
|
| + // Chrome Web Store. |
| + scoped_refptr<WebstoreInstaller> webstore_installer_; |
| + |
| base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); |