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

Side by Side Diff: chrome/browser/ui/views/download/download_shelf_context_menu_view.cc

Issue 10421021: Make DownloadProtectionService not use BrowserList::GetLastActive() to load a link. Instead pass th… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_model.h" 9 #include "chrome/browser/download/download_item_model.h"
10 #include "content/public/browser/download_item.h" 10 #include "content/public/browser/download_item.h"
11 #include "content/public/browser/page_navigator.h"
11 #include "ui/gfx/point.h" 12 #include "ui/gfx/point.h"
12 #include "ui/views/controls/menu/menu_item_view.h" 13 #include "ui/views/controls/menu/menu_item_view.h"
13 #include "ui/views/controls/menu/menu_model_adapter.h" 14 #include "ui/views/controls/menu/menu_model_adapter.h"
14 #include "ui/views/controls/menu/menu_runner.h" 15 #include "ui/views/controls/menu/menu_runner.h"
15 16
16 DownloadShelfContextMenuView::DownloadShelfContextMenuView( 17 DownloadShelfContextMenuView::DownloadShelfContextMenuView(
17 BaseDownloadItemModel* model) 18 BaseDownloadItemModel* model,
18 : DownloadShelfContextMenu(model) { 19 content::PageNavigator* navigator)
20 : DownloadShelfContextMenu(model, navigator) {
19 } 21 }
20 22
21 DownloadShelfContextMenuView::~DownloadShelfContextMenuView() {} 23 DownloadShelfContextMenuView::~DownloadShelfContextMenuView() {}
22 24
23 void DownloadShelfContextMenuView::Run(views::Widget* parent_widget, 25 void DownloadShelfContextMenuView::Run(views::Widget* parent_widget,
24 const gfx::Rect& rect) { 26 const gfx::Rect& rect) {
25 views::MenuModelAdapter menu_model_adapter(GetMenuModel()); 27 views::MenuModelAdapter menu_model_adapter(GetMenuModel());
26 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu())); 28 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu()));
27 29
28 // The menu's alignment is determined based on the UI layout. 30 // The menu's alignment is determined based on the UI layout.
29 views::MenuItemView::AnchorPosition position; 31 views::MenuItemView::AnchorPosition position;
30 if (base::i18n::IsRTL()) 32 if (base::i18n::IsRTL())
31 position = views::MenuItemView::TOPRIGHT; 33 position = views::MenuItemView::TOPRIGHT;
32 else 34 else
33 position = views::MenuItemView::TOPLEFT; 35 position = views::MenuItemView::TOPLEFT;
34 36
35 // The return value of RunMenuAt indicates whether the MenuRunner was deleted 37 // The return value of RunMenuAt indicates whether the MenuRunner was deleted
36 // while running the menu, which indicates that the containing view may have 38 // while running the menu, which indicates that the containing view may have
37 // been deleted. We ignore the return value because our caller already assumes 39 // been deleted. We ignore the return value because our caller already assumes
38 // that the view could be deleted by the time we return from here. 40 // that the view could be deleted by the time we return from here.
39 ignore_result(menu_runner_->RunMenuAt( 41 ignore_result(menu_runner_->RunMenuAt(
40 parent_widget, 42 parent_widget,
41 NULL, 43 NULL,
42 rect, 44 rect,
43 position, 45 position,
44 views::MenuRunner::HAS_MNEMONICS)); 46 views::MenuRunner::HAS_MNEMONICS));
45 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698