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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_context_menu.h

Issue 1647003002: Make bookmark context menu asynchronous (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@b564255_move_key_handler_out_of_message_loop
Patch Set: Removed WARN_UNUSED_RESULT (cont.) Created 4 years, 10 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/bookmarks/bookmark_context_menu.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_BOOKMARKS_BOOKMARK_CONTEXT_MENU_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_CONTEXT_MENU_H_
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_CONTEXT_MENU_H_ 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_CONTEXT_MENU_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" 10 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h"
11 #include "ui/views/controls/menu/menu_delegate.h" 11 #include "ui/views/controls/menu/menu_delegate.h"
12 12
13 class Browser; 13 class Browser;
14 14
15 namespace views { 15 namespace views {
16 class MenuRunner; 16 class MenuRunner;
17 class Widget; 17 class Widget;
18 } 18 }
19 19
20 // Observer for the BookmarkContextMenu. 20 // Observer for the BookmarkContextMenu.
21 class BookmarkContextMenuObserver { 21 class BookmarkContextMenuObserver {
22 public: 22 public:
23 // Invoked before the specified items are removed from the bookmark model. 23 // Invoked before the specified items are removed from the bookmark model.
24 virtual void WillRemoveBookmarks( 24 virtual void WillRemoveBookmarks(
25 const std::vector<const bookmarks::BookmarkNode*>& bookmarks) = 0; 25 const std::vector<const bookmarks::BookmarkNode*>& bookmarks) = 0;
26 26
27 // Invoked after the items have been removed from the model. 27 // Invoked after the items have been removed from the model.
28 virtual void DidRemoveBookmarks() = 0; 28 virtual void DidRemoveBookmarks() = 0;
29 29
30 // Invoked when the context menu is closed.
31 virtual void OnContextMenuClosed() = 0;
32
30 protected: 33 protected:
31 virtual ~BookmarkContextMenuObserver() {} 34 virtual ~BookmarkContextMenuObserver() {}
32 }; 35 };
33 36
34 class BookmarkContextMenu : public BookmarkContextMenuControllerDelegate, 37 class BookmarkContextMenu : public BookmarkContextMenuControllerDelegate,
35 public views::MenuDelegate { 38 public views::MenuDelegate {
36 public: 39 public:
37 // |browser| is used to open the bookmark manager, and is NULL in tests. 40 // |browser| is used to open the bookmark manager, and is NULL in tests.
38 BookmarkContextMenu( 41 BookmarkContextMenu(
39 views::Widget* parent_widget, 42 views::Widget* parent_widget,
(...skipping 17 matching lines...) Expand all
57 60
58 // Sets the PageNavigator. 61 // Sets the PageNavigator.
59 void SetPageNavigator(content::PageNavigator* navigator); 62 void SetPageNavigator(content::PageNavigator* navigator);
60 63
61 // Overridden from views::MenuDelegate: 64 // Overridden from views::MenuDelegate:
62 void ExecuteCommand(int command_id, int event_flags) override; 65 void ExecuteCommand(int command_id, int event_flags) override;
63 bool IsItemChecked(int command_id) const override; 66 bool IsItemChecked(int command_id) const override;
64 bool IsCommandEnabled(int command_id) const override; 67 bool IsCommandEnabled(int command_id) const override;
65 bool IsCommandVisible(int command_id) const override; 68 bool IsCommandVisible(int command_id) const override;
66 bool ShouldCloseAllMenusOnExecute(int id) override; 69 bool ShouldCloseAllMenusOnExecute(int id) override;
70 void OnMenuClosed(views::MenuItemView* menu,
71 views::MenuRunner::RunResult result) override;
67 72
68 // Overridden from BookmarkContextMenuControllerDelegate: 73 // Overridden from BookmarkContextMenuControllerDelegate:
69 void CloseMenu() override; 74 void CloseMenu() override;
70 void WillExecuteCommand( 75 void WillExecuteCommand(
71 int command_id, 76 int command_id,
72 const std::vector<const bookmarks::BookmarkNode*>& bookmarks) override; 77 const std::vector<const bookmarks::BookmarkNode*>& bookmarks) override;
73 void DidExecuteCommand(int command_id) override; 78 void DidExecuteCommand(int command_id) override;
74 79
75 private: 80 private:
76 scoped_ptr<BookmarkContextMenuController> controller_; 81 scoped_ptr<BookmarkContextMenuController> controller_;
77 82
78 // The parent of dialog boxes opened from the context menu. 83 // The parent of dialog boxes opened from the context menu.
79 views::Widget* parent_widget_; 84 views::Widget* parent_widget_;
80 85
81 // The menu itself. This is owned by |menu_runner_|. 86 // The menu itself. This is owned by |menu_runner_|.
82 views::MenuItemView* menu_; 87 views::MenuItemView* menu_;
83 88
84 // Responsible for running the menu. 89 // Responsible for running the menu.
85 scoped_ptr<views::MenuRunner> menu_runner_; 90 scoped_ptr<views::MenuRunner> menu_runner_;
86 91
87 BookmarkContextMenuObserver* observer_; 92 BookmarkContextMenuObserver* observer_;
88 93
89 // Should the menu close when a node is removed. 94 // Should the menu close when a node is removed.
90 bool close_on_remove_; 95 bool close_on_remove_;
91 96
92 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenu); 97 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenu);
93 }; 98 };
94 99
95 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_CONTEXT_MENU_H_ 100 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_CONTEXT_MENU_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698