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

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

Issue 2394123002: Views: Expose an on_closed callback via the MenuRunner constructor. (Closed)
Patch Set: default arg Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_shelf_context_menu_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "chrome/browser/download/download_shelf_context_menu.h" 13 #include "chrome/browser/download/download_shelf_context_menu.h"
14 #include "ui/base/ui_base_types.h" 14 #include "ui/base/ui_base_types.h"
15 15
16 namespace content { 16 namespace content {
17 class DownloadItem; 17 class DownloadItem;
18 class PageNavigator; 18 class PageNavigator;
19 } 19 }
20 20
21 namespace gfx { 21 namespace gfx {
22 class Rect; 22 class Rect;
23 } 23 }
24 24
25 namespace views { 25 namespace views {
26 class MenuModelAdapter;
27 class MenuRunner; 26 class MenuRunner;
28 class Widget; 27 class Widget;
29 } 28 }
30 29
31 class DownloadShelfContextMenuView : public DownloadShelfContextMenu { 30 class DownloadShelfContextMenuView : public DownloadShelfContextMenu {
32 public: 31 public:
33 explicit DownloadShelfContextMenuView(content::DownloadItem* download_item); 32 explicit DownloadShelfContextMenuView(content::DownloadItem* download_item);
34 ~DownloadShelfContextMenuView() override; 33 ~DownloadShelfContextMenuView() override;
35 34
36 base::TimeTicks close_time() const { return close_time_; } 35 base::TimeTicks close_time() const { return close_time_; }
37 36
38 // |rect| is the bounding area for positioning the menu in screen coordinates. 37 // |rect| is the bounding area for positioning the menu in screen coordinates.
39 // The menu will be positioned above or below but not overlapping |rect|. 38 // The menu will be positioned above or below but not overlapping |rect|.
40 void Run(views::Widget* parent_widget, 39 void Run(views::Widget* parent_widget,
41 const gfx::Rect& rect, 40 const gfx::Rect& rect,
42 ui::MenuSourceType source_type, 41 ui::MenuSourceType source_type,
43 const base::Closure& on_menu_closed_callback); 42 const base::Closure& on_menu_closed_callback);
44 43
45 private: 44 private:
46 // Callback for MenuModelAdapter 45 // Callback for MenuRunner.
47 void OnMenuClosed(const base::Closure& on_menu_closed_callback); 46 void OnMenuClosed(const base::Closure& on_menu_closed_callback);
48 47
49 std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_;
50 std::unique_ptr<views::MenuRunner> menu_runner_; 48 std::unique_ptr<views::MenuRunner> menu_runner_;
51 49
52 // Time the menu was closed. 50 // Time the menu was closed.
53 base::TimeTicks close_time_; 51 base::TimeTicks close_time_;
54 52
55 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuView); 53 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuView);
56 }; 54 };
57 55
58 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_ 56 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_shelf_context_menu_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698