| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 throbbing_view_(NULL), | 612 throbbing_view_(NULL), |
| 613 bookmark_bar_state_(BookmarkBar::SHOW), | 613 bookmark_bar_state_(BookmarkBar::SHOW), |
| 614 animating_detached_(false), | 614 animating_detached_(false), |
| 615 show_folder_method_factory_(this) { | 615 show_folder_method_factory_(this) { |
| 616 set_id(VIEW_ID_BOOKMARK_BAR); | 616 set_id(VIEW_ID_BOOKMARK_BAR); |
| 617 Init(); | 617 Init(); |
| 618 | 618 |
| 619 if (ui::MaterialDesignController::IsModeMaterial()) { | 619 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 620 // Don't let the bookmarks show on top of the location bar while animating. | 620 // Don't let the bookmarks show on top of the location bar while animating. |
| 621 SetPaintToLayer(true); | 621 SetPaintToLayer(true); |
| 622 layer()->SetFillsBoundsOpaquely(false); | |
| 623 layer()->SetMasksToBounds(true); | 622 layer()->SetMasksToBounds(true); |
| 624 } | 623 } |
| 625 | 624 |
| 626 size_animation_.Reset(1); | 625 size_animation_.Reset(1); |
| 627 } | 626 } |
| 628 | 627 |
| 629 BookmarkBarView::~BookmarkBarView() { | 628 BookmarkBarView::~BookmarkBarView() { |
| 630 if (model_) | 629 if (model_) |
| 631 model_->RemoveObserver(this); | 630 model_->RemoveObserver(this); |
| 632 | 631 |
| (...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 views::Button::STATE_NORMAL, | 2104 views::Button::STATE_NORMAL, |
| 2106 chrome::GetBookmarkSupervisedFolderIcon(color)); | 2105 chrome::GetBookmarkSupervisedFolderIcon(color)); |
| 2107 if (apps_page_shortcut_->visible()) | 2106 if (apps_page_shortcut_->visible()) |
| 2108 apps_page_shortcut_->SetEnabledTextColors(color); | 2107 apps_page_shortcut_->SetEnabledTextColors(color); |
| 2109 | 2108 |
| 2110 overflow_button_->SetImage( | 2109 overflow_button_->SetImage( |
| 2111 views::Button::STATE_NORMAL, | 2110 views::Button::STATE_NORMAL, |
| 2112 gfx::CreateVectorIcon(gfx::VectorIconId::OVERFLOW_CHEVRON, 8, | 2111 gfx::CreateVectorIcon(gfx::VectorIconId::OVERFLOW_CHEVRON, 8, |
| 2113 theme_provider->GetColor( | 2112 theme_provider->GetColor( |
| 2114 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON))); | 2113 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON))); |
| 2114 |
| 2115 // Redraw the background. |
| 2116 SchedulePaint(); |
| 2115 } | 2117 } |
| 2116 | 2118 |
| 2117 bool BookmarkBarView::UpdateOtherAndManagedButtonsVisibility() { | 2119 bool BookmarkBarView::UpdateOtherAndManagedButtonsVisibility() { |
| 2118 bool has_other_children = !model_->other_node()->empty(); | 2120 bool has_other_children = !model_->other_node()->empty(); |
| 2119 bool update_other = has_other_children != other_bookmarks_button_->visible(); | 2121 bool update_other = has_other_children != other_bookmarks_button_->visible(); |
| 2120 if (update_other) { | 2122 if (update_other) { |
| 2121 other_bookmarks_button_->SetVisible(has_other_children); | 2123 other_bookmarks_button_->SetVisible(has_other_children); |
| 2122 UpdateBookmarksSeparatorVisibility(); | 2124 UpdateBookmarksSeparatorVisibility(); |
| 2123 } | 2125 } |
| 2124 | 2126 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2155 return; | 2157 return; |
| 2156 apps_page_shortcut_->SetVisible(visible); | 2158 apps_page_shortcut_->SetVisible(visible); |
| 2157 UpdateBookmarksSeparatorVisibility(); | 2159 UpdateBookmarksSeparatorVisibility(); |
| 2158 LayoutAndPaint(); | 2160 LayoutAndPaint(); |
| 2159 } | 2161 } |
| 2160 | 2162 |
| 2161 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2163 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 2162 if (UpdateOtherAndManagedButtonsVisibility()) | 2164 if (UpdateOtherAndManagedButtonsVisibility()) |
| 2163 LayoutAndPaint(); | 2165 LayoutAndPaint(); |
| 2164 } | 2166 } |
| OLD | NEW |