diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 18:19:25 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 18:19:25 +0000 |
commit | f5bf8ccfcaa51e3f8b12e7eaf4bb26fa6bf2d69c (patch) | |
tree | 98b1017d118b3157a449d0b917b3c1ce57869f81 /chrome/browser/browser.cc | |
parent | cd023e807914d91d64e325391bde25ff0bdea3f3 (diff) | |
download | chromium_src-f5bf8ccfcaa51e3f8b12e7eaf4bb26fa6bf2d69c.zip chromium_src-f5bf8ccfcaa51e3f8b12e7eaf4bb26fa6bf2d69c.tar.gz chromium_src-f5bf8ccfcaa51e3f8b12e7eaf4bb26fa6bf2d69c.tar.bz2 |
Show the filebrowse ui rather than the download shelf in chromeos.
This cl displays the filebrowse ui rather than download shelf for
downloads in chrom(e|ium) os. It conditionally replaces (with
preprocessor macros) the Browser::OnStartDownload method to do this.
The cl adds a static FileBrowseUI::OpenPopup(profile, hashArgument),
which opens the file browse ui and passes it the provided hash argument.
This is invoked directly from Browser::OnStartDownload. The
USBMountObserver code was changed to call this static method, rather
than open the popup by hand as it had been doing.
I'm not sure about ownership of the Browser* returned by OpenPopup, but
based on other code in the tree I assume chrome will deal with freeing
it when appropriate.
Before this change, USBMountObserver would add the window to registrar_
*before* showing it. Now that FileBrowseUI::OpenPopup returns a which
which is already visible, this is no longer the case. I assume this
won't be a problem.
Commit this for rginda.
Original review: http://codereview.chromium.org/555167
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/564022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38222 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 193b6ad..b22880b 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -27,6 +27,7 @@ #include "chrome/browser/character_encoding.h" #include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/debugger/devtools_window.h" +#include "chrome/browser/dom_ui/filebrowse_ui.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_manager.h" #include "chrome/browser/download/download_shelf.h" @@ -1061,7 +1062,14 @@ void Browser::ShowFindBar() { } bool Browser::SupportsWindowFeature(WindowFeature feature) const { - unsigned int features = FEATURE_INFOBAR | FEATURE_DOWNLOADSHELF; + unsigned int features = FEATURE_INFOBAR; + +#if !defined(OS_CHROMEOS) + // Chrome OS opens a FileBrowse pop up instead of using download shelf. + // So FEATURE_DOWNLOADSHELF is only added for non-chromeos platforms. + features |= FEATURE_DOWNLOADSHELF; +#endif // !defined(OS_CHROMEOS) + if (type() == TYPE_NORMAL) { features |= FEATURE_BOOKMARKBAR; features |= FEATURE_EXTENSIONSHELF; @@ -2252,6 +2260,12 @@ void Browser::OnStartDownload(DownloadItem* download) { if (!window()) return; +#if defined(OS_CHROMEOS) + // skip the download shelf and just open the file browser in chromeos + std::string arg = download->full_path().DirName().value(); + FileBrowseUI::OpenPopup(profile_, arg); + +#else // GetDownloadShelf creates the download shelf if it was not yet created. window()->GetDownloadShelf()->AddDownload(new DownloadItemModel(download)); @@ -2267,8 +2281,10 @@ void Browser::OnStartDownload(DownloadItem* download) { TabContents* current_tab = GetSelectedTabContents(); // We make this check for the case of minimized windows, unit tests, etc. if (platform_util::IsVisible(current_tab->GetNativeView()) && - Animation::ShouldRenderRichAnimation()) + Animation::ShouldRenderRichAnimation()) { DownloadStartedAnimation::Show(current_tab); + } +#endif } void Browser::ConfirmAddSearchProvider(const TemplateURL* template_url, |