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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 #include "ui/gfx/favicon_size.h" | 90 #include "ui/gfx/favicon_size.h" |
91 #include "ui/gfx/geometry/rect.h" | 91 #include "ui/gfx/geometry/rect.h" |
92 #include "ui/gfx/paint_vector_icon.h" | 92 #include "ui/gfx/paint_vector_icon.h" |
93 #include "ui/gfx/scoped_canvas.h" | 93 #include "ui/gfx/scoped_canvas.h" |
94 #include "ui/gfx/text_constants.h" | 94 #include "ui/gfx/text_constants.h" |
95 #include "ui/gfx/text_elider.h" | 95 #include "ui/gfx/text_elider.h" |
96 #include "ui/gfx/vector_icons_public.h" | 96 #include "ui/gfx/vector_icons_public.h" |
97 #include "ui/resources/grit/ui_resources.h" | 97 #include "ui/resources/grit/ui_resources.h" |
98 #include "ui/views/animation/button_ink_drop_delegate.h" | 98 #include "ui/views/animation/button_ink_drop_delegate.h" |
99 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 99 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
100 #include "ui/views/animation/ink_drop_hover.h" | 100 #include "ui/views/animation/ink_drop_highlight.h" |
101 #include "ui/views/button_drag_utils.h" | 101 #include "ui/views/button_drag_utils.h" |
102 #include "ui/views/controls/button/label_button.h" | 102 #include "ui/views/controls/button/label_button.h" |
103 #include "ui/views/controls/button/label_button_border.h" | 103 #include "ui/views/controls/button/label_button_border.h" |
104 #include "ui/views/controls/button/menu_button.h" | 104 #include "ui/views/controls/button/menu_button.h" |
105 #include "ui/views/controls/label.h" | 105 #include "ui/views/controls/label.h" |
106 #include "ui/views/drag_utils.h" | 106 #include "ui/views/drag_utils.h" |
107 #include "ui/views/metrics.h" | 107 #include "ui/views/metrics.h" |
108 #include "ui/views/view_constants.h" | 108 #include "ui/views/view_constants.h" |
109 #include "ui/views/widget/tooltip_manager.h" | 109 #include "ui/views/widget/tooltip_manager.h" |
110 #include "ui/views/widget/widget.h" | 110 #include "ui/views/widget/widget.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 e.type() == ui::ET_GESTURE_TAP_DOWN || | 238 e.type() == ui::ET_GESTURE_TAP_DOWN || |
239 event_utils::IsPossibleDispositionEvent(e); | 239 event_utils::IsPossibleDispositionEvent(e); |
240 } | 240 } |
241 | 241 |
242 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { | 242 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { |
243 return base::WrapUnique(new views::FloodFillInkDropRipple( | 243 return base::WrapUnique(new views::FloodFillInkDropRipple( |
244 CalculateInkDropBounds(size()), GetInkDropCenter(), | 244 CalculateInkDropBounds(size()), GetInkDropCenter(), |
245 GetInkDropBaseColor())); | 245 GetInkDropBaseColor())); |
246 } | 246 } |
247 | 247 |
248 std::unique_ptr<views::InkDropHover> CreateInkDropHover() const override { | 248 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
249 if (!ShouldShowInkDropHover()) | 249 const override { |
| 250 if (!ShouldShowInkDropHighlight()) |
250 return nullptr; | 251 return nullptr; |
251 | 252 |
252 const gfx::Rect bounds = CalculateInkDropBounds(size()); | 253 const gfx::Rect bounds = CalculateInkDropBounds(size()); |
253 return base::WrapUnique(new views::InkDropHover( | 254 return base::WrapUnique(new views::InkDropHighlight( |
254 bounds.size(), 0, bounds.CenterPoint(), GetInkDropBaseColor())); | 255 bounds.size(), 0, bounds.CenterPoint(), GetInkDropBaseColor())); |
255 } | 256 } |
256 | 257 |
257 SkColor GetInkDropBaseColor() const override { | 258 SkColor GetInkDropBaseColor() const override { |
258 return GetThemeProvider()->GetColor( | 259 return GetThemeProvider()->GetColor( |
259 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); | 260 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
260 } | 261 } |
261 | 262 |
262 private: | 263 private: |
263 std::unique_ptr<gfx::SlideAnimation> show_animation_; | 264 std::unique_ptr<gfx::SlideAnimation> show_animation_; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 set_ink_drop_delegate( | 336 set_ink_drop_delegate( |
336 base::WrapUnique(new views::ButtonInkDropDelegate(this, this))); | 337 base::WrapUnique(new views::ButtonInkDropDelegate(this, this))); |
337 } | 338 } |
338 | 339 |
339 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { | 340 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override { |
340 return base::WrapUnique(new views::FloodFillInkDropRipple( | 341 return base::WrapUnique(new views::FloodFillInkDropRipple( |
341 CalculateInkDropBounds(size()), GetInkDropCenter(), | 342 CalculateInkDropBounds(size()), GetInkDropCenter(), |
342 GetInkDropBaseColor())); | 343 GetInkDropBaseColor())); |
343 } | 344 } |
344 | 345 |
345 std::unique_ptr<views::InkDropHover> CreateInkDropHover() const override { | 346 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
346 if (!ShouldShowInkDropHover()) | 347 const override { |
| 348 if (!ShouldShowInkDropHighlight()) |
347 return nullptr; | 349 return nullptr; |
348 | 350 |
349 const gfx::Rect bounds = CalculateInkDropBounds(size()); | 351 const gfx::Rect bounds = CalculateInkDropBounds(size()); |
350 return base::WrapUnique(new views::InkDropHover( | 352 return base::WrapUnique(new views::InkDropHighlight( |
351 bounds.size(), 0, bounds.CenterPoint(), GetInkDropBaseColor())); | 353 bounds.size(), 0, bounds.CenterPoint(), GetInkDropBaseColor())); |
352 } | 354 } |
353 | 355 |
354 SkColor GetInkDropBaseColor() const override { | 356 SkColor GetInkDropBaseColor() const override { |
355 return GetThemeProvider()->GetColor( | 357 return GetThemeProvider()->GetColor( |
356 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); | 358 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
357 } | 359 } |
358 | 360 |
359 private: | 361 private: |
360 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuButtonBase); | 362 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuButtonBase); |
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |