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

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

Issue 2439533002: Download Feedback Service should upload all eligible downloads (Closed)
Patch Set: nit function renaming Created 4 years, 1 month 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
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 "content/public/browser/page_navigator.h"
12 #include "ui/gfx/geometry/point.h" 12 #include "ui/gfx/geometry/point.h"
13 #include "ui/views/controls/menu/menu_runner.h" 13 #include "ui/views/controls/menu/menu_runner.h"
14 14
15 DownloadShelfContextMenuView::DownloadShelfContextMenuView( 15 DownloadShelfContextMenuView::DownloadShelfContextMenuView(
16 content::DownloadItem* download_item) 16 DownloadItemView* download_item_view)
17 : DownloadShelfContextMenu(download_item) { 17 : DownloadShelfContextMenu(download_item_view->download()),
18 } 18 download_item_view_(download_item_view) {}
19 19
20 DownloadShelfContextMenuView::~DownloadShelfContextMenuView() {} 20 DownloadShelfContextMenuView::~DownloadShelfContextMenuView() {}
21 21
22 void DownloadShelfContextMenuView::Run( 22 void DownloadShelfContextMenuView::Run(
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.
(...skipping 19 matching lines...) Expand all
48 void DownloadShelfContextMenuView::OnMenuClosed( 48 void DownloadShelfContextMenuView::OnMenuClosed(
49 const base::Closure& on_menu_closed_callback) { 49 const base::Closure& on_menu_closed_callback) {
50 close_time_ = base::TimeTicks::Now(); 50 close_time_ = base::TimeTicks::Now();
51 51
52 // This must be run before clearing |menu_runner_| who owns the reference. 52 // This must be run before clearing |menu_runner_| who owns the reference.
53 if (!on_menu_closed_callback.is_null()) 53 if (!on_menu_closed_callback.is_null())
54 on_menu_closed_callback.Run(); 54 on_menu_closed_callback.Run();
55 55
56 menu_runner_.reset(); 56 menu_runner_.reset();
57 } 57 }
58
59 void DownloadShelfContextMenuView::ExecuteCommand(int command_id,
60 int event_flags) {
61 if (static_cast<DownloadCommands::Command>(command_id) ==
62 DownloadCommands::KEEP) {
63 if (download_item_view_->ShouldAllowDownloadFeedback())
Peter Kasting 2016/10/24 21:39:07 Nit: Can combine this if with the outer one
Jialiu Lin 2016/10/25 21:07:10 Done.
64 download_item_view_->MaybeSubmitDownloadToFeedbackService(
65 DownloadCommands::KEEP);
66 }
67 DownloadShelfContextMenu::ExecuteCommand(command_id, event_flags);
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698