Chromium Code Reviews| Index: chrome/browser/extensions/extension_host.cc |
| diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc |
| index 3d36a0b6475a8df990478899db2a57088f434f8a..59124c1002f282d856dfce10ba1e2b82e0fdfc6f 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,28 @@ void ExtensionHost::OnStartDownload( |
| OnStartDownload(source, download); |
| } |
| +void ExtensionHost::WebIntentDispatch( |
|
groby-ooo-7-16
2012/07/31 19:26:17
This seems to have odd ownership rules for intents
Greg Billock
2012/08/01 17:02:26
Yes, callee takes ownership. This is documented in
groby-ooo-7-16
2012/08/01 18:17:06
In this case, please use scoped_ptr. (And .release
Greg Billock
2012/08/07 00:23:57
Done.
|
| + content::WebContents* web_contents, |
| + content::WebIntentsDispatcher* intents_dispatcher) { |
| + |
| + Browser* browser = view() ? view()->browser() |
| + : browser::FindBrowserWithWebContents(web_contents); |
| + |
| + // 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, intents_dispatcher); |
| + return; |
| + } |
| + |
| + delete intents_dispatcher; |
| +} |
| + |
| void ExtensionHost::WillRunJavaScriptDialog() { |
| ExtensionProcessManager* pm = |
| ExtensionSystem::Get(profile_)->process_manager(); |