summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 23:03:39 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 23:03:39 +0000
commit0f6bf7f1d694b4a54220aff8e1115c5c346d4211 (patch)
tree9964fb1391d39fecd5e3cf63de8fe8166d196e06
parenta6a5478d1cd22f4c54e31e263bdacbe01eefcaff (diff)
downloadchromium_src-0f6bf7f1d694b4a54220aff8e1115c5c346d4211.zip
chromium_src-0f6bf7f1d694b4a54220aff8e1115c5c346d4211.tar.gz
chromium_src-0f6bf7f1d694b4a54220aff8e1115c5c346d4211.tar.bz2
download: Split DownloadShelfContextMenu into its own header file.
This change does: - Remove a bunch of unneeded includes. - Reorder the implementation to match with the order in the source file. - Add the right include for the DISALLOW_ macro. - Add OVERRIDE to a bunch of methods. - Makes the download_shelf.h clean and easy to read just leaving there a single interface. - This also moves the implementation of DownloadShelfContextMenu from download_shelf.cc to download_shelf_context_menu.cc - Make protected data member variables private instead. - Add getter/setter for download_item. TODO (not done yet to not increase the size of the diff and making it harder to review): - Move the implementation of DownloadShelfContextMenu of the platform specific class from download_item_* to download_shelf_context_menu_* BUG=28978,68682 TEST=None R=rdsmith@chromium.org,asanka@chromium.org Review URL: http://codereview.chromium.org/7018004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85999 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/download/download_shelf.h54
-rw-r--r--chrome/browser/download/download_shelf_context_menu.cc (renamed from chrome/browser/download/download_shelf.cc)178
-rw-r--r--chrome/browser/download/download_shelf_context_menu.h67
-rw-r--r--chrome/browser/ui/cocoa/download/download_item_controller.mm2
-rw-r--r--chrome/browser/ui/gtk/download/download_item_gtk.cc12
-rw-r--r--chrome/browser/ui/views/download/download_item_view.cc7
-rw-r--r--chrome/chrome_browser.gypi3
7 files changed, 163 insertions, 160 deletions
diff --git a/chrome/browser/download/download_shelf.h b/chrome/browser/download/download_shelf.h
index 21d8c97..3e98a06 100644
--- a/chrome/browser/download/download_shelf.h
+++ b/chrome/browser/download/download_shelf.h
@@ -6,16 +6,10 @@
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_
#pragma once
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/string16.h"
-#include "ui/base/models/simple_menu_model.h"
-
class BaseDownloadItemModel;
class Browser;
-class DownloadItem;
-// DownloadShelf is an interface for platform-specific download shelf views.
+// This is an interface for platform specific download shelf implementations.
class DownloadShelf {
public:
virtual ~DownloadShelf() {}
@@ -42,50 +36,4 @@ class DownloadShelf {
virtual Browser* browser() const = 0;
};
-// Logic for the download shelf context menu. Platform specific subclasses are
-// responsible for creating and running the menu.
-class DownloadShelfContextMenu : public ui::SimpleMenuModel::Delegate {
- public:
- virtual ~DownloadShelfContextMenu();
-
- virtual DownloadItem* download() const;
-
- enum ContextMenuCommands {
- SHOW_IN_FOLDER = 1, // Open a file explorer window with the item selected.
- OPEN_WHEN_COMPLETE, // Open the download when it's finished.
- ALWAYS_OPEN_TYPE, // Default this file extension to always open.
- CANCEL, // Cancel the download.
- TOGGLE_PAUSE, // Temporarily pause a download.
- MENU_LAST
- };
-
- protected:
- explicit DownloadShelfContextMenu(BaseDownloadItemModel* download_model);
-
- ui::SimpleMenuModel* GetInProgressMenuModel();
- ui::SimpleMenuModel* GetFinishedMenuModel();
- // Information source.
- DownloadItem* download_;
-
- // ui::SimpleMenuModel::Delegate implementation:
- virtual bool IsCommandIdEnabled(int command_id) const;
- virtual bool IsCommandIdChecked(int command_id) const;
- virtual void ExecuteCommand(int command_id);
- virtual bool GetAcceleratorForCommandId(int command_id,
- ui::Accelerator* accelerator);
- virtual bool IsItemForCommandIdDynamic(int command_id) const;
- virtual string16 GetLabelForCommandId(int command_id) const;
-
- // A model to control the cancel behavior.
- BaseDownloadItemModel* model_;
-
- private:
- // We show slightly different menus if the download is in progress vs. if the
- // download has finished.
- scoped_ptr<ui::SimpleMenuModel> in_progress_download_menu_model_;
- scoped_ptr<ui::SimpleMenuModel> finished_download_menu_model_;
-
- DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu);
-};
-
#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_
diff --git a/chrome/browser/download/download_shelf.cc b/chrome/browser/download/download_shelf_context_menu.cc
index 7e15cbd..5bbadda 100644
--- a/chrome/browser/download/download_shelf.cc
+++ b/chrome/browser/download/download_shelf_context_menu.cc
@@ -2,108 +2,113 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/download/download_shelf.h"
+#include "chrome/browser/download/download_shelf_context_menu.h"
-#include "base/file_util.h"
#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_util.h"
-#include "chrome/browser/ui/webui/downloads_ui.h"
-#include "chrome/common/url_constants.h"
-#include "content/browser/user_metrics.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
-// DownloadShelfContextMenu ----------------------------------------------------
+DownloadShelfContextMenu::~DownloadShelfContextMenu() {}
DownloadShelfContextMenu::DownloadShelfContextMenu(
BaseDownloadItemModel* download_model)
- : download_(download_model->download()),
- model_(download_model) {
+ : download_model_(download_model),
+ download_item_(download_model->download()) {
}
-DownloadShelfContextMenu::~DownloadShelfContextMenu() {
-}
+ui::SimpleMenuModel* DownloadShelfContextMenu::GetInProgressMenuModel() {
+ if (in_progress_download_menu_model_.get())
+ return in_progress_download_menu_model_.get();
+
+ in_progress_download_menu_model_.reset(new ui::SimpleMenuModel(this));
+
+ in_progress_download_menu_model_->AddCheckItemWithStringId(
+ OPEN_WHEN_COMPLETE, IDS_DOWNLOAD_MENU_OPEN_WHEN_COMPLETE);
+ in_progress_download_menu_model_->AddCheckItemWithStringId(
+ ALWAYS_OPEN_TYPE, IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
+ in_progress_download_menu_model_->AddSeparator();
+ in_progress_download_menu_model_->AddItemWithStringId(
+ TOGGLE_PAUSE, IDS_DOWNLOAD_MENU_PAUSE_ITEM);
+ in_progress_download_menu_model_->AddItemWithStringId(
+ SHOW_IN_FOLDER, IDS_DOWNLOAD_MENU_SHOW);
+ in_progress_download_menu_model_->AddSeparator();
+ in_progress_download_menu_model_->AddItemWithStringId(
+ CANCEL, IDS_DOWNLOAD_MENU_CANCEL);
-DownloadItem* DownloadShelfContextMenu::download() const {
- return download_;
+ return in_progress_download_menu_model_.get();
}
-bool DownloadShelfContextMenu::IsCommandIdChecked(int command_id) const {
- switch (command_id) {
- case OPEN_WHEN_COMPLETE:
- return download_->open_when_complete();
- case ALWAYS_OPEN_TYPE:
- return download_->ShouldOpenFileBasedOnExtension();
- case TOGGLE_PAUSE:
- return download_->is_paused();
- }
- return false;
+ui::SimpleMenuModel* DownloadShelfContextMenu::GetFinishedMenuModel() {
+ if (finished_download_menu_model_.get())
+ return finished_download_menu_model_.get();
+
+ finished_download_menu_model_.reset(new ui::SimpleMenuModel(this));
+
+ finished_download_menu_model_->AddItemWithStringId(
+ OPEN_WHEN_COMPLETE, IDS_DOWNLOAD_MENU_OPEN);
+ finished_download_menu_model_->AddCheckItemWithStringId(
+ ALWAYS_OPEN_TYPE, IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
+ finished_download_menu_model_->AddSeparator();
+ finished_download_menu_model_->AddItemWithStringId(
+ SHOW_IN_FOLDER, IDS_DOWNLOAD_MENU_SHOW);
+ finished_download_menu_model_->AddSeparator();
+ finished_download_menu_model_->AddItemWithStringId(
+ CANCEL, IDS_DOWNLOAD_MENU_CANCEL);
+
+ return finished_download_menu_model_.get();
}
-string16 DownloadShelfContextMenu::GetLabelForCommandId(int command_id) const {
+bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const {
switch (command_id) {
case SHOW_IN_FOLDER:
- return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_SHOW);
case OPEN_WHEN_COMPLETE:
- if (download_->IsInProgress())
- return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_OPEN_WHEN_COMPLETE);
- return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_OPEN);
+ return !download_item_->IsCancelled();
case ALWAYS_OPEN_TYPE:
- return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
+ return download_item_->CanOpenDownload();
case CANCEL:
- return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_CANCEL);
- case TOGGLE_PAUSE: {
- if (download_->is_paused())
- return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_RESUME_ITEM);
- else
- return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_PAUSE_ITEM);
- }
+ return download_item_->IsPartialDownload();
+ case TOGGLE_PAUSE:
+ return download_item_->IsInProgress();
default:
- NOTREACHED();
+ return command_id > 0 && command_id < MENU_LAST;
}
- return string16();
}
-bool DownloadShelfContextMenu::IsCommandIdEnabled(int command_id) const {
+bool DownloadShelfContextMenu::IsCommandIdChecked(int command_id) const {
switch (command_id) {
- case SHOW_IN_FOLDER:
case OPEN_WHEN_COMPLETE:
- return !download_->IsCancelled();
+ return download_item_->open_when_complete();
case ALWAYS_OPEN_TYPE:
- return download_->CanOpenDownload();
- case CANCEL:
- return download_->IsPartialDownload();
+ return download_item_->ShouldOpenFileBasedOnExtension();
case TOGGLE_PAUSE:
- return download_->IsInProgress();
- default:
- return command_id > 0 && command_id < MENU_LAST;
+ return download_item_->is_paused();
}
+ return false;
}
void DownloadShelfContextMenu::ExecuteCommand(int command_id) {
switch (command_id) {
case SHOW_IN_FOLDER:
- download_->ShowDownloadInShell();
+ download_item_->ShowDownloadInShell();
break;
case OPEN_WHEN_COMPLETE:
- download_->OpenDownload();
+ download_item_->OpenDownload();
break;
case ALWAYS_OPEN_TYPE: {
- download_->OpenFilesBasedOnExtension(
+ download_item_->OpenFilesBasedOnExtension(
!IsCommandIdChecked(ALWAYS_OPEN_TYPE));
break;
}
case CANCEL:
- model_->CancelTask();
+ download_model_->CancelTask();
break;
case TOGGLE_PAUSE:
// It is possible for the download to complete before the user clicks the
// menu item, recheck if the download is in progress state before toggling
// pause.
- if (download_->IsPartialDownload())
- download_->TogglePause();
+ if (download_item_->IsPartialDownload())
+ download_item_->TogglePause();
break;
default:
NOTREACHED();
@@ -115,49 +120,30 @@ bool DownloadShelfContextMenu::GetAcceleratorForCommandId(
return false;
}
-bool DownloadShelfContextMenu::IsItemForCommandIdDynamic(
- int command_id) const {
+bool DownloadShelfContextMenu::IsItemForCommandIdDynamic(int command_id) const {
return command_id == TOGGLE_PAUSE;
}
-ui::SimpleMenuModel* DownloadShelfContextMenu::GetInProgressMenuModel() {
- if (in_progress_download_menu_model_.get())
- return in_progress_download_menu_model_.get();
-
- in_progress_download_menu_model_.reset(new ui::SimpleMenuModel(this));
-
- in_progress_download_menu_model_->AddCheckItemWithStringId(
- OPEN_WHEN_COMPLETE, IDS_DOWNLOAD_MENU_OPEN_WHEN_COMPLETE);
- in_progress_download_menu_model_->AddCheckItemWithStringId(
- ALWAYS_OPEN_TYPE, IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
- in_progress_download_menu_model_->AddSeparator();
- in_progress_download_menu_model_->AddItemWithStringId(
- TOGGLE_PAUSE, IDS_DOWNLOAD_MENU_PAUSE_ITEM);
- in_progress_download_menu_model_->AddItemWithStringId(
- SHOW_IN_FOLDER, IDS_DOWNLOAD_MENU_SHOW);
- in_progress_download_menu_model_->AddSeparator();
- in_progress_download_menu_model_->AddItemWithStringId(
- CANCEL, IDS_DOWNLOAD_MENU_CANCEL);
-
- return in_progress_download_menu_model_.get();
-}
-
-ui::SimpleMenuModel* DownloadShelfContextMenu::GetFinishedMenuModel() {
- if (finished_download_menu_model_.get())
- return finished_download_menu_model_.get();
-
- finished_download_menu_model_.reset(new ui::SimpleMenuModel(this));
-
- finished_download_menu_model_->AddItemWithStringId(
- OPEN_WHEN_COMPLETE, IDS_DOWNLOAD_MENU_OPEN);
- finished_download_menu_model_->AddCheckItemWithStringId(
- ALWAYS_OPEN_TYPE, IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
- finished_download_menu_model_->AddSeparator();
- finished_download_menu_model_->AddItemWithStringId(
- SHOW_IN_FOLDER, IDS_DOWNLOAD_MENU_SHOW);
- finished_download_menu_model_->AddSeparator();
- finished_download_menu_model_->AddItemWithStringId(
- CANCEL, IDS_DOWNLOAD_MENU_CANCEL);
-
- return finished_download_menu_model_.get();
+string16 DownloadShelfContextMenu::GetLabelForCommandId(int command_id) const {
+ switch (command_id) {
+ case SHOW_IN_FOLDER:
+ return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_SHOW);
+ case OPEN_WHEN_COMPLETE:
+ if (download_item_->IsInProgress())
+ return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_OPEN_WHEN_COMPLETE);
+ return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_OPEN);
+ case ALWAYS_OPEN_TYPE:
+ return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE);
+ case CANCEL:
+ return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_CANCEL);
+ case TOGGLE_PAUSE: {
+ if (download_item_->is_paused())
+ return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_RESUME_ITEM);
+ else
+ return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_PAUSE_ITEM);
+ }
+ default:
+ NOTREACHED();
+ }
+ return string16();
}
diff --git a/chrome/browser/download/download_shelf_context_menu.h b/chrome/browser/download/download_shelf_context_menu.h
new file mode 100644
index 0000000..8f9b4c7
--- /dev/null
+++ b/chrome/browser/download/download_shelf_context_menu.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_
+#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/string16.h"
+#include "ui/base/models/simple_menu_model.h"
+
+class BaseDownloadItemModel;
+class DownloadItem;
+
+// This class is responsible for the download shelf context menu. Platform
+// specific subclasses are responsible for creating and running the menu.
+class DownloadShelfContextMenu : public ui::SimpleMenuModel::Delegate {
+ public:
+ enum ContextMenuCommands {
+ SHOW_IN_FOLDER = 1, // Open a file explorer window with the item selected.
+ OPEN_WHEN_COMPLETE, // Open the download when it's finished.
+ ALWAYS_OPEN_TYPE, // Default this file extension to always open.
+ CANCEL, // Cancel the download.
+ TOGGLE_PAUSE, // Temporarily pause a download.
+ MENU_LAST
+ };
+
+ virtual ~DownloadShelfContextMenu();
+
+ DownloadItem* download_item() const { return download_item_; }
+ void set_download_item(DownloadItem* item) { download_item_ = item; }
+
+ protected:
+ explicit DownloadShelfContextMenu(BaseDownloadItemModel* download_model);
+
+ ui::SimpleMenuModel* GetInProgressMenuModel();
+ ui::SimpleMenuModel* GetFinishedMenuModel();
+
+ // ui::SimpleMenuModel::Delegate:
+ virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
+ virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
+ virtual void ExecuteCommand(int command_id) OVERRIDE;
+ virtual bool GetAcceleratorForCommandId(
+ int command_id,
+ ui::Accelerator* accelerator) OVERRIDE;
+ virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
+ virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE;
+
+ private:
+ // We show slightly different menus if the download is in progress vs. if the
+ // download has finished.
+ scoped_ptr<ui::SimpleMenuModel> in_progress_download_menu_model_;
+ scoped_ptr<ui::SimpleMenuModel> finished_download_menu_model_;
+
+ // A model to control the cancel behavior.
+ BaseDownloadItemModel* download_model_;
+
+ // Information source.
+ DownloadItem* download_item_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu);
+};
+
+#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_
diff --git a/chrome/browser/ui/cocoa/download/download_item_controller.mm b/chrome/browser/ui/cocoa/download/download_item_controller.mm
index 6d92901..9f2bef0 100644
--- a/chrome/browser/ui/cocoa/download/download_item_controller.mm
+++ b/chrome/browser/ui/cocoa/download/download_item_controller.mm
@@ -12,7 +12,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/download/download_item.h"
#include "chrome/browser/download/download_item_model.h"
-#include "chrome/browser/download/download_shelf.h"
+#include "chrome/browser/download/download_shelf_context_menu.h"
#include "chrome/browser/download/download_util.h"
#import "chrome/browser/themes/theme_service.h"
#import "chrome/browser/ui/cocoa/download/download_item_button.h"
diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.cc b/chrome/browser/ui/gtk/download/download_item_gtk.cc
index 371ec007..988db58 100644
--- a/chrome/browser/ui/gtk/download/download_item_gtk.cc
+++ b/chrome/browser/ui/gtk/download/download_item_gtk.cc
@@ -14,7 +14,7 @@
#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_shelf_context_menu.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/gtk/custom_drag.h"
@@ -91,7 +91,7 @@ class DownloadShelfContextMenuGtk : public DownloadShelfContextMenu,
DownloadShelfContextMenuGtk(BaseDownloadItemModel* model,
DownloadItemGtk* download_item)
: DownloadShelfContextMenu(model),
- download_item_(download_item) {
+ download_item_gtk_(download_item) {
}
~DownloadShelfContextMenuGtk() {
@@ -100,7 +100,7 @@ class DownloadShelfContextMenuGtk : public DownloadShelfContextMenu,
void Popup(GtkWidget* widget, GdkEventButton* event) {
// Create the menu if we have not created it yet or we created it for
// an in-progress download that has since completed.
- if (download_->IsComplete())
+ if (download_item()->IsComplete())
menu_.reset(new MenuGtk(this, GetFinishedMenuModel()));
else
menu_.reset(new MenuGtk(this, GetInProgressMenuModel()));
@@ -114,8 +114,8 @@ class DownloadShelfContextMenuGtk : public DownloadShelfContextMenu,
// MenuGtk::Delegate implementation:
virtual void StoppedShowing() {
- download_item_->menu_showing_ = false;
- gtk_widget_queue_draw(download_item_->menu_button_);
+ download_item_gtk_->menu_showing_ = false;
+ gtk_widget_queue_draw(download_item_gtk_->menu_button_);
}
virtual GtkWidget* GetImageForCommandId(int command_id) const {
@@ -147,7 +147,7 @@ class DownloadShelfContextMenuGtk : public DownloadShelfContextMenu,
scoped_ptr<MenuGtk> menu_;
// The download item that created us.
- DownloadItemGtk* download_item_;
+ DownloadItemGtk* download_item_gtk_;
};
// DownloadItemGtk -------------------------------------------------------------
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index 5de7eb3..87ad63e 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -16,6 +16,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_item_model.h"
+#include "chrome/browser/download/download_shelf_context_menu.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/views/download/download_shelf_view.h"
@@ -88,7 +89,7 @@ class DownloadShelfContextMenuWin : public DownloadShelfContextMenu {
}
void Run(const gfx::Point& point) {
- if (download_->IsComplete())
+ if (download_item()->IsComplete())
menu_.reset(new views::Menu2(GetFinishedMenuModel()));
else
menu_.reset(new views::Menu2(GetInProgressMenuModel()));
@@ -105,7 +106,7 @@ class DownloadShelfContextMenuWin : public DownloadShelfContextMenu {
// This method runs when the caller has been deleted and we should not attempt
// to access |download_|.
void Stop() {
- download_ = NULL;
+ set_download_item(NULL);
}
private:
@@ -671,7 +672,7 @@ void DownloadItemView::ShowContextMenu(const gfx::Point& p,
// If the menu action was to remove the download, this view will also be
// invalid so we must not access 'this' in this case.
- if (context_menu_->download()) {
+ if (context_menu_->download_item()) {
drop_down_pressed_ = false;
// Showing the menu blocks. Here we revert the state.
SetState(NORMAL, NORMAL);
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 7937bf6..524ecc4 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -808,8 +808,9 @@
'browser/download/download_request_limiter.h',
'browser/download/download_safe_browsing_client.cc',
'browser/download/download_safe_browsing_client.h',
- 'browser/download/download_shelf.cc',
'browser/download/download_shelf.h',
+ 'browser/download/download_shelf_context_menu.cc',
+ 'browser/download/download_shelf_context_menu.h',
'browser/download/download_started_animation.h',
'browser/download/download_status_updater.cc',
'browser/download/download_status_updater.h',