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

Side by Side Diff: chrome/browser/ui/views/download/download_item_view_md.cc

Issue 2311423002: Harmony - update button focus rings. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | ui/views/controls/button/md_text_button.h » ('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/download/download_item_view_md.h" 5 #include "chrome/browser/ui/views/download/download_item_view_md.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "ui/gfx/image/image.h" 58 #include "ui/gfx/image/image.h"
59 #include "ui/gfx/paint_vector_icon.h" 59 #include "ui/gfx/paint_vector_icon.h"
60 #include "ui/gfx/text_elider.h" 60 #include "ui/gfx/text_elider.h"
61 #include "ui/gfx/text_utils.h" 61 #include "ui/gfx/text_utils.h"
62 #include "ui/gfx/vector_icons_public.h" 62 #include "ui/gfx/vector_icons_public.h"
63 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 63 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
64 #include "ui/views/animation/ink_drop_highlight.h" 64 #include "ui/views/animation/ink_drop_highlight.h"
65 #include "ui/views/border.h" 65 #include "ui/views/border.h"
66 #include "ui/views/controls/button/image_button.h" 66 #include "ui/views/controls/button/image_button.h"
67 #include "ui/views/controls/button/md_text_button.h" 67 #include "ui/views/controls/button/md_text_button.h"
68 #include "ui/views/controls/focusable_border.h"
68 #include "ui/views/controls/label.h" 69 #include "ui/views/controls/label.h"
69 #include "ui/views/mouse_constants.h" 70 #include "ui/views/mouse_constants.h"
70 #include "ui/views/widget/root_view.h" 71 #include "ui/views/widget/root_view.h"
71 #include "ui/views/widget/widget.h" 72 #include "ui/views/widget/widget.h"
72 73
73 using content::DownloadItem; 74 using content::DownloadItem;
74 using extensions::ExperienceSamplingEvent; 75 using extensions::ExperienceSamplingEvent;
75 76
76 namespace { 77 namespace {
77 78
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 const int kCompleteAnimationDurationMs = 2500; 120 const int kCompleteAnimationDurationMs = 2500;
120 121
121 // How long the 'download interrupted' animation should last for. 122 // How long the 'download interrupted' animation should last for.
122 const int kInterruptedAnimationDurationMs = 2500; 123 const int kInterruptedAnimationDurationMs = 2500;
123 124
124 // How long we keep the item disabled after the user clicked it to open the 125 // How long we keep the item disabled after the user clicked it to open the
125 // downloaded item. 126 // downloaded item.
126 const int kDisabledOnOpenDuration = 3000; 127 const int kDisabledOnOpenDuration = 3000;
127 128
128 // The separator is drawn as a border. It's one dp wide. 129 // The separator is drawn as a border. It's one dp wide.
129 class SeparatorBorder : public views::Border { 130 class SeparatorBorder : public views::FocusableBorder {
130 public: 131 public:
131 explicit SeparatorBorder(SkColor color) : color_(color) {} 132 explicit SeparatorBorder(SkColor color) : color_(color) {}
132 ~SeparatorBorder() override {} 133 ~SeparatorBorder() override {}
133 134
134 void Paint(const views::View& view, gfx::Canvas* canvas) override { 135 void Paint(const views::View& view, gfx::Canvas* canvas) override {
136 if (view.HasFocus())
137 return FocusableBorder::Paint(view, canvas);
138
135 int end_x = base::i18n::IsRTL() ? 0 : view.width() - 1; 139 int end_x = base::i18n::IsRTL() ? 0 : view.width() - 1;
136 canvas->DrawLine(gfx::Point(end_x, kTopBottomPadding), 140 canvas->DrawLine(gfx::Point(end_x, kTopBottomPadding),
137 gfx::Point(end_x, view.height() - kTopBottomPadding), 141 gfx::Point(end_x, view.height() - kTopBottomPadding),
138 color_); 142 color_);
139 } 143 }
140 144
141 gfx::Insets GetInsets() const override { return gfx::Insets(0, 0, 0, 1); } 145 gfx::Insets GetInsets() const override { return gfx::Insets(0, 0, 0, 1); }
142 146
143 gfx::Size GetMinimumSize() const override { 147 gfx::Size GetMinimumSize() const override {
144 return gfx::Size(1, 2 * kTopBottomPadding + 1); 148 return gfx::Size(1, 2 * kTopBottomPadding + 1);
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 // transparent, start with a black backdrop (which is the default initialized 609 // transparent, start with a black backdrop (which is the default initialized
606 // color for opaque canvases). 610 // color for opaque canvases).
607 canvas->DrawColor(SK_ColorBLACK); 611 canvas->DrawColor(SK_ColorBLACK);
608 canvas->DrawColor( 612 canvas->DrawColor(
609 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR)); 613 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR));
610 614
611 DrawStatusText(canvas); 615 DrawStatusText(canvas);
612 DrawFilename(canvas); 616 DrawFilename(canvas);
613 DrawIcon(canvas); 617 DrawIcon(canvas);
614 OnPaintBorder(canvas); 618 OnPaintBorder(canvas);
615
616 if (HasFocus())
617 views::MdTextButton::PaintMdFocusRing(canvas, this, 1, SK_AlphaOPAQUE);
618 } 619 }
619 620
620 int DownloadItemViewMd::GetYForFilenameText() const { 621 int DownloadItemViewMd::GetYForFilenameText() const {
621 int text_height = font_list_.GetBaseline(); 622 int text_height = font_list_.GetBaseline();
622 if (!status_text_.empty()) 623 if (!status_text_.empty())
623 text_height += kVerticalTextPadding + status_font_list_.GetBaseline(); 624 text_height += kVerticalTextPadding + status_font_list_.GetBaseline();
624 return (height() - text_height) / 2; 625 return (height() - text_height) / 2;
625 } 626 }
626 627
627 void DownloadItemViewMd::DrawStatusText(gfx::Canvas* canvas) { 628 void DownloadItemViewMd::DrawStatusText(gfx::Canvas* canvas) {
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 SchedulePaint(); 1121 SchedulePaint();
1121 } 1122 }
1122 1123
1123 SkColor DownloadItemViewMd::GetTextColor() const { 1124 SkColor DownloadItemViewMd::GetTextColor() const {
1124 return GetTextColorForThemeProvider(GetThemeProvider()); 1125 return GetTextColorForThemeProvider(GetThemeProvider());
1125 } 1126 }
1126 1127
1127 SkColor DownloadItemViewMd::GetDimmedTextColor() const { 1128 SkColor DownloadItemViewMd::GetDimmedTextColor() const {
1128 return SkColorSetA(GetTextColor(), 0xC7); 1129 return SkColorSetA(GetTextColor(), 0xC7);
1129 } 1130 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698