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 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/prefs/pref_change_registrar.h" | 14 #include "base/prefs/pref_change_registrar.h" |
15 #include "chrome/browser/bookmarks/bookmark_stats.h" | 15 #include "chrome/browser/bookmarks/bookmark_stats.h" |
16 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | |
17 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 16 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
18 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" | 17 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" |
19 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" | 18 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" |
20 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_observer.h" | 19 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_observer.h" |
21 #include "chrome/browser/ui/views/detachable_toolbar_view.h" | 20 #include "chrome/browser/ui/views/detachable_toolbar_view.h" |
22 #include "components/bookmarks/browser/bookmark_model_observer.h" | 21 #include "components/bookmarks/browser/bookmark_model_observer.h" |
23 #include "components/bookmarks/browser/bookmark_node_data.h" | 22 #include "components/bookmarks/browser/bookmark_node_data.h" |
24 #include "ui/gfx/animation/animation_delegate.h" | 23 #include "ui/gfx/animation/animation_delegate.h" |
25 #include "ui/views/context_menu_controller.h" | 24 #include "ui/views/context_menu_controller.h" |
26 #include "ui/views/controls/button/button.h" | 25 #include "ui/views/controls/button/button.h" |
27 #include "ui/views/controls/button/menu_button_listener.h" | 26 #include "ui/views/controls/button/menu_button_listener.h" |
28 #include "ui/views/controls/menu/menu_types.h" | 27 #include "ui/views/controls/menu/menu_types.h" |
29 #include "ui/views/drag_controller.h" | 28 #include "ui/views/drag_controller.h" |
30 | 29 |
31 class BookmarkContextMenu; | 30 class BookmarkContextMenu; |
| 31 class BookmarkModel; |
32 class Browser; | 32 class Browser; |
33 class BrowserView; | 33 class BrowserView; |
34 class ChromeBookmarkClient; | 34 class ChromeBookmarkClient; |
35 class Profile; | 35 class Profile; |
36 | 36 |
37 namespace content { | 37 namespace content { |
38 class PageNavigator; | 38 class PageNavigator; |
39 } | 39 } |
40 | 40 |
41 namespace gfx { | 41 namespace gfx { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 enum DropButtonType { | 269 enum DropButtonType { |
270 DROP_BOOKMARK, | 270 DROP_BOOKMARK, |
271 DROP_OTHER_FOLDER, | 271 DROP_OTHER_FOLDER, |
272 DROP_OVERFLOW | 272 DROP_OVERFLOW |
273 }; | 273 }; |
274 | 274 |
275 // Creates recent bookmark button and when visible button as well as | 275 // Creates recent bookmark button and when visible button as well as |
276 // calculating the preferred height. | 276 // calculating the preferred height. |
277 void Init(); | 277 void Init(); |
278 | 278 |
279 BookmarkModel* model() { return client_->model(); } | |
280 | |
281 // NOTE: unless otherwise stated all methods that take an int for an index are | 279 // NOTE: unless otherwise stated all methods that take an int for an index are |
282 // in terms of the bookmark bar view. Typically the view index and model index | 280 // in terms of the bookmark bar view. Typically the view index and model index |
283 // are the same, but they may differ during animations or drag and drop. | 281 // are the same, but they may differ during animations or drag and drop. |
284 // | 282 // |
285 // It's easy to get the mapping wrong. For this reason all these methods are | 283 // It's easy to get the mapping wrong. For this reason all these methods are |
286 // private. | 284 // private. |
287 | 285 |
288 // Returns the number of buttons corresponding to starred urls/folders. This | 286 // Returns the number of buttons corresponding to starred urls/folders. This |
289 // is equivalent to the number of children the bookmark bar node from the | 287 // is equivalent to the number of children the bookmark bar node from the |
290 // bookmark bar model has. | 288 // bookmark bar model has. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 378 |
381 // Updates the visibility of the apps shortcut based on the pref value. | 379 // Updates the visibility of the apps shortcut based on the pref value. |
382 void OnAppsPageShortcutVisibilityPrefChanged(); | 380 void OnAppsPageShortcutVisibilityPrefChanged(); |
383 | 381 |
384 // Needed to react to kShowAppsShortcutInBookmarkBar changes. | 382 // Needed to react to kShowAppsShortcutInBookmarkBar changes. |
385 PrefChangeRegistrar profile_pref_registrar_; | 383 PrefChangeRegistrar profile_pref_registrar_; |
386 | 384 |
387 // Used for opening urls. | 385 // Used for opening urls. |
388 content::PageNavigator* page_navigator_; | 386 content::PageNavigator* page_navigator_; |
389 | 387 |
390 // ChromeBookmarkClient that owns the model whose entries and folders are | 388 // BookmarkModel that owns the entries and folders that are shown in this |
391 // shown in this view. This is owned by the Profile. | 389 // view. This is owned by the Profile. |
| 390 BookmarkModel* model_; |
| 391 |
| 392 // ChromeBookmarkClient. This is owned by the Profile. |
392 ChromeBookmarkClient* client_; | 393 ChromeBookmarkClient* client_; |
393 | 394 |
394 // Used to manage showing a Menu, either for the most recently bookmarked | 395 // Used to manage showing a Menu, either for the most recently bookmarked |
395 // entries, or for the starred folder. | 396 // entries, or for the starred folder. |
396 BookmarkMenuController* bookmark_menu_; | 397 BookmarkMenuController* bookmark_menu_; |
397 | 398 |
398 // Used when showing a menu for drag and drop. That is, if the user drags | 399 // Used when showing a menu for drag and drop. That is, if the user drags |
399 // over a folder this becomes non-null and manages the menu showing the | 400 // over a folder this becomes non-null and manages the menu showing the |
400 // contents of the node. | 401 // contents of the node. |
401 BookmarkMenuController* bookmark_drop_menu_; | 402 BookmarkMenuController* bookmark_drop_menu_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 445 |
445 BookmarkBar::State bookmark_bar_state_; | 446 BookmarkBar::State bookmark_bar_state_; |
446 | 447 |
447 // Are we animating to or from the detached state? | 448 // Are we animating to or from the detached state? |
448 bool animating_detached_; | 449 bool animating_detached_; |
449 | 450 |
450 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 451 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
451 }; | 452 }; |
452 | 453 |
453 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 454 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |