Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc

Issue 1915983009: Fixed material design ink drop location for the MD download shelf buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "Removed FloodFillInkDropAnimation ctor. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_item_view_md.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 #include "ui/base/material_design/material_design_controller.h" 81 #include "ui/base/material_design/material_design_controller.h"
82 #include "ui/base/page_transition_types.h" 82 #include "ui/base/page_transition_types.h"
83 #include "ui/base/resource/resource_bundle.h" 83 #include "ui/base/resource/resource_bundle.h"
84 #include "ui/base/theme_provider.h" 84 #include "ui/base/theme_provider.h"
85 #include "ui/base/window_open_disposition.h" 85 #include "ui/base/window_open_disposition.h"
86 #include "ui/compositor/paint_recorder.h" 86 #include "ui/compositor/paint_recorder.h"
87 #include "ui/gfx/animation/slide_animation.h" 87 #include "ui/gfx/animation/slide_animation.h"
88 #include "ui/gfx/canvas.h" 88 #include "ui/gfx/canvas.h"
89 #include "ui/gfx/color_utils.h" 89 #include "ui/gfx/color_utils.h"
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/paint_vector_icon.h" 92 #include "ui/gfx/paint_vector_icon.h"
92 #include "ui/gfx/scoped_canvas.h" 93 #include "ui/gfx/scoped_canvas.h"
93 #include "ui/gfx/text_constants.h" 94 #include "ui/gfx/text_constants.h"
94 #include "ui/gfx/text_elider.h" 95 #include "ui/gfx/text_elider.h"
95 #include "ui/gfx/vector_icons_public.h" 96 #include "ui/gfx/vector_icons_public.h"
96 #include "ui/resources/grit/ui_resources.h" 97 #include "ui/resources/grit/ui_resources.h"
97 #include "ui/views/animation/button_ink_drop_delegate.h" 98 #include "ui/views/animation/button_ink_drop_delegate.h"
98 #include "ui/views/animation/flood_fill_ink_drop_animation.h" 99 #include "ui/views/animation/flood_fill_ink_drop_animation.h"
99 #include "ui/views/animation/ink_drop_hover.h" 100 #include "ui/views/animation/ink_drop_hover.h"
100 #include "ui/views/button_drag_utils.h" 101 #include "ui/views/button_drag_utils.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 bool animations_enabled = true; 183 bool animations_enabled = true;
183 184
184 gfx::ImageSkia* GetImageSkiaNamed(int id) { 185 gfx::ImageSkia* GetImageSkiaNamed(int id) {
185 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id); 186 return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(id);
186 } 187 }
187 188
188 int GetHorizontalMargin() { 189 int GetHorizontalMargin() {
189 return kHorizontalMargin[ui::MaterialDesignController::GetMode()]; 190 return kHorizontalMargin[ui::MaterialDesignController::GetMode()];
190 } 191 }
191 192
192 gfx::Size CalculateInkDropSize(const gfx::Size& button_size) { 193 gfx::Rect CalculateInkDropBounds(const gfx::Size& size) {
193 gfx::Size ink_drop_size(button_size); 194 gfx::Rect ink_drop_bounds(size);
194 ink_drop_size.Enlarge(0, -2); 195 ink_drop_bounds.Inset(0, 1);
195 return ink_drop_size; 196 return ink_drop_bounds;
196 } 197 }
197 198
198 // BookmarkButtonBase ----------------------------------------------- 199 // BookmarkButtonBase -----------------------------------------------
199 200
200 // Base class for non-menu hosting buttons used on the bookmark bar. 201 // Base class for non-menu hosting buttons used on the bookmark bar.
201 202
202 class BookmarkButtonBase : public views::LabelButton { 203 class BookmarkButtonBase : public views::LabelButton {
203 public: 204 public:
204 BookmarkButtonBase(views::ButtonListener* listener, 205 BookmarkButtonBase(views::ButtonListener* listener,
205 const base::string16& title) 206 const base::string16& title)
(...skipping 27 matching lines...) Expand all
233 234
234 bool IsTriggerableEvent(const ui::Event& e) override { 235 bool IsTriggerableEvent(const ui::Event& e) override {
235 return e.type() == ui::ET_GESTURE_TAP || 236 return e.type() == ui::ET_GESTURE_TAP ||
236 e.type() == ui::ET_GESTURE_TAP_DOWN || 237 e.type() == ui::ET_GESTURE_TAP_DOWN ||
237 event_utils::IsPossibleDispositionEvent(e); 238 event_utils::IsPossibleDispositionEvent(e);
238 } 239 }
239 240
240 std::unique_ptr<views::InkDropAnimation> CreateInkDropAnimation() 241 std::unique_ptr<views::InkDropAnimation> CreateInkDropAnimation()
241 const override { 242 const override {
242 return base::WrapUnique(new views::FloodFillInkDropAnimation( 243 return base::WrapUnique(new views::FloodFillInkDropAnimation(
243 CalculateInkDropSize(size()), GetInkDropCenter(), 244 CalculateInkDropBounds(size()), GetInkDropCenter(),
244 GetInkDropBaseColor())); 245 GetInkDropBaseColor()));
245 } 246 }
246 247
247 std::unique_ptr<views::InkDropHover> CreateInkDropHover() const override { 248 std::unique_ptr<views::InkDropHover> CreateInkDropHover() const override {
248 if (!ShouldShowInkDropHover()) 249 if (!ShouldShowInkDropHover())
249 return nullptr; 250 return nullptr;
250 return base::WrapUnique( 251
251 new views::InkDropHover(CalculateInkDropSize(size()), 0, 252 const gfx::Rect bounds = CalculateInkDropBounds(size());
252 GetInkDropCenter(), GetInkDropBaseColor())); 253 return base::WrapUnique(new views::InkDropHover(
254 bounds.size(), 0, bounds.CenterPoint(), GetInkDropBaseColor()));
253 } 255 }
254 256
255 SkColor GetInkDropBaseColor() const override { 257 SkColor GetInkDropBaseColor() const override {
256 return GetThemeProvider()->GetColor( 258 return GetThemeProvider()->GetColor(
257 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); 259 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
258 } 260 }
259 261
260 private: 262 private:
261 std::unique_ptr<gfx::SlideAnimation> show_animation_; 263 std::unique_ptr<gfx::SlideAnimation> show_animation_;
262 264
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 views::MenuButtonListener* menu_button_listener, 336 views::MenuButtonListener* menu_button_listener,
335 bool show_menu_marker) 337 bool show_menu_marker)
336 : MenuButton(title, menu_button_listener, show_menu_marker), 338 : MenuButton(title, menu_button_listener, show_menu_marker),
337 ink_drop_delegate_(this, this) { 339 ink_drop_delegate_(this, this) {
338 set_ink_drop_delegate(&ink_drop_delegate_); 340 set_ink_drop_delegate(&ink_drop_delegate_);
339 } 341 }
340 342
341 std::unique_ptr<views::InkDropAnimation> CreateInkDropAnimation() 343 std::unique_ptr<views::InkDropAnimation> CreateInkDropAnimation()
342 const override { 344 const override {
343 return base::WrapUnique(new views::FloodFillInkDropAnimation( 345 return base::WrapUnique(new views::FloodFillInkDropAnimation(
344 CalculateInkDropSize(size()), GetInkDropCenter(), 346 CalculateInkDropBounds(size()), GetInkDropCenter(),
345 GetInkDropBaseColor())); 347 GetInkDropBaseColor()));
346 } 348 }
347 349
348 std::unique_ptr<views::InkDropHover> CreateInkDropHover() const override { 350 std::unique_ptr<views::InkDropHover> CreateInkDropHover() const override {
349 if (!ShouldShowInkDropHover()) 351 if (!ShouldShowInkDropHover())
350 return nullptr; 352 return nullptr;
351 return base::WrapUnique( 353
352 new views::InkDropHover(CalculateInkDropSize(size()), 0, 354 const gfx::Rect bounds = CalculateInkDropBounds(size());
353 GetInkDropCenter(), GetInkDropBaseColor())); 355 return base::WrapUnique(new views::InkDropHover(
356 bounds.size(), 0, bounds.CenterPoint(), GetInkDropBaseColor()));
354 } 357 }
355 358
356 SkColor GetInkDropBaseColor() const override { 359 SkColor GetInkDropBaseColor() const override {
357 return GetThemeProvider()->GetColor( 360 return GetThemeProvider()->GetColor(
358 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); 361 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
359 } 362 }
360 363
361 private: 364 private:
362 // Controls the visual feedback for the button state. 365 // Controls the visual feedback for the button state.
363 views::ButtonInkDropDelegate ink_drop_delegate_; 366 views::ButtonInkDropDelegate ink_drop_delegate_;
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 return; 2164 return;
2162 apps_page_shortcut_->SetVisible(visible); 2165 apps_page_shortcut_->SetVisible(visible);
2163 UpdateBookmarksSeparatorVisibility(); 2166 UpdateBookmarksSeparatorVisibility();
2164 LayoutAndPaint(); 2167 LayoutAndPaint();
2165 } 2168 }
2166 2169
2167 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { 2170 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() {
2168 if (UpdateOtherAndManagedButtonsVisibility()) 2171 if (UpdateOtherAndManagedButtonsVisibility())
2169 LayoutAndPaint(); 2172 LayoutAndPaint();
2170 } 2173 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_item_view_md.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698