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_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
17 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 17 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
18 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 18 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
19 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" | 19 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" |
20 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" | 20 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" |
21 #include "chrome/browser/ui/views/detachable_toolbar_view.h" | 21 #include "chrome/browser/ui/views/detachable_toolbar_view.h" |
22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
24 #include "ui/base/animation/animation_delegate.h" | 24 #include "ui/base/animation/animation_delegate.h" |
25 #include "ui/views/context_menu_controller.h" | 25 #include "ui/views/context_menu_controller.h" |
26 #include "ui/views/controls/button/button.h" | 26 #include "ui/views/controls/button/button.h" |
27 #include "ui/views/controls/button/menu_button_delegate.h" | 27 #include "ui/views/controls/button/menu_button_listener.h" |
28 #include "ui/views/drag_controller.h" | 28 #include "ui/views/drag_controller.h" |
29 | 29 |
30 class BookmarkContextMenu; | 30 class BookmarkContextMenu; |
31 class Browser; | 31 class Browser; |
32 | 32 |
33 namespace content { | 33 namespace content { |
34 class PageNavigator; | 34 class PageNavigator; |
35 } | 35 } |
36 | 36 |
37 namespace ui { | 37 namespace ui { |
38 class SlideAnimation; | 38 class SlideAnimation; |
39 } | 39 } |
40 | 40 |
41 namespace views { | 41 namespace views { |
42 class CustomButton; | 42 class CustomButton; |
43 class MenuButton; | 43 class MenuButton; |
44 class MenuItemView; | 44 class MenuItemView; |
45 class TextButton; | 45 class TextButton; |
46 } | 46 } |
47 | 47 |
48 // BookmarkBarView renders the BookmarkModel. Each starred entry on the | 48 // BookmarkBarView renders the BookmarkModel. Each starred entry on the |
49 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to | 49 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to |
50 // the right allows the user to quickly see recently starred entries. | 50 // the right allows the user to quickly see recently starred entries. |
51 // | 51 // |
52 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView | 52 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView |
53 // waits until the HistoryService for the profile has been loaded before | 53 // waits until the HistoryService for the profile has been loaded before |
54 // creating the BookmarkModel. | 54 // creating the BookmarkModel. |
55 class BookmarkBarView : public DetachableToolbarView, | 55 class BookmarkBarView : public DetachableToolbarView, |
56 public BookmarkModelObserver, | 56 public BookmarkModelObserver, |
57 public views::MenuButtonDelegate, | 57 public views::MenuButtonListener, |
58 public views::ButtonListener, | 58 public views::ButtonListener, |
59 public content::NotificationObserver, | 59 public content::NotificationObserver, |
60 public views::ContextMenuController, | 60 public views::ContextMenuController, |
61 public views::DragController, | 61 public views::DragController, |
62 public ui::AnimationDelegate, | 62 public ui::AnimationDelegate, |
63 public BookmarkMenuController::Observer, | 63 public BookmarkMenuController::Observer, |
64 public BookmarkBarInstructionsView::Delegate { | 64 public BookmarkBarInstructionsView::Delegate { |
65 public: | 65 public: |
66 // The internal view class name. | 66 // The internal view class name. |
67 static const char kViewClassName[]; | 67 static const char kViewClassName[]; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 const BookmarkNode* parent, | 207 const BookmarkNode* parent, |
208 int old_index, | 208 int old_index, |
209 const BookmarkNode* node) OVERRIDE; | 209 const BookmarkNode* node) OVERRIDE; |
210 virtual void BookmarkNodeChanged(BookmarkModel* model, | 210 virtual void BookmarkNodeChanged(BookmarkModel* model, |
211 const BookmarkNode* node) OVERRIDE; | 211 const BookmarkNode* node) OVERRIDE; |
212 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, | 212 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, |
213 const BookmarkNode* node) OVERRIDE; | 213 const BookmarkNode* node) OVERRIDE; |
214 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, | 214 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, |
215 const BookmarkNode* node) OVERRIDE; | 215 const BookmarkNode* node) OVERRIDE; |
216 | 216 |
217 // DragController: | 217 // views::DragController: |
218 virtual void WriteDragDataForView(views::View* sender, | 218 virtual void WriteDragDataForView(views::View* sender, |
219 const gfx::Point& press_pt, | 219 const gfx::Point& press_pt, |
220 ui::OSExchangeData* data) OVERRIDE; | 220 ui::OSExchangeData* data) OVERRIDE; |
221 virtual int GetDragOperationsForView(views::View* sender, | 221 virtual int GetDragOperationsForView(views::View* sender, |
222 const gfx::Point& p) OVERRIDE; | 222 const gfx::Point& p) OVERRIDE; |
223 virtual bool CanStartDragForView(views::View* sender, | 223 virtual bool CanStartDragForView(views::View* sender, |
224 const gfx::Point& press_pt, | 224 const gfx::Point& press_pt, |
225 const gfx::Point& p) OVERRIDE; | 225 const gfx::Point& p) OVERRIDE; |
226 | 226 |
227 // MenuButtonDelegate: | 227 // views::MenuButtonListener: |
228 virtual void RunMenu(views::View* view, const gfx::Point& pt) OVERRIDE; | 228 virtual void OnMenuButtonClicked(views::View* view, |
| 229 const gfx::Point& point) OVERRIDE; |
229 | 230 |
230 // ButtonListener: | 231 // views::ButtonListener: |
231 virtual void ButtonPressed(views::Button* sender, | 232 virtual void ButtonPressed(views::Button* sender, |
232 const views::Event& event) OVERRIDE; | 233 const views::Event& event) OVERRIDE; |
233 | 234 |
234 // ContextMenuController | 235 // views::ContextMenuController: |
235 virtual void ShowContextMenuForView(views::View* source, | 236 virtual void ShowContextMenuForView(views::View* source, |
236 const gfx::Point& point) OVERRIDE; | 237 const gfx::Point& point) OVERRIDE; |
237 | 238 |
238 // NotificationService: | 239 // content::NotificationObserver:: |
239 virtual void Observe(int type, | 240 virtual void Observe(int type, |
240 const content::NotificationSource& source, | 241 const content::NotificationSource& source, |
241 const content::NotificationDetails& details) OVERRIDE; | 242 const content::NotificationDetails& details) OVERRIDE; |
242 | 243 |
243 // If true we're running tests. This short circuits a couple of animations. | 244 // If true we're running tests. This short circuits a couple of animations. |
244 static bool testing_; | 245 static bool testing_; |
245 | 246 |
246 private: | 247 private: |
247 class ButtonSeparatorView; | 248 class ButtonSeparatorView; |
248 struct DropInfo; | 249 struct DropInfo; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 409 |
409 BookmarkBar::State bookmark_bar_state_; | 410 BookmarkBar::State bookmark_bar_state_; |
410 | 411 |
411 // Are we animating to or from the detached state? | 412 // Are we animating to or from the detached state? |
412 bool animating_detached_; | 413 bool animating_detached_; |
413 | 414 |
414 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 415 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
415 }; | 416 }; |
416 | 417 |
417 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 418 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |