Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5158)

Unified Diff: chrome/browser/ui/views/download/download_shelf_context_menu_view.cc

Issue 7056001: views: Split DownloadShelfContextMenuWin out to its own header file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asanka review Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/download/download_shelf_context_menu_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/download/download_shelf_context_menu_view.cc
diff --git a/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc b/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fb2736d5785bad1043f1e942b03b06f9934d5478
--- /dev/null
+++ b/chrome/browser/ui/views/download/download_shelf_context_menu_view.cc
@@ -0,0 +1,39 @@
+// 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.
+
+#include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h"
+
+#include "base/i18n/rtl.h"
+#include "base/logging.h"
+#include "chrome/browser/download/download_item.h"
+#include "chrome/browser/download/download_item_model.h"
+#include "ui/gfx/point.h"
+#include "views/controls/menu/menu_2.h"
+
+DownloadShelfContextMenuView::DownloadShelfContextMenuView(
+ BaseDownloadItemModel* model)
+ : DownloadShelfContextMenu(model) {
+ DCHECK(model);
+}
+
+DownloadShelfContextMenuView::~DownloadShelfContextMenuView() {}
+
+void DownloadShelfContextMenuView::Run(const gfx::Point& point) {
+ if (download_item()->IsComplete())
dmazzoni 2011/05/22 04:39:49 Just a thought, but I wonder why DownloadShelfCont
+ menu_.reset(new views::Menu2(GetFinishedMenuModel()));
+ else
+ menu_.reset(new views::Menu2(GetInProgressMenuModel()));
+
+ // The menu's alignment is determined based on the UI layout.
+ views::Menu2::Alignment alignment;
+ if (base::i18n::IsRTL())
+ alignment = views::Menu2::ALIGN_TOPRIGHT;
+ else
+ alignment = views::Menu2::ALIGN_TOPLEFT;
+ menu_->RunMenuAt(point, alignment);
+}
+
+void DownloadShelfContextMenuView::Stop() {
+ set_download_item(NULL);
+}
« no previous file with comments | « chrome/browser/ui/views/download/download_shelf_context_menu_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698