OLD | NEW |
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 "content/browser/devtools/protocol/color_picker.h" | 5 #include "content/browser/devtools/protocol/color_picker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
10 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 10 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return; | 56 return; |
57 | 57 |
58 if (enabled) { | 58 if (enabled) { |
59 host_->AddMouseEventCallback(mouse_event_callback_); | 59 host_->AddMouseEventCallback(mouse_event_callback_); |
60 UpdateFrame(); | 60 UpdateFrame(); |
61 } else { | 61 } else { |
62 host_->RemoveMouseEventCallback(mouse_event_callback_); | 62 host_->RemoveMouseEventCallback(mouse_event_callback_); |
63 ResetFrame(); | 63 ResetFrame(); |
64 | 64 |
65 WebCursor pointer_cursor; | 65 WebCursor pointer_cursor; |
66 WebCursor::CursorInfo cursor_info; | 66 CursorInfo cursor_info; |
67 cursor_info.type = blink::WebCursorInfo::kTypePointer; | 67 cursor_info.type = blink::WebCursorInfo::kTypePointer; |
68 pointer_cursor.InitFromCursorInfo(cursor_info); | 68 pointer_cursor.InitFromCursorInfo(cursor_info); |
69 host_->SetCursor(pointer_cursor); | 69 host_->SetCursor(pointer_cursor); |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 void ColorPicker::OnSwapCompositorFrame() { | 73 void ColorPicker::OnSwapCompositorFrame() { |
74 if (enabled_) | 74 if (enabled_) |
75 UpdateFrame(); | 75 UpdateFrame(); |
76 } | 76 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 paint.setStyle(SkPaint::kStroke_Style); | 242 paint.setStyle(SkPaint::kStroke_Style); |
243 canvas.drawRect(pixel, paint); | 243 canvas.drawRect(pixel, paint); |
244 | 244 |
245 // Paint outline. | 245 // Paint outline. |
246 paint.setStrokeWidth(2); | 246 paint.setStrokeWidth(2); |
247 paint.setColor(SK_ColorDKGRAY); | 247 paint.setColor(SK_ColorDKGRAY); |
248 paint.setAntiAlias(true); | 248 paint.setAntiAlias(true); |
249 canvas.drawCircle(kCursorSize / 2, kCursorSize / 2, kDiameter / 2, paint); | 249 canvas.drawCircle(kCursorSize / 2, kCursorSize / 2, kDiameter / 2, paint); |
250 | 250 |
251 WebCursor cursor; | 251 WebCursor cursor; |
252 WebCursor::CursorInfo cursor_info; | 252 CursorInfo cursor_info; |
253 cursor_info.type = blink::WebCursorInfo::kTypeCustom; | 253 cursor_info.type = blink::WebCursorInfo::kTypeCustom; |
254 cursor_info.image_scale_factor = device_scale_factor; | 254 cursor_info.image_scale_factor = device_scale_factor; |
255 cursor_info.custom_image = result; | 255 cursor_info.custom_image = result; |
256 cursor_info.hotspot = | 256 cursor_info.hotspot = |
257 gfx::Point(kHotspotOffset * device_scale_factor, | 257 gfx::Point(kHotspotOffset * device_scale_factor, |
258 kHotspotOffset * device_scale_factor); | 258 kHotspotOffset * device_scale_factor); |
259 | 259 |
260 cursor.InitFromCursorInfo(cursor_info); | 260 cursor.InitFromCursorInfo(cursor_info); |
261 DCHECK(host_); | 261 DCHECK(host_); |
262 host_->SetCursor(cursor); | 262 host_->SetCursor(cursor); |
263 } | 263 } |
264 | 264 |
265 } // namespace protocol | 265 } // namespace protocol |
266 } // namespace content | 266 } // namespace content |
OLD | NEW |