mesa gn build: suppress -Wstring-conversion warnings
[chromium-blink-merge.git] / content / renderer / pepper / ppb_widget_impl.h
blob001b96ffaaf4c20e5b0a69abe84f2b7d4c8855fb
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_PEPPER_PPB_WIDGET_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PPB_WIDGET_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ppapi/c/pp_rect.h"
11 #include "ppapi/shared_impl/resource.h"
12 #include "ppapi/thunk/ppb_widget_api.h"
14 namespace gfx {
15 class Rect;
17 namespace ppapi {
18 struct InputEventData;
21 namespace content {
23 class PPB_ImageData_Impl;
25 class PPB_Widget_Impl : public ppapi::Resource,
26 public ppapi::thunk::PPB_Widget_API {
27 public:
28 explicit PPB_Widget_Impl(PP_Instance instance);
30 // Resource overrides.
31 ppapi::thunk::PPB_Widget_API* AsPPB_Widget_API() override;
33 // PPB_WidgetAPI implementation.
34 PP_Bool Paint(const PP_Rect* rect, PP_Resource) override;
35 PP_Bool HandleEvent(PP_Resource pp_input_event) override;
36 PP_Bool GetLocation(PP_Rect* location) override;
37 void SetLocation(const PP_Rect* location) override;
38 void SetScale(float scale) override;
40 // Notifies the plugin instance that the given rect needs to be repainted.
41 void Invalidate(const PP_Rect* dirty);
43 protected:
44 ~PPB_Widget_Impl() override;
46 virtual PP_Bool PaintInternal(const gfx::Rect& rect,
47 PPB_ImageData_Impl* image) = 0;
48 virtual PP_Bool HandleEventInternal(const ppapi::InputEventData& data) = 0;
49 virtual void SetLocationInternal(const PP_Rect* location) = 0;
51 PP_Rect location() const { return location_; }
52 float scale() const { return scale_; }
54 private:
55 PP_Rect location_;
56 float scale_;
58 DISALLOW_COPY_AND_ASSIGN(PPB_Widget_Impl);
61 } // namespace content
63 #endif // CONTENT_RENDERER_PEPPER_PPB_WIDGET_IMPL_H_