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 #include <string> | |
10 | 9 |
11 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
14 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
15 #include "base/prefs/pref_change_registrar.h" | 14 #include "base/prefs/pref_change_registrar.h" |
16 #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" | 17 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
18 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" | 18 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" |
19 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" | 19 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view_observer.h" |
20 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_observer.h" | 20 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_observer.h" |
21 #include "chrome/browser/ui/views/detachable_toolbar_view.h" | 21 #include "chrome/browser/ui/views/detachable_toolbar_view.h" |
22 #include "components/bookmarks/browser/bookmark_model_observer.h" | 22 #include "components/bookmarks/browser/bookmark_model_observer.h" |
23 #include "components/bookmarks/browser/bookmark_node_data.h" | 23 #include "components/bookmarks/browser/bookmark_node_data.h" |
24 #include "ui/gfx/animation/animation_delegate.h" | 24 #include "ui/gfx/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" |
(...skipping 242 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 |
279 // NOTE: unless otherwise stated all methods that take an int for an index are | 281 // NOTE: unless otherwise stated all methods that take an int for an index are |
280 // in terms of the bookmark bar view. Typically the view index and model index | 282 // in terms of the bookmark bar view. Typically the view index and model index |
281 // are the same, but they may differ during animations or drag and drop. | 283 // are the same, but they may differ during animations or drag and drop. |
282 // | 284 // |
283 // It's easy to get the mapping wrong. For this reason all these methods are | 285 // It's easy to get the mapping wrong. For this reason all these methods are |
284 // private. | 286 // private. |
285 | 287 |
286 // Returns the number of buttons corresponding to starred urls/folders. This | 288 // Returns the number of buttons corresponding to starred urls/folders. This |
287 // is equivalent to the number of children the bookmark bar node from the | 289 // is equivalent to the number of children the bookmark bar node from the |
288 // bookmark bar model has. | 290 // bookmark bar model has. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 380 |
379 // Updates the visibility of the apps shortcut based on the pref value. | 381 // Updates the visibility of the apps shortcut based on the pref value. |
380 void OnAppsPageShortcutVisibilityPrefChanged(); | 382 void OnAppsPageShortcutVisibilityPrefChanged(); |
381 | 383 |
382 // Needed to react to kShowAppsShortcutInBookmarkBar changes. | 384 // Needed to react to kShowAppsShortcutInBookmarkBar changes. |
383 PrefChangeRegistrar profile_pref_registrar_; | 385 PrefChangeRegistrar profile_pref_registrar_; |
384 | 386 |
385 // Used for opening urls. | 387 // Used for opening urls. |
386 content::PageNavigator* page_navigator_; | 388 content::PageNavigator* page_navigator_; |
387 | 389 |
388 // Model providing details as to the starred entries/folders that should be | 390 // ChromeBookmarkClient that owns the model whose entries and folders are |
389 // shown. This is owned by the Profile. | 391 // shown in this view. This is owned by the Profile. |
390 BookmarkModel* model_; | |
391 | |
392 // The ChromeBookmarkClient that owns the |model_|. | |
393 ChromeBookmarkClient* client_; | 392 ChromeBookmarkClient* client_; |
394 | 393 |
395 // Used to manage showing a Menu, either for the most recently bookmarked | 394 // Used to manage showing a Menu, either for the most recently bookmarked |
396 // entries, or for the starred folder. | 395 // entries, or for the starred folder. |
397 BookmarkMenuController* bookmark_menu_; | 396 BookmarkMenuController* bookmark_menu_; |
398 | 397 |
399 // Used when showing a menu for drag and drop. That is, if the user drags | 398 // Used when showing a menu for drag and drop. That is, if the user drags |
400 // over a folder this becomes non-null and manages the menu showing the | 399 // over a folder this becomes non-null and manages the menu showing the |
401 // contents of the node. | 400 // contents of the node. |
402 BookmarkMenuController* bookmark_drop_menu_; | 401 BookmarkMenuController* bookmark_drop_menu_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 444 |
446 BookmarkBar::State bookmark_bar_state_; | 445 BookmarkBar::State bookmark_bar_state_; |
447 | 446 |
448 // Are we animating to or from the detached state? | 447 // Are we animating to or from the detached state? |
449 bool animating_detached_; | 448 bool animating_detached_; |
450 | 449 |
451 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 450 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
452 }; | 451 }; |
453 | 452 |
454 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 453 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |