| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_COLOR_PICKER_H_ | |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_COLOR_PICKER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "content/public/browser/readback_types.h" | |
| 11 #include "content/public/browser/render_widget_host.h" | |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | |
| 13 | |
| 14 namespace blink { | |
| 15 class WebMouseEvent; | |
| 16 } | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 class RenderWidgetHostImpl; | |
| 21 | |
| 22 namespace protocol { | |
| 23 | |
| 24 class ColorPicker { | |
| 25 public: | |
| 26 typedef base::Callback<void(int, int, int, int)> ColorPickedCallback; | |
| 27 | |
| 28 explicit ColorPicker(ColorPickedCallback callback); | |
| 29 virtual ~ColorPicker(); | |
| 30 | |
| 31 void SetRenderWidgetHost(RenderWidgetHostImpl* host); | |
| 32 void SetEnabled(bool enabled); | |
| 33 void OnSwapCompositorFrame(); | |
| 34 | |
| 35 private: | |
| 36 void UpdateFrame(); | |
| 37 void ResetFrame(); | |
| 38 void FrameUpdated(const SkBitmap&, ReadbackResponse); | |
| 39 bool HandleMouseEvent(const blink::WebMouseEvent& event); | |
| 40 void UpdateCursor(); | |
| 41 | |
| 42 ColorPickedCallback callback_; | |
| 43 bool enabled_; | |
| 44 SkBitmap frame_; | |
| 45 int last_cursor_x_; | |
| 46 int last_cursor_y_; | |
| 47 RenderWidgetHost::MouseEventCallback mouse_event_callback_; | |
| 48 RenderWidgetHostImpl* host_; | |
| 49 base::WeakPtrFactory<ColorPicker> weak_factory_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(ColorPicker); | |
| 52 }; | |
| 53 | |
| 54 } // namespace protocol | |
| 55 } // namespace content | |
| 56 | |
| 57 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_COLOR_PICKER_H_ | |
| OLD | NEW |