| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> |
| 9 |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "content/public/common/color_suggestion.h" |
| 9 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_view_observer.h" |
| 10 #include "third_party/WebKit/public/web/WebColorChooser.h" | 13 #include "third_party/WebKit/public/web/WebColorChooser.h" |
| 11 #include "third_party/WebKit/public/web/WebColorChooserClient.h" | 14 #include "third_party/WebKit/public/web/WebColorChooserClient.h" |
| 12 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| 13 | 16 |
| 14 namespace blink { | 17 namespace blink { |
| 15 class WebFrame; | 18 class WebFrame; |
| 16 } | 19 } |
| 17 | 20 |
| 18 namespace content { | 21 namespace content { |
| 19 class RenderViewImpl; | 22 class RenderViewImpl; |
| 20 | 23 |
| 21 class RendererWebColorChooserImpl : public blink::WebColorChooser, | 24 class RendererWebColorChooserImpl : public blink::WebColorChooser, |
| 22 public RenderViewObserver { | 25 public RenderViewObserver { |
| 23 public: | 26 public: |
| 24 explicit RendererWebColorChooserImpl(RenderViewImpl* sender, | 27 explicit RendererWebColorChooserImpl(RenderViewImpl* sender, |
| 25 blink::WebColorChooserClient*); | 28 blink::WebColorChooserClient*); |
| 26 virtual ~RendererWebColorChooserImpl(); | 29 virtual ~RendererWebColorChooserImpl(); |
| 27 | 30 |
| 28 virtual void setSelectedColor(const blink::WebColor); | 31 virtual void setSelectedColor(const blink::WebColor); |
| 29 virtual void endChooser(); | 32 virtual void endChooser(); |
| 30 | 33 |
| 31 void Open(SkColor initial_color); | 34 void Open(SkColor initial_color, |
| 35 const std::vector<content::ColorSuggestion>& suggestions); |
| 32 | 36 |
| 33 blink::WebColorChooserClient* client() { return client_; } | 37 blink::WebColorChooserClient* client() { return client_; } |
| 34 | 38 |
| 35 private: | 39 private: |
| 36 // RenderViewObserver implementation. | 40 // RenderViewObserver implementation. |
| 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 38 | 42 |
| 39 void OnDidChooseColorResponse(int color_chooser_id, SkColor color); | 43 void OnDidChooseColorResponse(int color_chooser_id, SkColor color); |
| 40 void OnDidEndColorChooser(int color_chooser_id); | 44 void OnDidEndColorChooser(int color_chooser_id); |
| 41 | 45 |
| 42 int identifier_; | 46 int identifier_; |
| 43 blink::WebColorChooserClient* client_; | 47 blink::WebColorChooserClient* client_; |
| 44 | 48 |
| 45 DISALLOW_COPY_AND_ASSIGN(RendererWebColorChooserImpl); | 49 DISALLOW_COPY_AND_ASSIGN(RendererWebColorChooserImpl); |
| 46 }; | 50 }; |
| 47 | 51 |
| 48 } // namespace content | 52 } // namespace content |
| 49 | 53 |
| 50 #endif // CONTENT_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_ | 54 #endif // CONTENT_RENDERER_RENDERER_WEBCOLORCHOOSER_IMPL_H_ |
| OLD | NEW |