| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
| 19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "chrome/app/vector_icons/vector_icons.h" |
| 24 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 25 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 25 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" | 26 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" |
| 26 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/defaults.h" | 28 #include "chrome/browser/defaults.h" |
| 28 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 29 #include "chrome/browser/search/search.h" | 30 #include "chrome/browser/search/search.h" |
| 30 #include "chrome/browser/sync/profile_sync_service_factory.h" | 31 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 31 #include "chrome/browser/themes/theme_properties.h" | 32 #include "chrome/browser/themes/theme_properties.h" |
| 32 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 33 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
| 33 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h" | 34 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "ui/gfx/canvas.h" | 80 #include "ui/gfx/canvas.h" |
| 80 #include "ui/gfx/color_utils.h" | 81 #include "ui/gfx/color_utils.h" |
| 81 #include "ui/gfx/favicon_size.h" | 82 #include "ui/gfx/favicon_size.h" |
| 82 #include "ui/gfx/geometry/insets.h" | 83 #include "ui/gfx/geometry/insets.h" |
| 83 #include "ui/gfx/geometry/rect.h" | 84 #include "ui/gfx/geometry/rect.h" |
| 84 #include "ui/gfx/image/image_skia_operations.h" | 85 #include "ui/gfx/image/image_skia_operations.h" |
| 85 #include "ui/gfx/paint_vector_icon.h" | 86 #include "ui/gfx/paint_vector_icon.h" |
| 86 #include "ui/gfx/scoped_canvas.h" | 87 #include "ui/gfx/scoped_canvas.h" |
| 87 #include "ui/gfx/text_constants.h" | 88 #include "ui/gfx/text_constants.h" |
| 88 #include "ui/gfx/text_elider.h" | 89 #include "ui/gfx/text_elider.h" |
| 89 #include "ui/gfx/vector_icons_public.h" | |
| 90 #include "ui/resources/grit/ui_resources.h" | 90 #include "ui/resources/grit/ui_resources.h" |
| 91 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 91 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 92 #include "ui/views/animation/ink_drop_highlight.h" | 92 #include "ui/views/animation/ink_drop_highlight.h" |
| 93 #include "ui/views/animation/ink_drop_impl.h" | 93 #include "ui/views/animation/ink_drop_impl.h" |
| 94 #include "ui/views/button_drag_utils.h" | 94 #include "ui/views/button_drag_utils.h" |
| 95 #include "ui/views/controls/button/label_button.h" | 95 #include "ui/views/controls/button/label_button.h" |
| 96 #include "ui/views/controls/button/label_button_border.h" | 96 #include "ui/views/controls/button/label_button_border.h" |
| 97 #include "ui/views/controls/button/menu_button.h" | 97 #include "ui/views/controls/button/menu_button.h" |
| 98 #include "ui/views/controls/label.h" | 98 #include "ui/views/controls/label.h" |
| 99 #include "ui/views/drag_utils.h" | 99 #include "ui/views/drag_utils.h" |
| (...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2090 views::Button::STATE_NORMAL, chrome::GetBookmarkManagedFolderIcon(color)); | 2090 views::Button::STATE_NORMAL, chrome::GetBookmarkManagedFolderIcon(color)); |
| 2091 supervised_bookmarks_button_->SetEnabledTextColors(color); | 2091 supervised_bookmarks_button_->SetEnabledTextColors(color); |
| 2092 supervised_bookmarks_button_->SetImage( | 2092 supervised_bookmarks_button_->SetImage( |
| 2093 views::Button::STATE_NORMAL, | 2093 views::Button::STATE_NORMAL, |
| 2094 chrome::GetBookmarkSupervisedFolderIcon(color)); | 2094 chrome::GetBookmarkSupervisedFolderIcon(color)); |
| 2095 if (apps_page_shortcut_->visible()) | 2095 if (apps_page_shortcut_->visible()) |
| 2096 apps_page_shortcut_->SetEnabledTextColors(color); | 2096 apps_page_shortcut_->SetEnabledTextColors(color); |
| 2097 | 2097 |
| 2098 overflow_button_->SetImage( | 2098 overflow_button_->SetImage( |
| 2099 views::Button::STATE_NORMAL, | 2099 views::Button::STATE_NORMAL, |
| 2100 gfx::CreateVectorIcon(gfx::VectorIconId::OVERFLOW_CHEVRON, 8, | 2100 gfx::CreateVectorIcon(kOverflowChevronIcon, 8, |
| 2101 theme_provider->GetColor( | 2101 theme_provider->GetColor( |
| 2102 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON))); | 2102 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON))); |
| 2103 | 2103 |
| 2104 // Redraw the background. | 2104 // Redraw the background. |
| 2105 SchedulePaint(); | 2105 SchedulePaint(); |
| 2106 } | 2106 } |
| 2107 | 2107 |
| 2108 bool BookmarkBarView::UpdateOtherAndManagedButtonsVisibility() { | 2108 bool BookmarkBarView::UpdateOtherAndManagedButtonsVisibility() { |
| 2109 bool has_other_children = !model_->other_node()->empty(); | 2109 bool has_other_children = !model_->other_node()->empty(); |
| 2110 bool update_other = has_other_children != other_bookmarks_button_->visible(); | 2110 bool update_other = has_other_children != other_bookmarks_button_->visible(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2148 return; | 2148 return; |
| 2149 apps_page_shortcut_->SetVisible(visible); | 2149 apps_page_shortcut_->SetVisible(visible); |
| 2150 UpdateBookmarksSeparatorVisibility(); | 2150 UpdateBookmarksSeparatorVisibility(); |
| 2151 LayoutAndPaint(); | 2151 LayoutAndPaint(); |
| 2152 } | 2152 } |
| 2153 | 2153 |
| 2154 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2154 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 2155 if (UpdateOtherAndManagedButtonsVisibility()) | 2155 if (UpdateOtherAndManagedButtonsVisibility()) |
| 2156 LayoutAndPaint(); | 2156 LayoutAndPaint(); |
| 2157 } | 2157 } |
| OLD | NEW |