[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / devtools / protocol / color_picker.h
blobe4de5257516eb37a32424c143f73bef2887e60fd
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.
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_COLOR_PICKER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_COLOR_PICKER_H_
8 #include "base/callback.h"
9 #include "content/public/browser/render_widget_host.h"
10 #include "third_party/skia/include/core/SkBitmap.h"
12 namespace blink {
13 class WebMouseEvent;
16 namespace content {
18 class RenderWidgetHostImpl;
20 namespace devtools {
21 namespace page {
23 class ColorPicker {
24 public:
25 typedef base::Callback<void(int, int, int, int)> ColorPickedCallback;
27 explicit ColorPicker(ColorPickedCallback callback);
28 virtual ~ColorPicker();
30 void SetRenderWidgetHost(RenderWidgetHostImpl* host);
31 void SetEnabled(bool enabled);
32 void OnSwapCompositorFrame();
34 private:
35 void UpdateFrame();
36 void ResetFrame();
37 void FrameUpdated(const SkBitmap&, ReadbackResponse);
38 bool HandleMouseEvent(const blink::WebMouseEvent& event);
39 void UpdateCursor();
41 ColorPickedCallback callback_;
42 bool enabled_;
43 SkBitmap frame_;
44 int last_cursor_x_;
45 int last_cursor_y_;
46 RenderWidgetHost::MouseEventCallback mouse_event_callback_;
47 RenderWidgetHostImpl* host_;
48 base::WeakPtrFactory<ColorPicker> weak_factory_;
50 DISALLOW_COPY_AND_ASSIGN(ColorPicker);
53 } // namespace page
54 } // namespace devtools
55 } // namespace content
57 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_COLOR_PICKER_H_