| 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_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 | 11 |
| 12 #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" | 12 #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 13 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 14 #include "chrome/browser/ui/views/bookmark_context_menu.h" | 14 #include "chrome/browser/ui/views/bookmark_context_menu.h" |
| 15 #include "gfx/native_widget_types.h" | 15 #include "gfx/native_widget_types.h" |
| 16 #include "views/controls/menu/menu_delegate.h" | 16 #include "views/controls/menu/menu_delegate.h" |
| 17 #include "views/controls/menu/menu_item_view.h" | 17 #include "views/controls/menu/menu_item_view.h" |
| 18 | 18 |
| 19 class BookmarkBarView; |
| 20 class BookmarkContextMenu; |
| 21 class BookmarkNode; |
| 22 class Browser; |
| 23 class PageNavigator; |
| 24 class Profile; |
| 25 |
| 19 namespace gfx { | 26 namespace gfx { |
| 20 class Rect; | 27 class Rect; |
| 21 } // namespace gfx | 28 } // namespace gfx |
| 22 | 29 |
| 30 namespace ui { |
| 31 class OSExchangeData; |
| 32 } // namespace ui |
| 33 |
| 23 namespace views { | 34 namespace views { |
| 24 class MenuButton; | 35 class MenuButton; |
| 25 } // namespace views | 36 } // namespace views |
| 26 | 37 |
| 27 class BookmarkBarView; | |
| 28 class BookmarkContextMenu; | |
| 29 class BookmarkNode; | |
| 30 class Browser; | |
| 31 class OSExchangeData; | |
| 32 class PageNavigator; | |
| 33 class Profile; | |
| 34 | |
| 35 // BookmarkMenuController is responsible for showing a menu of bookmarks, | 38 // BookmarkMenuController is responsible for showing a menu of bookmarks, |
| 36 // each item in the menu represents a bookmark. | 39 // each item in the menu represents a bookmark. |
| 37 // BookmarkMenuController deletes itself as necessary, although the menu can | 40 // BookmarkMenuController deletes itself as necessary, although the menu can |
| 38 // be explicitly hidden by way of the Cancel method. | 41 // be explicitly hidden by way of the Cancel method. |
| 39 class BookmarkMenuController : public BaseBookmarkModelObserver, | 42 class BookmarkMenuController : public BaseBookmarkModelObserver, |
| 40 public views::MenuDelegate, | 43 public views::MenuDelegate, |
| 41 public BookmarkContextMenuObserver { | 44 public BookmarkContextMenuObserver { |
| 42 public: | 45 public: |
| 43 // The observer is notified prior to the menu being deleted. | 46 // The observer is notified prior to the menu being deleted. |
| 44 class Observer { | 47 class Observer { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 83 } |
| 81 | 84 |
| 82 void set_observer(Observer* observer) { observer_ = observer; } | 85 void set_observer(Observer* observer) { observer_ = observer; } |
| 83 | 86 |
| 84 // MenuDelegate methods. | 87 // MenuDelegate methods. |
| 85 virtual bool IsTriggerableEvent(const views::MouseEvent& e); | 88 virtual bool IsTriggerableEvent(const views::MouseEvent& e); |
| 86 virtual void ExecuteCommand(int id, int mouse_event_flags); | 89 virtual void ExecuteCommand(int id, int mouse_event_flags); |
| 87 virtual bool GetDropFormats( | 90 virtual bool GetDropFormats( |
| 88 views::MenuItemView* menu, | 91 views::MenuItemView* menu, |
| 89 int* formats, | 92 int* formats, |
| 90 std::set<OSExchangeData::CustomFormat>* custom_formats); | 93 std::set<ui::OSExchangeData::CustomFormat>* custom_formats); |
| 91 virtual bool AreDropTypesRequired(views::MenuItemView* menu); | 94 virtual bool AreDropTypesRequired(views::MenuItemView* menu); |
| 92 virtual bool CanDrop(views::MenuItemView* menu, const OSExchangeData& data); | 95 virtual bool CanDrop(views::MenuItemView* menu, |
| 96 const ui::OSExchangeData& data); |
| 93 virtual int GetDropOperation(views::MenuItemView* item, | 97 virtual int GetDropOperation(views::MenuItemView* item, |
| 94 const views::DropTargetEvent& event, | 98 const views::DropTargetEvent& event, |
| 95 DropPosition* position); | 99 DropPosition* position); |
| 96 virtual int OnPerformDrop(views::MenuItemView* menu, | 100 virtual int OnPerformDrop(views::MenuItemView* menu, |
| 97 DropPosition position, | 101 DropPosition position, |
| 98 const views::DropTargetEvent& event); | 102 const views::DropTargetEvent& event); |
| 99 virtual bool ShowContextMenu(views::MenuItemView* source, | 103 virtual bool ShowContextMenu(views::MenuItemView* source, |
| 100 int id, | 104 int id, |
| 101 const gfx::Point& p, | 105 const gfx::Point& p, |
| 102 bool is_mouse_gesture); | 106 bool is_mouse_gesture); |
| 103 virtual void DropMenuClosed(views::MenuItemView* menu); | 107 virtual void DropMenuClosed(views::MenuItemView* menu); |
| 104 virtual bool CanDrag(views::MenuItemView* menu); | 108 virtual bool CanDrag(views::MenuItemView* menu); |
| 105 virtual void WriteDragData(views::MenuItemView* sender, OSExchangeData* data); | 109 virtual void WriteDragData(views::MenuItemView* sender, |
| 110 ui::OSExchangeData* data); |
| 106 virtual int GetDragOperations(views::MenuItemView* sender); | 111 virtual int GetDragOperations(views::MenuItemView* sender); |
| 107 virtual views::MenuItemView* GetSiblingMenu( | 112 virtual views::MenuItemView* GetSiblingMenu( |
| 108 views::MenuItemView* menu, | 113 views::MenuItemView* menu, |
| 109 const gfx::Point& screen_point, | 114 const gfx::Point& screen_point, |
| 110 views::MenuItemView::AnchorPosition* anchor, | 115 views::MenuItemView::AnchorPosition* anchor, |
| 111 bool* has_mnemonics, | 116 bool* has_mnemonics, |
| 112 views::MenuButton** button); | 117 views::MenuButton** button); |
| 113 virtual int GetMaxWidthForMenu(); | 118 virtual int GetMaxWidthForMenu(); |
| 114 | 119 |
| 115 // BookmarkModelObserver methods. | 120 // BookmarkModelObserver methods. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 typedef std::map<const BookmarkNode*, views::MenuItemView*> NodeToMenuMap; | 196 typedef std::map<const BookmarkNode*, views::MenuItemView*> NodeToMenuMap; |
| 192 NodeToMenuMap node_to_menu_map_; | 197 NodeToMenuMap node_to_menu_map_; |
| 193 | 198 |
| 194 // ID of the next menu item. | 199 // ID of the next menu item. |
| 195 int next_menu_id_; | 200 int next_menu_id_; |
| 196 | 201 |
| 197 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController); | 202 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController); |
| 198 }; | 203 }; |
| 199 | 204 |
| 200 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ | 205 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ |
| OLD | NEW |