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_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 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 15 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
16 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 16 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
17 #include "chrome/browser/sync/profile_sync_service.h" | |
18 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 17 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
19 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" | 18 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" |
20 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" | 19 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" |
21 #include "chrome/browser/ui/views/detachable_toolbar_view.h" | 20 #include "chrome/browser/ui/views/detachable_toolbar_view.h" |
| 21 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
23 #include "ui/base/animation/animation_delegate.h" | 23 #include "ui/base/animation/animation_delegate.h" |
24 #include "views/context_menu_controller.h" | 24 #include "views/context_menu_controller.h" |
25 #include "views/controls/button/button.h" | 25 #include "views/controls/button/button.h" |
26 #include "views/controls/menu/view_menu_delegate.h" | 26 #include "views/controls/menu/view_menu_delegate.h" |
27 #include "views/drag_controller.h" | 27 #include "views/drag_controller.h" |
28 | 28 |
29 class BookmarkContextMenu; | 29 class BookmarkContextMenu; |
30 class Browser; | 30 class Browser; |
31 class PageNavigator; | 31 class PageNavigator; |
(...skipping 11 matching lines...) Expand all Loading... |
43 } | 43 } |
44 | 44 |
45 // BookmarkBarView renders the BookmarkModel. Each starred entry on the | 45 // BookmarkBarView renders the BookmarkModel. Each starred entry on the |
46 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to | 46 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to |
47 // the right allows the user to quickly see recently starred entries. | 47 // the right allows the user to quickly see recently starred entries. |
48 // | 48 // |
49 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView | 49 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView |
50 // waits until the HistoryService for the profile has been loaded before | 50 // waits until the HistoryService for the profile has been loaded before |
51 // creating the BookmarkModel. | 51 // creating the BookmarkModel. |
52 class BookmarkBarView : public DetachableToolbarView, | 52 class BookmarkBarView : public DetachableToolbarView, |
53 public ProfileSyncServiceObserver, | |
54 public BookmarkModelObserver, | 53 public BookmarkModelObserver, |
55 public views::ViewMenuDelegate, | 54 public views::ViewMenuDelegate, |
56 public views::ButtonListener, | 55 public views::ButtonListener, |
57 public content::NotificationObserver, | 56 public content::NotificationObserver, |
58 public views::ContextMenuController, | 57 public views::ContextMenuController, |
59 public views::DragController, | 58 public views::DragController, |
60 public ui::AnimationDelegate, | 59 public ui::AnimationDelegate, |
61 public BookmarkMenuController::Observer, | 60 public BookmarkMenuController::Observer, |
62 public BookmarkBarInstructionsView::Delegate { | 61 public BookmarkBarInstructionsView::Delegate { |
63 public: | 62 public: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 virtual void OnDragExited() OVERRIDE; | 171 virtual void OnDragExited() OVERRIDE; |
173 virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE; | 172 virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE; |
174 virtual void ShowContextMenu(const gfx::Point& p, | 173 virtual void ShowContextMenu(const gfx::Point& p, |
175 bool is_mouse_gesture) OVERRIDE; | 174 bool is_mouse_gesture) OVERRIDE; |
176 virtual void OnThemeChanged() OVERRIDE; | 175 virtual void OnThemeChanged() OVERRIDE; |
177 virtual std::string GetClassName() const OVERRIDE; | 176 virtual std::string GetClassName() const OVERRIDE; |
178 | 177 |
179 // AccessiblePaneView methods: | 178 // AccessiblePaneView methods: |
180 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 179 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
181 | 180 |
182 // ProfileSyncServiceObserver method. | |
183 virtual void OnStateChanged() OVERRIDE; | |
184 | |
185 // SlideAnimationDelegate implementation. | 181 // SlideAnimationDelegate implementation. |
186 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 182 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
187 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 183 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
188 | 184 |
189 // BookmarkMenuController::Observer | 185 // BookmarkMenuController::Observer |
190 virtual void BookmarkMenuDeleted( | 186 virtual void BookmarkMenuDeleted( |
191 BookmarkMenuController* controller) OVERRIDE; | 187 BookmarkMenuController* controller) OVERRIDE; |
192 | 188 |
193 // BookmarkBarInstructionsView::Delegate. | 189 // BookmarkBarInstructionsView::Delegate. |
194 virtual void ShowImportDialog() OVERRIDE; | 190 virtual void ShowImportDialog() OVERRIDE; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // Returns the index of the first hidden bookmark button. If all buttons are | 278 // Returns the index of the first hidden bookmark button. If all buttons are |
283 // visible, this returns GetBookmarkButtonCount(). | 279 // visible, this returns GetBookmarkButtonCount(). |
284 int GetFirstHiddenNodeIndex(); | 280 int GetFirstHiddenNodeIndex(); |
285 | 281 |
286 // Creates the button showing the other bookmarked items. | 282 // Creates the button showing the other bookmarked items. |
287 views::MenuButton* CreateOtherBookmarkedButton(); | 283 views::MenuButton* CreateOtherBookmarkedButton(); |
288 | 284 |
289 // Creates the button used when not all bookmark buttons fit. | 285 // Creates the button used when not all bookmark buttons fit. |
290 views::MenuButton* CreateOverflowButton(); | 286 views::MenuButton* CreateOverflowButton(); |
291 | 287 |
292 // Creates the sync error button and adds it as a child view. | |
293 views::TextButton* CreateSyncErrorButton(); | |
294 | |
295 // Creates the button for rendering the specified bookmark node. | 288 // Creates the button for rendering the specified bookmark node. |
296 views::View* CreateBookmarkButton(const BookmarkNode* node); | 289 views::View* CreateBookmarkButton(const BookmarkNode* node); |
297 | 290 |
298 // Configures the button from the specified node. This sets the text, | 291 // Configures the button from the specified node. This sets the text, |
299 // and icon. | 292 // and icon. |
300 void ConfigureButton(const BookmarkNode* node, views::TextButton* button); | 293 void ConfigureButton(const BookmarkNode* node, views::TextButton* button); |
301 | 294 |
302 // Implementation for BookmarkNodeAddedImpl. | 295 // Implementation for BookmarkNodeAddedImpl. |
303 void BookmarkNodeAddedImpl(BookmarkModel* model, | 296 void BookmarkNodeAddedImpl(BookmarkModel* model, |
304 const BookmarkNode* parent, | 297 const BookmarkNode* parent, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 374 |
382 // Shows the other bookmark entries. | 375 // Shows the other bookmark entries. |
383 views::MenuButton* other_bookmarked_button_; | 376 views::MenuButton* other_bookmarked_button_; |
384 | 377 |
385 // Task used to delay showing of the drop menu. | 378 // Task used to delay showing of the drop menu. |
386 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; | 379 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; |
387 | 380 |
388 // Used to track drops on the bookmark bar view. | 381 // Used to track drops on the bookmark bar view. |
389 scoped_ptr<DropInfo> drop_info_; | 382 scoped_ptr<DropInfo> drop_info_; |
390 | 383 |
391 // The sync re-login indicator which appears when the user needs to re-enter | |
392 // credentials in order to continue syncing. | |
393 views::TextButton* sync_error_button_; | |
394 | |
395 // A pointer to the ProfileSyncService instance if one exists. | |
396 ProfileSyncService* sync_service_; | |
397 | |
398 // Visible if not all the bookmark buttons fit. | 384 // Visible if not all the bookmark buttons fit. |
399 views::MenuButton* overflow_button_; | 385 views::MenuButton* overflow_button_; |
400 | 386 |
401 // BookmarkBarInstructionsView that is visible if there are no bookmarks on | 387 // BookmarkBarInstructionsView that is visible if there are no bookmarks on |
402 // the bookmark bar. | 388 // the bookmark bar. |
403 views::View* instructions_; | 389 views::View* instructions_; |
404 | 390 |
405 ButtonSeparatorView* bookmarks_separator_view_; | 391 ButtonSeparatorView* bookmarks_separator_view_; |
406 | 392 |
407 // Owning browser. | 393 // Owning browser. |
(...skipping 12 matching lines...) Expand all Loading... |
420 | 406 |
421 BookmarkBar::State bookmark_bar_state_; | 407 BookmarkBar::State bookmark_bar_state_; |
422 | 408 |
423 // Are we animating to or from the detached state? | 409 // Are we animating to or from the detached state? |
424 bool animating_detached_; | 410 bool animating_detached_; |
425 | 411 |
426 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 412 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
427 }; | 413 }; |
428 | 414 |
429 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 415 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |