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

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 1860163003: Use MD-style focus indicator on DL shelf items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/custom_button.cc
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index f864f5ee08df1708b6daf3d81331b7fae2670c34..9a0e28a65a5e92a62935741c130cbb0fb2dd4962 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -52,15 +52,7 @@ class MdFocusRing : public views::View {
~MdFocusRing() override {}
void OnPaint(gfx::Canvas* canvas) override {
- SkPaint paint;
- paint.setAntiAlias(true);
- paint.setColor(GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_CallToActionColor));
- paint.setStyle(SkPaint::kStroke_Style);
- paint.setStrokeWidth(1);
- gfx::RectF rect(GetLocalBounds());
- rect.Inset(gfx::InsetsF(0.5));
- canvas->DrawRoundRect(rect, kFocusBorderCornerRadius, paint);
+ CustomButton::PaintMdFocusRing(canvas, this);
}
private:
@@ -77,9 +69,10 @@ const char CustomButton::kViewClassName[] = "CustomButton";
// static
const CustomButton* CustomButton::AsCustomButton(const views::View* view) {
- return AsCustomButton(const_cast<views::View*>(view));
+ return AsCustomButton(const_cast<View*>(view));
}
+// static
CustomButton* CustomButton::AsCustomButton(views::View* view) {
if (view) {
const char* classname = view->GetClassName();
@@ -95,6 +88,19 @@ CustomButton* CustomButton::AsCustomButton(views::View* view) {
return NULL;
}
+// static
+void CustomButton::PaintMdFocusRing(gfx::Canvas* canvas, views::View* view) {
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setColor(view->GetNativeTheme()->GetSystemColor(
+ ui::NativeTheme::kColorId_CallToActionColor));
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(1);
+ gfx::RectF rect(view->GetLocalBounds());
+ rect.Inset(gfx::InsetsF(0.5));
+ canvas->DrawRoundRect(rect, kFocusBorderCornerRadius, paint);
+}
+
CustomButton::~CustomButton() {}
void CustomButton::SetState(ButtonState state) {
« no previous file with comments | « ui/views/controls/button/custom_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698