OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" | 5 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/download/download_item.h" | |
10 #include "chrome/browser/download/download_item_model.h" | 9 #include "chrome/browser/download/download_item_model.h" |
| 10 #include "content/browser/download/download_item.h" |
11 #include "ui/gfx/point.h" | 11 #include "ui/gfx/point.h" |
12 #include "views/controls/menu/menu_2.h" | 12 #include "views/controls/menu/menu_2.h" |
13 | 13 |
14 DownloadShelfContextMenuView::DownloadShelfContextMenuView( | 14 DownloadShelfContextMenuView::DownloadShelfContextMenuView( |
15 BaseDownloadItemModel* model) | 15 BaseDownloadItemModel* model) |
16 : DownloadShelfContextMenu(model) { | 16 : DownloadShelfContextMenu(model) { |
17 DCHECK(model); | 17 DCHECK(model); |
18 } | 18 } |
19 | 19 |
20 DownloadShelfContextMenuView::~DownloadShelfContextMenuView() {} | 20 DownloadShelfContextMenuView::~DownloadShelfContextMenuView() {} |
21 | 21 |
22 void DownloadShelfContextMenuView::Run(const gfx::Point& point) { | 22 void DownloadShelfContextMenuView::Run(const gfx::Point& point) { |
23 menu_.reset(new views::Menu2(GetMenuModel())); | 23 menu_.reset(new views::Menu2(GetMenuModel())); |
24 | 24 |
25 // The menu's alignment is determined based on the UI layout. | 25 // The menu's alignment is determined based on the UI layout. |
26 views::Menu2::Alignment alignment; | 26 views::Menu2::Alignment alignment; |
27 if (base::i18n::IsRTL()) | 27 if (base::i18n::IsRTL()) |
28 alignment = views::Menu2::ALIGN_TOPRIGHT; | 28 alignment = views::Menu2::ALIGN_TOPRIGHT; |
29 else | 29 else |
30 alignment = views::Menu2::ALIGN_TOPLEFT; | 30 alignment = views::Menu2::ALIGN_TOPLEFT; |
31 menu_->RunMenuAt(point, alignment); | 31 menu_->RunMenuAt(point, alignment); |
32 } | 32 } |
33 | 33 |
34 void DownloadShelfContextMenuView::Stop() { | 34 void DownloadShelfContextMenuView::Stop() { |
35 set_download_item(NULL); | 35 set_download_item(NULL); |
36 } | 36 } |
OLD | NEW |