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> | 9 #include <string> |
10 | 10 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 const GURL& url, | 157 const GURL& url, |
158 const base::string16& title, | 158 const base::string16& title, |
159 Profile* profile); | 159 Profile* profile); |
160 | 160 |
161 // DetachableToolbarView methods: | 161 // DetachableToolbarView methods: |
162 virtual bool IsDetached() const OVERRIDE; | 162 virtual bool IsDetached() const OVERRIDE; |
163 virtual double GetAnimationValue() const OVERRIDE; | 163 virtual double GetAnimationValue() const OVERRIDE; |
164 virtual int GetToolbarOverlap() const OVERRIDE; | 164 virtual int GetToolbarOverlap() const OVERRIDE; |
165 | 165 |
166 // View methods: | 166 // View methods: |
167 virtual gfx::Size GetPreferredSize() OVERRIDE; | 167 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
168 virtual gfx::Size GetMinimumSize() OVERRIDE; | 168 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
169 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 169 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
170 virtual void Layout() OVERRIDE; | 170 virtual void Layout() OVERRIDE; |
171 virtual void ViewHierarchyChanged( | 171 virtual void ViewHierarchyChanged( |
172 const ViewHierarchyChangedDetails& details) OVERRIDE; | 172 const ViewHierarchyChangedDetails& details) OVERRIDE; |
173 virtual void PaintChildren(gfx::Canvas* canvas, | 173 virtual void PaintChildren(gfx::Canvas* canvas, |
174 const views::CullSet& cull_set) OVERRIDE; | 174 const views::CullSet& cull_set) OVERRIDE; |
175 virtual bool GetDropFormats( | 175 virtual bool GetDropFormats( |
176 int* formats, | 176 int* formats, |
177 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; | 177 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE; |
178 virtual bool AreDropTypesRequired() OVERRIDE; | 178 virtual bool AreDropTypesRequired() OVERRIDE; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // NOTE: unless otherwise stated all methods that take an int for an index are | 278 // NOTE: unless otherwise stated all methods that take an int for an index are |
279 // in terms of the bookmark bar view. Typically the view index and model index | 279 // in terms of the bookmark bar view. Typically the view index and model index |
280 // are the same, but they may differ during animations or drag and drop. | 280 // are the same, but they may differ during animations or drag and drop. |
281 // | 281 // |
282 // It's easy to get the mapping wrong. For this reason all these methods are | 282 // It's easy to get the mapping wrong. For this reason all these methods are |
283 // private. | 283 // private. |
284 | 284 |
285 // Returns the number of buttons corresponding to starred urls/folders. This | 285 // Returns the number of buttons corresponding to starred urls/folders. This |
286 // is equivalent to the number of children the bookmark bar node from the | 286 // is equivalent to the number of children the bookmark bar node from the |
287 // bookmark bar model has. | 287 // bookmark bar model has. |
288 int GetBookmarkButtonCount(); | 288 int GetBookmarkButtonCount() const; |
289 | 289 |
290 // Returns the button at the specified index. | 290 // Returns the button at the specified index. |
291 views::TextButton* GetBookmarkButton(int index); | 291 views::TextButton* GetBookmarkButton(int index); |
292 | 292 |
293 // Returns BOOKMARK_LAUNCH_LOCATION_DETACHED_BAR or | 293 // Returns BOOKMARK_LAUNCH_LOCATION_DETACHED_BAR or |
294 // BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state. | 294 // BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state. |
295 BookmarkLaunchLocation GetBookmarkLaunchLocation() const; | 295 BookmarkLaunchLocation GetBookmarkLaunchLocation() const; |
296 | 296 |
297 // Returns the index of the first hidden bookmark button. If all buttons are | 297 // Returns the index of the first hidden bookmark button. If all buttons are |
298 // visible, this returns GetBookmarkButtonCount(). | 298 // visible, this returns GetBookmarkButtonCount(). |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // Updates the colors for all the child objects in the bookmarks bar. | 362 // Updates the colors for all the child objects in the bookmarks bar. |
363 void UpdateColors(); | 363 void UpdateColors(); |
364 | 364 |
365 // Updates the visibility of |other_bookmarked_button_|. Also shows or hide | 365 // Updates the visibility of |other_bookmarked_button_|. Also shows or hide |
366 // the separator if required. | 366 // the separator if required. |
367 void UpdateOtherBookmarksVisibility(); | 367 void UpdateOtherBookmarksVisibility(); |
368 | 368 |
369 // Updates the visibility of |bookmarks_separator_view_|. | 369 // Updates the visibility of |bookmarks_separator_view_|. |
370 void UpdateBookmarksSeparatorVisibility(); | 370 void UpdateBookmarksSeparatorVisibility(); |
371 | 371 |
372 // This method computes the bounds for the bookmark bar items. If | 372 // This method computes the bounds for the bookmark bar items. |
373 // |compute_bounds_only| = TRUE, the bounds for the items are just computed, | 373 void LayoutItems(); |
374 // but are not set. This mode is used by GetPreferredSize() to obtain the | |
375 // desired bounds. If |compute_bounds_only| = FALSE, the bounds are set. | |
376 gfx::Size LayoutItems(bool compute_bounds_only); | |
377 | 374 |
378 // Updates the visibility of the apps shortcut based on the pref value. | 375 // Updates the visibility of the apps shortcut based on the pref value. |
379 void OnAppsPageShortcutVisibilityPrefChanged(); | 376 void OnAppsPageShortcutVisibilityPrefChanged(); |
380 | 377 |
381 // Needed to react to kShowAppsShortcutInBookmarkBar changes. | 378 // Needed to react to kShowAppsShortcutInBookmarkBar changes. |
382 PrefChangeRegistrar profile_pref_registrar_; | 379 PrefChangeRegistrar profile_pref_registrar_; |
383 | 380 |
384 // Used for opening urls. | 381 // Used for opening urls. |
385 content::PageNavigator* page_navigator_; | 382 content::PageNavigator* page_navigator_; |
386 | 383 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 435 |
439 BookmarkBar::State bookmark_bar_state_; | 436 BookmarkBar::State bookmark_bar_state_; |
440 | 437 |
441 // Are we animating to or from the detached state? | 438 // Are we animating to or from the detached state? |
442 bool animating_detached_; | 439 bool animating_detached_; |
443 | 440 |
444 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 441 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
445 }; | 442 }; |
446 | 443 |
447 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 444 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |