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

Side by Side Diff: chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.cc

Issue 2629643002: chromeos: Renames WmWindowAura to WmWindow (Closed)
Patch Set: feedback Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromeos/ui/accessibility_cursor_ring_layer.h" 5 #include "chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/common/wm_window.h"
8 #include "ash/display/window_tree_host_manager.h" 8 #include "ash/display/window_tree_host_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "third_party/skia/include/core/SkPaint.h" 11 #include "third_party/skia/include/core/SkPaint.h"
12 #include "third_party/skia/include/core/SkPath.h" 12 #include "third_party/skia/include/core/SkPath.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/compositor/layer.h" 14 #include "ui/compositor/layer.h"
15 #include "ui/compositor/paint_recorder.h" 15 #include "ui/compositor/paint_recorder.h"
16 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
17 17
(...skipping 26 matching lines...) Expand all
44 44
45 gfx::Rect bounds = gfx::Rect(location.x(), location.y(), 0, 0); 45 gfx::Rect bounds = gfx::Rect(location.x(), location.y(), 0, 0);
46 int inset = kGradientWidth + kCursorRingRadius + kLayerMargin; 46 int inset = kGradientWidth + kCursorRingRadius + kLayerMargin;
47 bounds.Inset(-inset, -inset, -inset, -inset); 47 bounds.Inset(-inset, -inset, -inset, -inset);
48 48
49 display::Display display = 49 display::Display display =
50 display::Screen::GetScreen()->GetDisplayMatching(bounds); 50 display::Screen::GetScreen()->GetDisplayMatching(bounds);
51 aura::Window* root_window = ash::Shell::GetInstance() 51 aura::Window* root_window = ash::Shell::GetInstance()
52 ->window_tree_host_manager() 52 ->window_tree_host_manager()
53 ->GetRootWindowForDisplayId(display.id()); 53 ->GetRootWindowForDisplayId(display.id());
54 ash::WmWindow* root_wm_window = ash::WmWindowAura::Get(root_window); 54 ash::WmWindow* root_wm_window = ash::WmWindow::Get(root_window);
55 bounds = root_wm_window->ConvertRectFromScreen(bounds); 55 bounds = root_wm_window->ConvertRectFromScreen(bounds);
56 CreateOrUpdateLayer(root_window, "AccessibilityCursorRing", bounds); 56 CreateOrUpdateLayer(root_window, "AccessibilityCursorRing", bounds);
57 } 57 }
58 58
59 void AccessibilityCursorRingLayer::OnPaintLayer( 59 void AccessibilityCursorRingLayer::OnPaintLayer(
60 const ui::PaintContext& context) { 60 const ui::PaintContext& context) {
61 ui::PaintRecorder recorder(context, layer()->size()); 61 ui::PaintRecorder recorder(context, layer()->size());
62 62
63 SkPaint paint; 63 SkPaint paint;
64 paint.setFlags(SkPaint::kAntiAlias_Flag); 64 paint.setFlags(SkPaint::kAntiAlias_Flag);
65 paint.setStyle(SkPaint::kStroke_Style); 65 paint.setStyle(SkPaint::kStroke_Style);
66 paint.setStrokeWidth(2); 66 paint.setStrokeWidth(2);
67 67
68 gfx::Rect r = layer()->bounds(); 68 gfx::Rect r = layer()->bounds();
69 r.Offset(-r.OffsetFromOrigin()); 69 r.Offset(-r.OffsetFromOrigin());
70 r.Inset(kLayerMargin, kLayerMargin, kLayerMargin, kLayerMargin); 70 r.Inset(kLayerMargin, kLayerMargin, kLayerMargin, kLayerMargin);
71 const int w = kGradientWidth; 71 const int w = kGradientWidth;
72 for (int i = 0; i < w; ++i) { 72 for (int i = 0; i < w; ++i) {
73 paint.setColor( 73 paint.setColor(
74 SkColorSetARGBMacro(255 * (i) * (i) / (w * w), red_, green_, blue_)); 74 SkColorSetARGBMacro(255 * (i) * (i) / (w * w), red_, green_, blue_));
75 SkPath path; 75 SkPath path;
76 path.addOval(SkRect::MakeXYWH(r.x(), r.y(), r.width(), r.height())); 76 path.addOval(SkRect::MakeXYWH(r.x(), r.y(), r.width(), r.height()));
77 r.Inset(1, 1, 1, 1); 77 r.Inset(1, 1, 1, 1);
78 recorder.canvas()->DrawPath(path, paint); 78 recorder.canvas()->DrawPath(path, paint);
79 } 79 }
80 } 80 }
81 81
82 } // namespace chromeos 82 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/wallpaper_private_api.cc ('k') | chrome/browser/ui/ash/accelerator_commands_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698