Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / renderer / renderer_webcolorchooser_impl.h
blob36e7fc15c60dbb02e86962109fb62b0d0ddbaacf
1 // Copyright (c) 2012 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_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_
6 #define CONTENT_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_
8 #include <vector>
10 #include "base/compiler_specific.h"
11 #include "content/public/common/color_suggestion.h"
12 #include "content/public/renderer/render_frame_observer.h"
13 #include "third_party/WebKit/public/web/WebColorChooser.h"
14 #include "third_party/WebKit/public/web/WebColorChooserClient.h"
15 #include "third_party/skia/include/core/SkColor.h"
17 namespace blink {
18 class WebFrame;
21 namespace content {
23 class RendererWebColorChooserImpl : public blink::WebColorChooser,
24 public RenderFrameObserver {
25 public:
26 explicit RendererWebColorChooserImpl(RenderFrame* render_frame,
27 blink::WebColorChooserClient*);
28 virtual ~RendererWebColorChooserImpl();
30 // blink::WebColorChooser implementation:
31 virtual void setSelectedColor(const blink::WebColor);
32 virtual void endChooser();
34 void Open(SkColor initial_color,
35 const std::vector<content::ColorSuggestion>& suggestions);
37 blink::WebColorChooserClient* client() { return client_; }
39 private:
40 // RenderFrameObserver implementation:
41 // Don't destroy the RendererWebColorChooserImpl when the RenderFrame goes
42 // away. RendererWebColorChooserImpl is owned by
43 // blink::ColorChooserUIController.
44 void OnDestruct() override {}
45 bool OnMessageReceived(const IPC::Message& message) override;
47 void OnDidChooseColorResponse(int color_chooser_id, SkColor color);
48 void OnDidEndColorChooser(int color_chooser_id);
50 int identifier_;
51 blink::WebColorChooserClient* client_;
53 DISALLOW_COPY_AND_ASSIGN(RendererWebColorChooserImpl);
56 } // namespace content
58 #endif // CONTENT_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_