| 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 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 // BookmarkButtonBase ----------------------------------------------- | 165 // BookmarkButtonBase ----------------------------------------------- |
| 166 | 166 |
| 167 // Base class for text buttons used on the bookmark bar. | 167 // Base class for text buttons used on the bookmark bar. |
| 168 | 168 |
| 169 class BookmarkButtonBase : public views::LabelButton { | 169 class BookmarkButtonBase : public views::LabelButton { |
| 170 public: | 170 public: |
| 171 BookmarkButtonBase(views::ButtonListener* listener, | 171 BookmarkButtonBase(views::ButtonListener* listener, |
| 172 const base::string16& title) | 172 const base::string16& title) |
| 173 : LabelButton(listener, title) { | 173 : LabelButton(listener, title) { |
| 174 SetDirectionalityMode(gfx::DIRECTIONALITY_FROM_TEXT); | |
| 175 SetElideBehavior(kElideBehavior); | 174 SetElideBehavior(kElideBehavior); |
| 176 show_animation_.reset(new gfx::SlideAnimation(this)); | 175 show_animation_.reset(new gfx::SlideAnimation(this)); |
| 177 if (!animations_enabled) { | 176 if (!animations_enabled) { |
| 178 // For some reason during testing the events generated by animating | 177 // For some reason during testing the events generated by animating |
| 179 // throw off the test. So, don't animate while testing. | 178 // throw off the test. So, don't animate while testing. |
| 180 show_animation_->Reset(1); | 179 show_animation_->Reset(1); |
| 181 } else { | 180 } else { |
| 182 show_animation_->Show(); | 181 show_animation_->Show(); |
| 183 } | 182 } |
| 184 } | 183 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 274 |
| 276 // Buttons used for folders on the bookmark bar, including the 'other folders' | 275 // Buttons used for folders on the bookmark bar, including the 'other folders' |
| 277 // button. | 276 // button. |
| 278 class BookmarkFolderButton : public views::MenuButton { | 277 class BookmarkFolderButton : public views::MenuButton { |
| 279 public: | 278 public: |
| 280 BookmarkFolderButton(views::ButtonListener* listener, | 279 BookmarkFolderButton(views::ButtonListener* listener, |
| 281 const base::string16& title, | 280 const base::string16& title, |
| 282 views::MenuButtonListener* menu_button_listener, | 281 views::MenuButtonListener* menu_button_listener, |
| 283 bool show_menu_marker) | 282 bool show_menu_marker) |
| 284 : MenuButton(listener, title, menu_button_listener, show_menu_marker) { | 283 : MenuButton(listener, title, menu_button_listener, show_menu_marker) { |
| 285 SetDirectionalityMode(gfx::DIRECTIONALITY_FROM_TEXT); | |
| 286 SetElideBehavior(kElideBehavior); | 284 SetElideBehavior(kElideBehavior); |
| 287 show_animation_.reset(new gfx::SlideAnimation(this)); | 285 show_animation_.reset(new gfx::SlideAnimation(this)); |
| 288 if (!animations_enabled) { | 286 if (!animations_enabled) { |
| 289 // For some reason during testing the events generated by animating | 287 // For some reason during testing the events generated by animating |
| 290 // throw off the test. So, don't animate while testing. | 288 // throw off the test. So, don't animate while testing. |
| 291 show_animation_->Reset(1); | 289 show_animation_->Reset(1); |
| 292 } else { | 290 } else { |
| 293 show_animation_->Show(); | 291 show_animation_->Show(); |
| 294 } | 292 } |
| 295 } | 293 } |
| (...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1954 DCHECK(apps_page_shortcut_); | 1952 DCHECK(apps_page_shortcut_); |
| 1955 // Only perform layout if required. | 1953 // Only perform layout if required. |
| 1956 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( | 1954 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( |
| 1957 browser_->profile(), browser_->host_desktop_type()); | 1955 browser_->profile(), browser_->host_desktop_type()); |
| 1958 if (apps_page_shortcut_->visible() == visible) | 1956 if (apps_page_shortcut_->visible() == visible) |
| 1959 return; | 1957 return; |
| 1960 apps_page_shortcut_->SetVisible(visible); | 1958 apps_page_shortcut_->SetVisible(visible); |
| 1961 UpdateBookmarksSeparatorVisibility(); | 1959 UpdateBookmarksSeparatorVisibility(); |
| 1962 Layout(); | 1960 Layout(); |
| 1963 } | 1961 } |
| OLD | NEW |