| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 ui::Accelerator* accelerator) OVERRIDE; | 69 ui::Accelerator* accelerator) OVERRIDE; |
| 70 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 70 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
| 71 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; | 71 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; |
| 72 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; | 72 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; |
| 73 | 73 |
| 74 void set_navigator(content::PageNavigator* navigator) { | 74 void set_navigator(content::PageNavigator* navigator) { |
| 75 navigator_ = navigator; | 75 navigator_ = navigator; |
| 76 } | 76 } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 // A hook so that platform-specific implementations can report which commands | |
| 80 // are enabled. Returns true if |enabled| was set by the platform-specific | |
| 81 // implementation. | |
| 82 bool IsPlatformCommandIdEnabled(int command_id, bool* enabled) const; | |
| 83 | |
| 84 // A hook to execute platform-specific commands. Returns true if the command | |
| 85 // has been handled and should no longer be processed. | |
| 86 bool ExecutePlatformCommand(int command_id, int event_flags); | |
| 87 | |
| 88 void BuildMenu(); | 79 void BuildMenu(); |
| 89 | 80 |
| 90 // Adds a IDC_* style command to the menu with a localized string. | 81 // Adds a IDC_* style command to the menu with a localized string. |
| 91 void AddItem(int id, int localization_id); | 82 void AddItem(int id, int localization_id); |
| 92 // Adds a separator to the menu. | 83 // Adds a separator to the menu. |
| 93 void AddSeparator(); | 84 void AddSeparator(); |
| 94 // Adds a checkable item to the menu. | 85 // Adds a checkable item to the menu. |
| 95 void AddCheckboxItem(int id, int localization_id); | 86 void AddCheckboxItem(int id, int localization_id); |
| 96 | 87 |
| 97 // Overridden from BaseBookmarkModelObserver: | 88 // Overridden from BaseBookmarkModelObserver: |
| 98 // Any change to the model results in closing the menu. | 89 // Any change to the model results in closing the menu. |
| 99 virtual void BookmarkModelChanged() OVERRIDE; | 90 virtual void BookmarkModelChanged() OVERRIDE; |
| 100 | 91 |
| 101 gfx::NativeWindow parent_window_; | 92 gfx::NativeWindow parent_window_; |
| 102 BookmarkContextMenuControllerDelegate* delegate_; | 93 BookmarkContextMenuControllerDelegate* delegate_; |
| 103 Browser* browser_; | 94 Browser* browser_; |
| 104 Profile* profile_; | 95 Profile* profile_; |
| 105 content::PageNavigator* navigator_; | 96 content::PageNavigator* navigator_; |
| 106 const BookmarkNode* parent_; | 97 const BookmarkNode* parent_; |
| 107 std::vector<const BookmarkNode*> selection_; | 98 std::vector<const BookmarkNode*> selection_; |
| 108 BookmarkModel* model_; | 99 BookmarkModel* model_; |
| 109 scoped_ptr<ui::SimpleMenuModel> menu_model_; | 100 scoped_ptr<ui::SimpleMenuModel> menu_model_; |
| 110 | 101 |
| 111 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuController); | 102 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuController); |
| 112 }; | 103 }; |
| 113 | 104 |
| 114 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ | 105 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ |
| OLD | NEW |