| 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_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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 views::Widget* parent_widget, | 23 views::Widget* parent_widget, |
| 24 const gfx::Rect& rect, | 24 const gfx::Rect& rect, |
| 25 ui::MenuSourceType source_type, | 25 ui::MenuSourceType source_type, |
| 26 const base::Closure& on_menu_closed_callback) { | 26 const base::Closure& on_menu_closed_callback) { |
| 27 ui::MenuModel* menu_model = GetMenuModel(); | 27 ui::MenuModel* menu_model = GetMenuModel(); |
| 28 // Run() should not be getting called if the DownloadItem was destroyed. | 28 // Run() should not be getting called if the DownloadItem was destroyed. |
| 29 DCHECK(menu_model); | 29 DCHECK(menu_model); |
| 30 | 30 |
| 31 menu_runner_.reset(new views::MenuRunner( | 31 menu_runner_.reset(new views::MenuRunner( |
| 32 menu_model, | 32 menu_model, |
| 33 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU | | 33 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU, |
| 34 views::MenuRunner::ASYNC, | |
| 35 base::Bind(&DownloadShelfContextMenuView::OnMenuClosed, | 34 base::Bind(&DownloadShelfContextMenuView::OnMenuClosed, |
| 36 base::Unretained(this), on_menu_closed_callback))); | 35 base::Unretained(this), on_menu_closed_callback))); |
| 37 | 36 |
| 38 // The menu's alignment is determined based on the UI layout. | 37 // The menu's alignment is determined based on the UI layout. |
| 39 views::MenuAnchorPosition position; | 38 views::MenuAnchorPosition position; |
| 40 if (base::i18n::IsRTL()) | 39 if (base::i18n::IsRTL()) |
| 41 position = views::MENU_ANCHOR_TOPRIGHT; | 40 position = views::MENU_ANCHOR_TOPRIGHT; |
| 42 else | 41 else |
| 43 position = views::MENU_ANCHOR_TOPLEFT; | 42 position = views::MENU_ANCHOR_TOPLEFT; |
| 44 | 43 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 62 static_cast<DownloadCommands::Command>(command_id); | 61 static_cast<DownloadCommands::Command>(command_id); |
| 63 DCHECK_NE(command, DownloadCommands::DISCARD); | 62 DCHECK_NE(command, DownloadCommands::DISCARD); |
| 64 | 63 |
| 65 if (command == DownloadCommands::KEEP) { | 64 if (command == DownloadCommands::KEEP) { |
| 66 download_item_view_->MaybeSubmitDownloadToFeedbackService( | 65 download_item_view_->MaybeSubmitDownloadToFeedbackService( |
| 67 DownloadCommands::KEEP); | 66 DownloadCommands::KEEP); |
| 68 } else { | 67 } else { |
| 69 DownloadShelfContextMenu::ExecuteCommand(command_id, event_flags); | 68 DownloadShelfContextMenu::ExecuteCommand(command_id, event_flags); |
| 70 } | 69 } |
| 71 } | 70 } |
| OLD | NEW |