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..63112c4143458b3250aee9f5d2d8651576b4f8df 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,12 @@ 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. |
+ // |services| must be a non-empty list. |
+ 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 +176,9 @@ class WebIntentPickerController : public content::NotificationObserver, |
// Request consumer used when asynchronously loading favicons. |
CancelableRequestConsumerTSimple<size_t> favicon_consumer_; |
+ // Used to install extensions from the Chrome Web Store. |
+ scoped_refptr<WebstoreInstaller> webstore_installer_; |
+ |
base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); |