| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #include "ui/gfx/geometry/rect.h" | 82 #include "ui/gfx/geometry/rect.h" |
| 83 #include "ui/gfx/image/image_skia_operations.h" | 83 #include "ui/gfx/image/image_skia_operations.h" |
| 84 #include "ui/gfx/paint_vector_icon.h" | 84 #include "ui/gfx/paint_vector_icon.h" |
| 85 #include "ui/gfx/scoped_canvas.h" | 85 #include "ui/gfx/scoped_canvas.h" |
| 86 #include "ui/gfx/text_constants.h" | 86 #include "ui/gfx/text_constants.h" |
| 87 #include "ui/gfx/text_elider.h" | 87 #include "ui/gfx/text_elider.h" |
| 88 #include "ui/gfx/vector_icons_public.h" | 88 #include "ui/gfx/vector_icons_public.h" |
| 89 #include "ui/resources/grit/ui_resources.h" | 89 #include "ui/resources/grit/ui_resources.h" |
| 90 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 90 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 91 #include "ui/views/animation/ink_drop_highlight.h" | 91 #include "ui/views/animation/ink_drop_highlight.h" |
| 92 #include "ui/views/animation/ink_drop_impl.h" |
| 92 #include "ui/views/button_drag_utils.h" | 93 #include "ui/views/button_drag_utils.h" |
| 93 #include "ui/views/controls/button/label_button.h" | 94 #include "ui/views/controls/button/label_button.h" |
| 94 #include "ui/views/controls/button/label_button_border.h" | 95 #include "ui/views/controls/button/label_button_border.h" |
| 95 #include "ui/views/controls/button/menu_button.h" | 96 #include "ui/views/controls/button/menu_button.h" |
| 96 #include "ui/views/controls/label.h" | 97 #include "ui/views/controls/label.h" |
| 97 #include "ui/views/drag_utils.h" | 98 #include "ui/views/drag_utils.h" |
| 98 #include "ui/views/metrics.h" | 99 #include "ui/views/metrics.h" |
| 99 #include "ui/views/view_constants.h" | 100 #include "ui/views/view_constants.h" |
| 100 #include "ui/views/widget/tooltip_manager.h" | 101 #include "ui/views/widget/tooltip_manager.h" |
| 101 #include "ui/views/widget/widget.h" | 102 #include "ui/views/widget/widget.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 kButtonPaddingHorizontal)); | 208 kButtonPaddingHorizontal)); |
| 208 return border; | 209 return border; |
| 209 } | 210 } |
| 210 | 211 |
| 211 bool IsTriggerableEvent(const ui::Event& e) override { | 212 bool IsTriggerableEvent(const ui::Event& e) override { |
| 212 return e.type() == ui::ET_GESTURE_TAP || | 213 return e.type() == ui::ET_GESTURE_TAP || |
| 213 e.type() == ui::ET_GESTURE_TAP_DOWN || | 214 e.type() == ui::ET_GESTURE_TAP_DOWN || |
| 214 event_utils::IsPossibleDispositionEvent(e); | 215 event_utils::IsPossibleDispositionEvent(e); |
| 215 } | 216 } |
| 216 | 217 |
| 218 // LabelButton: |
| 219 std::unique_ptr<views::InkDrop> CreateInkDrop() override { |
| 220 return CreateDefaultFloodFillInkDropImpl(); |
| 221 } |
| 222 |
| 217 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { | 223 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { |
| 218 return base::MakeUnique<views::FloodFillInkDropRipple>( | 224 return base::MakeUnique<views::FloodFillInkDropRipple>( |
| 219 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(), | 225 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(), |
| 220 GetInkDropBaseColor(), ink_drop_visible_opacity()); | 226 GetInkDropBaseColor(), ink_drop_visible_opacity()); |
| 221 } | 227 } |
| 222 | 228 |
| 223 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 229 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
| 224 const override { | 230 const override { |
| 225 if (!ShouldShowInkDropHighlight()) | |
| 226 return nullptr; | |
| 227 | |
| 228 const gfx::Rect bounds = CalculateInkDropBounds(size()); | 231 const gfx::Rect bounds = CalculateInkDropBounds(size()); |
| 229 return base::MakeUnique<views::InkDropHighlight>( | 232 return base::MakeUnique<views::InkDropHighlight>( |
| 230 bounds.size(), 0, gfx::RectF(bounds).CenterPoint(), | 233 bounds.size(), 0, gfx::RectF(bounds).CenterPoint(), |
| 231 GetInkDropBaseColor()); | 234 GetInkDropBaseColor()); |
| 232 } | 235 } |
| 233 | 236 |
| 234 SkColor GetInkDropBaseColor() const override { | 237 SkColor GetInkDropBaseColor() const override { |
| 235 return GetThemeProvider()->GetColor( | 238 return GetThemeProvider()->GetColor( |
| 236 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); | 239 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
| 237 } | 240 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 class BookmarkMenuButtonBase : public views::MenuButton { | 309 class BookmarkMenuButtonBase : public views::MenuButton { |
| 307 public: | 310 public: |
| 308 BookmarkMenuButtonBase(const base::string16& title, | 311 BookmarkMenuButtonBase(const base::string16& title, |
| 309 views::MenuButtonListener* menu_button_listener, | 312 views::MenuButtonListener* menu_button_listener, |
| 310 bool show_menu_marker) | 313 bool show_menu_marker) |
| 311 : MenuButton(title, menu_button_listener, show_menu_marker) { | 314 : MenuButton(title, menu_button_listener, show_menu_marker) { |
| 312 SetInkDropMode(InkDropMode::ON); | 315 SetInkDropMode(InkDropMode::ON); |
| 313 SetFocusPainter(nullptr); | 316 SetFocusPainter(nullptr); |
| 314 } | 317 } |
| 315 | 318 |
| 319 // MenuButton: |
| 320 std::unique_ptr<views::InkDrop> CreateInkDrop() override { |
| 321 return CreateDefaultFloodFillInkDropImpl(); |
| 322 } |
| 323 |
| 316 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { | 324 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { |
| 317 return base::MakeUnique<views::FloodFillInkDropRipple>( | 325 return base::MakeUnique<views::FloodFillInkDropRipple>( |
| 318 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(), | 326 CalculateInkDropBounds(size()), GetInkDropCenterBasedOnLastEvent(), |
| 319 GetInkDropBaseColor(), ink_drop_visible_opacity()); | 327 GetInkDropBaseColor(), ink_drop_visible_opacity()); |
| 320 } | 328 } |
| 321 | 329 |
| 322 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 330 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
| 323 const override { | 331 const override { |
| 324 if (!ShouldShowInkDropHighlight()) | |
| 325 return nullptr; | |
| 326 | |
| 327 const gfx::Rect bounds = CalculateInkDropBounds(size()); | 332 const gfx::Rect bounds = CalculateInkDropBounds(size()); |
| 328 return base::MakeUnique<views::InkDropHighlight>( | 333 return base::MakeUnique<views::InkDropHighlight>( |
| 329 bounds.size(), 0, gfx::RectF(bounds).CenterPoint(), | 334 bounds.size(), 0, gfx::RectF(bounds).CenterPoint(), |
| 330 GetInkDropBaseColor()); | 335 GetInkDropBaseColor()); |
| 331 } | 336 } |
| 332 | 337 |
| 333 SkColor GetInkDropBaseColor() const override { | 338 SkColor GetInkDropBaseColor() const override { |
| 334 return GetThemeProvider()->GetColor( | 339 return GetThemeProvider()->GetColor( |
| 335 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); | 340 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
| 336 } | 341 } |
| (...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2114 return; | 2119 return; |
| 2115 apps_page_shortcut_->SetVisible(visible); | 2120 apps_page_shortcut_->SetVisible(visible); |
| 2116 UpdateBookmarksSeparatorVisibility(); | 2121 UpdateBookmarksSeparatorVisibility(); |
| 2117 LayoutAndPaint(); | 2122 LayoutAndPaint(); |
| 2118 } | 2123 } |
| 2119 | 2124 |
| 2120 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2125 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 2121 if (UpdateOtherAndManagedButtonsVisibility()) | 2126 if (UpdateOtherAndManagedButtonsVisibility()) |
| 2122 LayoutAndPaint(); | 2127 LayoutAndPaint(); |
| 2123 } | 2128 } |
| OLD | NEW |