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

Side by Side Diff: ash/common/shelf/app_list_button.cc

Issue 2661163003: [Chrome OS] Fix the broken focus rectangle on Launcher icon. (Closed)
Patch Set: Address estade@'s comment. Created 3 years, 10 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/common/shelf/app_list_button.h" 5 #include "ash/common/shelf/app_list_button.h"
6 6
7 #include "ash/common/ash_constants.h" 7 #include "ash/common/ash_constants.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/shelf/ink_drop_button_listener.h" 9 #include "ash/common/shelf/ink_drop_button_listener.h"
10 #include "ash/common/shelf/shelf_constants.h" 10 #include "ash/common/shelf/shelf_constants.h"
11 #include "ash/common/shelf/shelf_item_types.h" 11 #include "ash/common/shelf/shelf_item_types.h"
12 #include "ash/common/shelf/shelf_view.h" 12 #include "ash/common/shelf/shelf_view.h"
13 #include "ash/common/shelf/wm_shelf.h" 13 #include "ash/common/shelf/wm_shelf.h"
14 #include "ash/common/shelf/wm_shelf_util.h" 14 #include "ash/common/shelf/wm_shelf_util.h"
15 #include "ash/common/system/tray/tray_popup_utils.h" 15 #include "ash/common/system/tray/tray_popup_utils.h"
16 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
17 #include "ash/public/cpp/shelf_types.h" 17 #include "ash/public/cpp/shelf_types.h"
18 #include "base/command_line.h" 18 #include "base/command_line.h"
19 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
20 #include "grit/ash_resources.h" 20 #include "grit/ash_resources.h"
21 #include "grit/ash_strings.h" 21 #include "grit/ash_strings.h"
22 #include "ui/accessibility/ax_node_data.h" 22 #include "ui/accessibility/ax_node_data.h"
23 #include "ui/app_list/app_list_switches.h" 23 #include "ui/app_list/app_list_switches.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
26 #include "ui/gfx/canvas.h" 26 #include "ui/gfx/canvas.h"
27 #include "ui/gfx/scoped_canvas.h"
27 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 28 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
28 #include "ui/views/animation/ink_drop_impl.h" 29 #include "ui/views/animation/ink_drop_impl.h"
29 #include "ui/views/animation/ink_drop_mask.h" 30 #include "ui/views/animation/ink_drop_mask.h"
30 #include "ui/views/painter.h" 31 #include "ui/views/painter.h"
31 32
32 namespace ash { 33 namespace ash {
33 34
34 AppListButton::AppListButton(InkDropButtonListener* listener, 35 AppListButton::AppListButton(InkDropButtonListener* listener,
35 ShelfView* shelf_view, 36 ShelfView* shelf_view,
36 WmShelf* wm_shelf) 37 WmShelf* wm_shelf)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 SkPaint bg_paint; 167 SkPaint bg_paint;
167 bg_paint.setColor(SkColorSetA(kShelfBaseColor, background_alpha_)); 168 bg_paint.setColor(SkColorSetA(kShelfBaseColor, background_alpha_));
168 bg_paint.setFlags(SkPaint::kAntiAlias_Flag); 169 bg_paint.setFlags(SkPaint::kAntiAlias_Flag);
169 bg_paint.setStyle(SkPaint::kFill_Style); 170 bg_paint.setStyle(SkPaint::kFill_Style);
170 canvas->DrawCircle(circle_center, kAppListButtonRadius, bg_paint); 171 canvas->DrawCircle(circle_center, kAppListButtonRadius, bg_paint);
171 172
172 // Paint a white ring as the foreground. The ceil/dsf math assures that the 173 // Paint a white ring as the foreground. The ceil/dsf math assures that the
173 // ring draws sharply and is centered at all scale factors. 174 // ring draws sharply and is centered at all scale factors.
174 const float kRingOuterRadiusDp = 7.f; 175 const float kRingOuterRadiusDp = 7.f;
175 const float kRingThicknessDp = 1.5f; 176 const float kRingThicknessDp = 1.5f;
177 gfx::ScopedCanvas scoped_canvas(canvas);
176 const float dsf = canvas->UndoDeviceScaleFactor(); 178 const float dsf = canvas->UndoDeviceScaleFactor();
177 circle_center.Scale(dsf); 179 circle_center.Scale(dsf);
178 180
179 SkPaint fg_paint; 181 SkPaint fg_paint;
180 fg_paint.setFlags(SkPaint::kAntiAlias_Flag); 182 fg_paint.setFlags(SkPaint::kAntiAlias_Flag);
181 fg_paint.setStyle(SkPaint::kStroke_Style); 183 fg_paint.setStyle(SkPaint::kStroke_Style);
182 fg_paint.setColor(kShelfIconColor); 184 fg_paint.setColor(kShelfIconColor);
183 const float thickness = std::ceil(kRingThicknessDp * dsf); 185 const float thickness = std::ceil(kRingThicknessDp * dsf);
184 const float radius = std::ceil(kRingOuterRadiusDp * dsf) - thickness / 2; 186 const float radius = std::ceil(kRingOuterRadiusDp * dsf) - thickness / 2;
185 fg_paint.setStrokeWidth(thickness); 187 fg_paint.setStrokeWidth(thickness);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return gfx::Point(x_mid, x_mid); 303 return gfx::Point(x_mid, x_mid);
302 } else if (alignment == SHELF_ALIGNMENT_RIGHT) { 304 } else if (alignment == SHELF_ALIGNMENT_RIGHT) {
303 return gfx::Point(y_mid, y_mid); 305 return gfx::Point(y_mid, y_mid);
304 } else { 306 } else {
305 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT); 307 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT);
306 return gfx::Point(width() - y_mid, y_mid); 308 return gfx::Point(width() - y_mid, y_mid);
307 } 309 }
308 } 310 }
309 311
310 } // namespace ash 312 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698