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 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 show_supervised != supervised_bookmarks_button_->visible(); | 2041 show_supervised != supervised_bookmarks_button_->visible(); |
2042 if (update_supervised) | 2042 if (update_supervised) |
2043 supervised_bookmarks_button_->SetVisible(show_supervised); | 2043 supervised_bookmarks_button_->SetVisible(show_supervised); |
2044 | 2044 |
2045 return update_other || update_managed || update_supervised; | 2045 return update_other || update_managed || update_supervised; |
2046 } | 2046 } |
2047 | 2047 |
2048 void BookmarkBarView::UpdateBookmarksSeparatorVisibility() { | 2048 void BookmarkBarView::UpdateBookmarksSeparatorVisibility() { |
2049 // Ash does not paint the bookmarks separator line because it looks odd on | 2049 // Ash does not paint the bookmarks separator line because it looks odd on |
2050 // the flat background. We keep it present for layout, but don't draw it. | 2050 // the flat background. We keep it present for layout, but don't draw it. |
2051 bookmarks_separator_view_->SetVisible( | 2051 bookmarks_separator_view_->SetVisible(browser_->host_desktop_type() != |
2052 browser_->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH && | 2052 ui::HOST_DESKTOP_TYPE_ASH && |
2053 other_bookmarks_button_->visible()); | 2053 other_bookmarks_button_->visible()); |
2054 } | 2054 } |
2055 | 2055 |
2056 void BookmarkBarView::OnAppsPageShortcutVisibilityPrefChanged() { | 2056 void BookmarkBarView::OnAppsPageShortcutVisibilityPrefChanged() { |
2057 DCHECK(apps_page_shortcut_); | 2057 DCHECK(apps_page_shortcut_); |
2058 // Only perform layout if required. | 2058 // Only perform layout if required. |
2059 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( | 2059 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( |
2060 browser_->profile(), browser_->host_desktop_type()); | 2060 browser_->profile(), browser_->host_desktop_type()); |
2061 if (apps_page_shortcut_->visible() == visible) | 2061 if (apps_page_shortcut_->visible() == visible) |
2062 return; | 2062 return; |
2063 apps_page_shortcut_->SetVisible(visible); | 2063 apps_page_shortcut_->SetVisible(visible); |
2064 UpdateBookmarksSeparatorVisibility(); | 2064 UpdateBookmarksSeparatorVisibility(); |
2065 LayoutAndPaint(); | 2065 LayoutAndPaint(); |
2066 } | 2066 } |
2067 | 2067 |
2068 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2068 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
2069 if (UpdateOtherAndManagedButtonsVisibility()) | 2069 if (UpdateOtherAndManagedButtonsVisibility()) |
2070 LayoutAndPaint(); | 2070 LayoutAndPaint(); |
2071 } | 2071 } |
OLD | NEW |