| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  108   } |  108   } | 
|  109 } |  109 } | 
|  110  |  110  | 
|  111 bool ColorPicker::HandleMouseEvent(const blink::WebMouseEvent& event) { |  111 bool ColorPicker::HandleMouseEvent(const blink::WebMouseEvent& event) { | 
|  112   last_cursor_x_ = event.x; |  112   last_cursor_x_ = event.x; | 
|  113   last_cursor_y_ = event.y; |  113   last_cursor_y_ = event.y; | 
|  114   if (frame_.drawsNothing()) |  114   if (frame_.drawsNothing()) | 
|  115     return true; |  115     return true; | 
|  116  |  116  | 
|  117   if (event.button == blink::WebMouseEvent::Button::Left && |  117   if (event.button == blink::WebMouseEvent::Button::Left && | 
|  118       event.type == blink::WebInputEvent::MouseDown) { |  118       event.type() == blink::WebInputEvent::MouseDown) { | 
|  119     if (last_cursor_x_ < 0 || last_cursor_x_ >= frame_.width() || |  119     if (last_cursor_x_ < 0 || last_cursor_x_ >= frame_.width() || | 
|  120         last_cursor_y_ < 0 || last_cursor_y_ >= frame_.height()) { |  120         last_cursor_y_ < 0 || last_cursor_y_ >= frame_.height()) { | 
|  121       return true; |  121       return true; | 
|  122     } |  122     } | 
|  123  |  123  | 
|  124     SkAutoLockPixels lock_image(frame_); |  124     SkAutoLockPixels lock_image(frame_); | 
|  125     SkColor sk_color = frame_.getColor(last_cursor_x_, last_cursor_y_); |  125     SkColor sk_color = frame_.getColor(last_cursor_x_, last_cursor_y_); | 
|  126     callback_.Run(SkColorGetR(sk_color), SkColorGetG(sk_color), |  126     callback_.Run(SkColorGetR(sk_color), SkColorGetG(sk_color), | 
|  127                   SkColorGetB(sk_color), SkColorGetA(sk_color)); |  127                   SkColorGetB(sk_color), SkColorGetA(sk_color)); | 
|  128   } |  128   } | 
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  253       gfx::Point(kHotspotOffset * device_scale_factor, |  253       gfx::Point(kHotspotOffset * device_scale_factor, | 
|  254                  kHotspotOffset * device_scale_factor); |  254                  kHotspotOffset * device_scale_factor); | 
|  255  |  255  | 
|  256   cursor.InitFromCursorInfo(cursor_info); |  256   cursor.InitFromCursorInfo(cursor_info); | 
|  257   DCHECK(host_); |  257   DCHECK(host_); | 
|  258   host_->SetCursor(cursor); |  258   host_->SetCursor(cursor); | 
|  259 } |  259 } | 
|  260  |  260  | 
|  261 }  // namespace protocol |  261 }  // namespace protocol | 
|  262 }  // namespace content |  262 }  // namespace content | 
| OLD | NEW |