Index: chrome/browser/extensions/extension_host.cc |
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc |
index 88920d2376691a4ab68903cb407fa5f7032f27ea..ac877de3fc188aecda2d5c205f09dbb1eb7dde10 100644 |
--- a/chrome/browser/extensions/extension_host.cc |
+++ b/chrome/browser/extensions/extension_host.cc |
@@ -45,6 +45,7 @@ |
#include "content/public/browser/site_instance.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_contents_view.h" |
+#include "content/public/browser/web_intents_dispatcher.h" |
#include "grit/browser_resources.h" |
#include "grit/chromium_strings.h" |
#include "grit/generated_resources.h" |
@@ -418,6 +419,27 @@ void ExtensionHost::OnStartDownload( |
OnStartDownload(source, download); |
} |
+void ExtensionHost::WebIntentDispatch( |
+ content::WebContents* web_contents, |
+ content::WebIntentsDispatcher* intents_dispatcher) { |
+ scoped_ptr<content::WebIntentsDispatcher> dispatcher(intents_dispatcher); |
+ |
+ Browser* browser = view() ? view()->browser() |
+ : browser::FindBrowserWithWebContents(web_contents); |
Ben Goodger (Google)
2012/08/07 21:18:16
Browser* browser = view() ? view()->browser() :
Greg Billock
2012/08/07 22:48:45
Done.
|
+ |
+ // For background scripts/pages, there will be no view(). In this case, we |
+ // want to treat the intent as a browser-initiated one and deliver it into the |
+ // current browser. It probably came from a context menu click or similar. |
+ if (!browser) |
+ browser = web_intents::GetWebIntentDeliveryBrowser(profile()); |
+ |
+ if (browser) { |
+ static_cast<WebContentsDelegate*>(browser)-> |
+ WebIntentDispatch(NULL, dispatcher.release()); |
+ return; |
Ben Goodger (Google)
2012/08/07 21:18:16
return seems unnecessary
Greg Billock
2012/08/07 22:48:45
Done. Forgot to kill this after switching to scope
|
+ } |
+} |
+ |
void ExtensionHost::WillRunJavaScriptDialog() { |
ExtensionProcessManager* pm = |
ExtensionSystem::Get(profile_)->process_manager(); |