Roll ANGLE bc75f36:ef9d63e
[chromium-blink-merge.git] / content / renderer / renderer_webcolorchooser_impl.h
blob99bd4013239ac74b4c142a16932d24e52a958177
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 virtual void OnDestruct() OVERRIDE {}
45 virtual 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_