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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/download/download_shelf_context_menu.h" | 12 #include "chrome/browser/download/download_shelf_context_menu.h" |
13 | 13 |
14 class BaseDownloadItemModel; | 14 class BaseDownloadItemModel; |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Rect; | 17 class Rect; |
18 } | 18 } |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 class MenuRunner; | 21 class MenuRunner; |
22 class Widget; | 22 class Widget; |
23 } | 23 } |
24 | 24 |
25 class DownloadShelfContextMenuView : public DownloadShelfContextMenu { | 25 class DownloadShelfContextMenuView : public DownloadShelfContextMenu { |
26 public: | 26 public: |
27 explicit DownloadShelfContextMenuView(BaseDownloadItemModel* model); | 27 explicit DownloadShelfContextMenuView(BaseDownloadItemModel* model); |
28 virtual ~DownloadShelfContextMenuView(); | 28 virtual ~DownloadShelfContextMenuView(); |
29 | 29 |
30 // Returns true if menu has been deleted. |rect| is the bounding area for | 30 // |rect| is the bounding area for positioning the menu in screen coordinates. |
31 // positioning the menu in screen coordinates. The menu will be positioned | 31 // The menu will be positioned above or below but not overlapping |rect|. |
32 // above or below but not overlapping |rect|. | 32 void Run(views::Widget* parent_widget, const gfx::Rect& rect); |
33 bool Run(views::Widget* parent_widget, | |
34 const gfx::Rect& rect) WARN_UNUSED_RESULT; | |
35 | |
36 // This method runs when the caller has been deleted and we should not attempt | |
37 // to access download_item(). | |
38 void Stop(); | |
39 | 33 |
40 private: | 34 private: |
41 scoped_ptr<views::MenuRunner> menu_runner_; | 35 scoped_ptr<views::MenuRunner> menu_runner_; |
42 | 36 |
43 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuView); | 37 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenuView); |
44 }; | 38 }; |
45 | 39 |
46 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_ | 40 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_VIEW_H_ |
OLD | NEW |