From efda32f946ce7145795c630ab209b28cf2956619 Mon Sep 17 00:00:00 2001 From: "rhashimoto@chromium.org" Date: Wed, 6 Jul 2011 22:47:04 +0000 Subject: Remove DownloadShelf from ChromiumOS build. Besides removing some dead code, this eliminates a GTK link dependency from DownloadShelfContextMenuView. BUG=chromium-os:13887 TEST=none Review URL: http://codereview.chromium.org/7284015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91628 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/automation/testing_automation_provider.cc | 8 ++++++-- chrome/browser/ui/browser.cc | 8 ++++++-- chrome/browser/ui/views/frame/browser_view.cc | 16 +++++++++++++++- chrome/browser/ui/views/frame/browser_view.h | 5 ++++- chrome/browser/ui/views/frame/browser_view_layout.cc | 14 ++++++++++++-- chrome/chrome_browser.gypi | 9 +++++++++ 6 files changed, 52 insertions(+), 8 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index f29dc94..42dd30e 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -43,7 +43,6 @@ #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/download/download_prefs.h" -#include "chrome/browser/download/download_shelf.h" #include "chrome/browser/download/save_package.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_service.h" @@ -85,7 +84,6 @@ #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/webui/active_downloads_ui.h" #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" #include "chrome/common/automation_messages.h" #include "chrome/common/chrome_constants.h" @@ -111,6 +109,12 @@ #include "webkit/glue/webdropdata.h" #include "webkit/plugins/npapi/plugin_list.h" +#if defined(OS_CHROMEOS) +#include "chrome/browser/ui/webui/active_downloads_ui.h" +#else +#include "chrome/browser/download/download_shelf.h" +#endif + namespace { void SendMouseClick(int flags) { diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 8d40504..0a83d83 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -34,7 +34,6 @@ #include "chrome/browser/download/download_item.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_manager.h" -#include "chrome/browser/download/download_shelf.h" #include "chrome/browser/download/download_started_animation.h" #include "chrome/browser/download/save_package.h" #include "chrome/browser/extensions/crx_installer.h" @@ -94,7 +93,6 @@ #include "chrome/browser/ui/tabs/dock_info.h" #include "chrome/browser/ui/tabs/tab_menu_model.h" #include "chrome/browser/ui/web_applications/web_app_ui.h" -#include "chrome/browser/ui/webui/active_downloads_ui.h" #include "chrome/browser/ui/webui/bug_report_ui.h" #include "chrome/browser/ui/webui/options/content_settings_handler.h" #include "chrome/browser/ui/window_sizer.h" @@ -154,6 +152,9 @@ #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/boot_times_loader.h" #include "chrome/browser/extensions/file_manager_util.h" +#include "chrome/browser/ui/webui/active_downloads_ui.h" +#else +#include "chrome/browser/download/download_shelf.h" #endif using base::TimeDelta; @@ -1910,11 +1911,14 @@ void Browser::ShowHistoryTab() { void Browser::ShowDownloadsTab() { UserMetrics::RecordAction(UserMetricsAction("ShowDownloads")); +#if !defined(OS_CHROMEOS) + // ChromiumOS uses ActiveDownloadsUI instead of of DownloadShelf. if (window()) { DownloadShelf* shelf = window()->GetDownloadShelf(); if (shelf->IsShowing()) shelf->Close(); } +#endif ShowSingletonTab(GURL(chrome::kChromeUIDownloadsURL)); } diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index ce61c33..c38786f 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -51,7 +51,6 @@ #include "chrome/browser/ui/views/compact_nav/compact_options_bar.h" #include "chrome/browser/ui/views/default_search_view.h" #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" -#include "chrome/browser/ui/views/download/download_shelf_view.h" #include "chrome/browser/ui/views/frame/browser_view_layout.h" #include "chrome/browser/ui/views/frame/contents_container.h" #include "chrome/browser/ui/views/fullscreen_exit_bubble.h" @@ -119,6 +118,8 @@ #if defined(OS_CHROMEOS) #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" +#else +#include "chrome/browser/ui/views/download/download_shelf_view.h" #endif using base::TimeDelta; @@ -351,11 +352,13 @@ BrowserView::~BrowserView() { ticker_.UnregisterTickHandler(&hung_window_detector_); #endif +#if !defined(OS_CHROMEOS) // We destroy the download shelf before |browser_| to remove its child // download views from the set of download observers (since the observed // downloads can be destroyed along with |browser_| and the observer // notifications will call back into deleted objects). download_shelf_.reset(); +#endif // The TabStrip attaches a listener to the model. Make sure we shut down the // TabStrip first so that it can cleanly remove the listener. @@ -1073,15 +1076,24 @@ void BrowserView::SetDownloadShelfVisible(bool visible) { } bool BrowserView::IsDownloadShelfVisible() const { +#if defined(OS_CHROMEOS) + return false; +#else return download_shelf_.get() && download_shelf_->IsShowing(); +#endif } DownloadShelf* BrowserView::GetDownloadShelf() { +#if defined(OS_CHROMEOS) + NOTREACHED(); + return NULL; +#else if (!download_shelf_.get()) { download_shelf_.reset(new DownloadShelfView(browser_.get(), this)); download_shelf_->set_parent_owned(false); } return download_shelf_.get(); +#endif } void BrowserView::ShowRepostFormWarningDialog(TabContents* tab_contents) { @@ -1755,8 +1767,10 @@ void BrowserView::GetAccessiblePanes( panes->push_back(bookmark_bar_view_.get()); if (infobar_container_) panes->push_back(infobar_container_); +#if !defined(OS_CHROMEOS) if (download_shelf_.get()) panes->push_back(download_shelf_.get()); +#endif } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 061d371..361a79f 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -638,8 +638,11 @@ class BrowserView : public BrowserBubbleHost, // The Bookmark Bar View for this window. Lazily created. scoped_ptr bookmark_bar_view_; - // The download shelf view (view at the bottom of the page). +#if !defined(OS_CHROMEOS) + // The download shelf view (view at the bottom of the page). ChromiumOS + // uses ActiveDownloadsUI instead. scoped_ptr download_shelf_; +#endif // The InfoBarContainerView that contains InfoBars for the current tab. InfoBarContainerView* infobar_container_; diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc index 9e66933..d94b776 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout.cc @@ -9,7 +9,6 @@ #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" -#include "chrome/browser/ui/views/download/download_shelf_view.h" #include "chrome/browser/ui/views/frame/browser_frame.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/contents_container.h" @@ -22,6 +21,10 @@ #include "ui/gfx/size.h" #include "views/controls/single_split_view.h" +#if !defined(OS_CHROMEOS) +#include "chrome/browser/ui/views/download/download_shelf_view.h" +#endif + #if !defined(OS_WIN) #include "views/window/hit_test.h" #endif @@ -258,7 +261,11 @@ void BrowserViewLayout::ViewAdded(views::View* host, views::View* view) { infobar_container_ = view; break; case VIEW_ID_DOWNLOAD_SHELF: +#if !defined(OS_CHROMEOS) download_shelf_ = static_cast(view); +#else + NOTREACHED(); +#endif break; case VIEW_ID_BOOKMARK_BAR: active_bookmark_bar_ = static_cast(view); @@ -609,8 +616,10 @@ int BrowserViewLayout::GetTopMarginForActiveContent() { } int BrowserViewLayout::LayoutDownloadShelf(int bottom) { +#if !defined(OS_CHROMEOS) // Re-layout the shelf either if it is visible or if it's close animation - // is currently running. + // is currently running. ChromiumOS uses ActiveDownloadsUI instead of + // DownloadShelf. if (browser_view_->IsDownloadShelfVisible() || (download_shelf_ && download_shelf_->IsClosing())) { bool visible = browser()->SupportsWindowFeature( @@ -623,6 +632,7 @@ int BrowserViewLayout::LayoutDownloadShelf(int bottom) { download_shelf_->Layout(); bottom -= height; } +#endif return bottom; } diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 4e64348..db80deb 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -4477,11 +4477,20 @@ ['include', '^browser/ui/login/login_prompt_ui.cc'], ['include', '^browser/ui/views/omnibox/omnibox_view_views.cc'], ['include', '^browser/ui/views/omnibox/omnibox_view_views.h'], + ['exclude', '^browser/download/download_shelf.h'], + ['exclude', '^browser/download/download_shelf_context_menu.cc'], + ['exclude', '^browser/download/download_shelf_context_menu.h'], ['exclude', '^browser/extensions/extension_tts_api_linux.cc'], ['exclude', '^browser/notifications/balloon_collection_impl.cc'], ['exclude', '^browser/notifications/balloon_collection_impl.h'], ['exclude', '^browser/notifications/balloon_collection_linux.cc'], ['exclude', '^browser/ui/login/login_prompt_gtk.cc'], + ['exclude', '^browser/ui/views/download/download_item_view.cc'], + ['exclude', '^browser/ui/views/download/download_item_view.h'], + ['exclude', '^browser/ui/views/download/download_shelf_context_menu_view.cc'], + ['exclude', '^browser/ui/views/download/download_shelf_context_menu_view.h'], + ['exclude', '^browser/ui/views/download/download_shelf_view.cc'], + ['exclude', '^browser/ui/views/download/download_shelf_view.h'], ], 'dependencies': [ '../third_party/protobuf/protobuf.gyp:protobuf_lite', -- cgit v1.1