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 #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 "chrome/browser/ui/views/download/download_item_view.h" |
14 #include "ui/base/ui_base_types.h" | 15 #include "ui/base/ui_base_types.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class DownloadItem; | 18 class DownloadItem; |
18 class PageNavigator; | 19 class PageNavigator; |
19 } | 20 } |
20 | 21 |
21 namespace gfx { | 22 namespace gfx { |
22 class Rect; | 23 class Rect; |
23 } | 24 } |
24 | 25 |
25 namespace views { | 26 namespace views { |
26 class MenuRunner; | 27 class MenuRunner; |
27 class Widget; | 28 class Widget; |
28 } | 29 } |
29 | 30 |
30 class DownloadShelfContextMenuView : public DownloadShelfContextMenu { | 31 class DownloadShelfContextMenuView : public DownloadShelfContextMenu { |
31 public: | 32 public: |
32 explicit DownloadShelfContextMenuView(content::DownloadItem* download_item); | 33 explicit DownloadShelfContextMenuView(DownloadItemView* download_item_view); |
33 ~DownloadShelfContextMenuView() override; | 34 ~DownloadShelfContextMenuView() override; |
34 | 35 |
35 base::TimeTicks close_time() const { return close_time_; } | 36 base::TimeTicks close_time() const { return close_time_; } |
36 | 37 |
37 // |rect| is the bounding area for positioning the menu in screen coordinates. | 38 // |rect| is the bounding area for positioning the menu in screen coordinates. |
38 // The menu will be positioned above or below but not overlapping |rect|. | 39 // The menu will be positioned above or below but not overlapping |rect|. |
39 void Run(views::Widget* parent_widget, | 40 void Run(views::Widget* parent_widget, |
40 const gfx::Rect& rect, | 41 const gfx::Rect& rect, |
41 ui::MenuSourceType source_type, | 42 ui::MenuSourceType source_type, |
42 const base::Closure& on_menu_closed_callback); | 43 const base::Closure& on_menu_closed_callback); |
43 | 44 |
44 private: | 45 private: |
45 // Callback for MenuRunner. | 46 // Callback for MenuRunner. |
46 void OnMenuClosed(const base::Closure& on_menu_closed_callback); | 47 void OnMenuClosed(const base::Closure& on_menu_closed_callback); |
47 | 48 |
| 49 void ExecuteCommand(int command_id, int event_flags) override; |
| 50 |
| 51 // Parent download item view. |
| 52 DownloadItemView* download_item_view_; |
| 53 |
48 std::unique_ptr<views::MenuRunner> menu_runner_; | 54 std::unique_ptr<views::MenuRunner> menu_runner_; |
49 | 55 |
50 // Time the menu was closed. | 56 // Time the menu was closed. |
51 base::TimeTicks close_time_; | 57 base::TimeTicks close_time_; |
52 | 58 |
53 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuView); | 59 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuView); |
54 }; | 60 }; |
55 | 61 |
56 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_ | 62 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_ |
OLD | NEW |