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

Side by Side Diff: chrome/browser/ui/views/toolbar/back_button.cc

Issue 1298513003: Implemented prototype for new ink drop specs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from patch set 10. Created 5 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/toolbar/back_button.h" 5 #include "chrome/browser/ui/views/toolbar/back_button.h"
6 6
7 #include "ui/gfx/geometry/insets.h" 7 #include "ui/gfx/geometry/insets.h"
8 #include "ui/views/animation/ink_drop_animation_controller.h" 8 #include "ui/views/animation/ink_drop_animation_controller.h"
9 #include "ui/views/controls/button/label_button_border.h" 9 #include "ui/views/controls/button/label_button_border.h"
10 #include "ui/views/painter.h" 10 #include "ui/views/painter.h"
(...skipping 14 matching lines...) Expand all
25 // TODO(gbillock): Refactor this magic number somewhere global to views, 25 // TODO(gbillock): Refactor this magic number somewhere global to views,
26 // probably a FocusBorder constant. 26 // probably a FocusBorder constant.
27 const int kFocusRectInset = 3; 27 const int kFocusRectInset = 3;
28 SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets( 28 SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets(
29 gfx::Insets(kFocusRectInset, kFocusRectInset + margin, 29 gfx::Insets(kFocusRectInset, kFocusRectInset + margin,
30 kFocusRectInset, kFocusRectInset))); 30 kFocusRectInset, kFocusRectInset)));
31 31
32 InvalidateLayout(); 32 InvalidateLayout();
33 } 33 }
34 34
35 void BackButton::LayoutInkDrop() { 35 gfx::Point BackButton::CalculateInkDropCenter() const {
36 ink_drop_animation_controller()->SetInkDropBounds( 36 return gfx::Point((width() + margin_leading_) / 2, height() / 2);
37 gfx::Rect(margin_leading_, 0, width() - margin_leading_, height()));
38 } 37 }
39 38
40 const char* BackButton::GetClassName() const { 39 const char* BackButton::GetClassName() const {
41 return "BackButton"; 40 return "BackButton";
42 } 41 }
43 42
44 scoped_ptr<views::LabelButtonBorder> BackButton::CreateDefaultBorder() const { 43 scoped_ptr<views::LabelButtonBorder> BackButton::CreateDefaultBorder() const {
45 scoped_ptr<views::LabelButtonBorder> border = 44 scoped_ptr<views::LabelButtonBorder> border =
46 ToolbarButton::CreateDefaultBorder(); 45 ToolbarButton::CreateDefaultBorder();
47 46
48 // Adjust border insets to follow the margin change, 47 // Adjust border insets to follow the margin change,
49 // which will be reflected in where the border is painted 48 // which will be reflected in where the border is painted
50 // through |GetThemePaintRect|. 49 // through |GetThemePaintRect|.
51 const gfx::Insets insets(border->GetInsets()); 50 const gfx::Insets insets(border->GetInsets());
52 border->set_insets(gfx::Insets(insets.top(), insets.left() + margin_leading_, 51 border->set_insets(gfx::Insets(insets.top(), insets.left() + margin_leading_,
53 insets.bottom(), insets.right())); 52 insets.bottom(), insets.right()));
54 53
55 return border.Pass(); 54 return border.Pass();
56 } 55 }
57 56
58 gfx::Rect BackButton::GetThemePaintRect() const { 57 gfx::Rect BackButton::GetThemePaintRect() const {
59 gfx::Rect rect(LabelButton::GetThemePaintRect()); 58 gfx::Rect rect(LabelButton::GetThemePaintRect());
60 rect.Inset(margin_leading_, 0, 0, 0); 59 rect.Inset(margin_leading_, 0, 0, 0);
61 return rect; 60 return rect;
62 } 61 }
63 62
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/back_button.h ('k') | chrome/browser/ui/views/toolbar/toolbar_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698