diff options
author | benjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-01 22:23:19 +0000 |
---|---|---|
committer | benjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-01 22:23:19 +0000 |
commit | 2f169ca09a854d26f58e7c9697eab52c15f3cdd5 (patch) | |
tree | 2849d71991a619fb6911ed5bbfef4abcfd6b47ea | |
parent | af071bdd612b54c8d76f85a0a50d4e0b0f96d227 (diff) | |
download | chromium_src-2f169ca09a854d26f58e7c9697eab52c15f3cdd5.zip chromium_src-2f169ca09a854d26f58e7c9697eab52c15f3cdd5.tar.gz chromium_src-2f169ca09a854d26f58e7c9697eab52c15f3cdd5.tar.bz2 |
Show the DownloadShelf when a download is triggered in extension bubbles.
Forward WebContentsDelegate::OnStartDownload() from ExtensionHost to Browser.
DownloadShelf requires a BrowserWindow, so ExtensionHost uses view()->browser(), but no other method to find a Browser if view()->browser() does not exist.
Review URL: https://chromiumcodereview.appspot.com/10444089
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140111 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/extension_host.cc | 10 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_host.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index f72fbce..fd3a2a3 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -410,6 +410,16 @@ void ExtensionHost::CloseContents(WebContents* contents) { } } +void ExtensionHost::OnStartDownload( + content::WebContents* source, content::DownloadItem* download) { + // If |source| is in the context of a Browser, show the DownloadShelf on that + // Browser. + if (!view() || !view()->browser()) + return; + static_cast<content::WebContentsDelegate*>(view()->browser())-> + OnStartDownload(source, download); +} + void ExtensionHost::WillRunJavaScriptDialog() { ExtensionProcessManager* pm = ExtensionSystem::Get(profile_)->process_manager(); diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index 56d5816..39a5ba4 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -163,6 +163,8 @@ class ExtensionHost : public content::WebContentsDelegate, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; virtual void CloseContents(content::WebContents* contents) OVERRIDE; + virtual void OnStartDownload(content::WebContents* source, + content::DownloadItem* download) OVERRIDE; // content::NotificationObserver virtual void Observe(int type, |