OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_RENDERER_PEPPER_WIDGET_H_ | 5 #ifndef CHROME_RENDERER_PEPPER_WIDGET_H_ |
6 #define CHROME_RENDERER_PEPPER_WIDGET_H_ | 6 #define CHROME_RENDERER_PEPPER_WIDGET_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "third_party/npapi/bindings/npapi_extensions.h" | 9 #include "third_party/npapi/bindings/npapi_extensions.h" |
10 | 10 |
11 class Graphics2DDeviceContext; | 11 class Graphics2DDeviceContext; |
12 | 12 |
13 // Every class that implements a Pepper widget derives from this. | 13 // Every class that implements a Pepper widget derives from this. |
14 class PepperWidget { | 14 class PepperWidget { |
15 public: | 15 public: |
16 static NPWidgetExtensions* GetWidgetExtensions(); | 16 static NPWidgetExtensions* GetWidgetExtensions(); |
17 | 17 |
18 PepperWidget(); | 18 PepperWidget(); |
19 void Init(NPP instance, int id); | 19 void Init(NPP instance, int id); |
20 | 20 |
21 // Called as a result of the corresponding Pepper functions. | 21 // Called as a result of the corresponding Pepper functions. |
22 virtual void Destroy() = 0; | 22 virtual void Destroy() = 0; |
23 virtual void Paint(Graphics2DDeviceContext* context, const NPRect& dirty) = 0; | 23 virtual void Paint(Graphics2DDeviceContext* context, const NPRect& dirty) = 0; |
24 virtual bool HandleEvent(const NPPepperEvent& event) = 0; | 24 virtual bool HandleEvent(const NPPepperEvent& event) = 0; |
25 virtual void GetProperty(NPWidgetProperty property, void* value) = 0; | 25 virtual void GetProperty(NPWidgetProperty property, void* value) = 0; |
26 virtual void SetProperty(NPWidgetProperty property, void* value) = 0; | 26 virtual void SetProperty(NPWidgetProperty property, void* value) = 0; |
27 | 27 |
28 protected: | 28 protected: |
29 ~PepperWidget(); | 29 virtual ~PepperWidget(); |
30 | 30 |
31 // Tells the plugin that a property changed. | 31 // Tells the plugin that a property changed. |
32 void WidgetPropertyChanged(NPWidgetProperty property); | 32 void WidgetPropertyChanged(NPWidgetProperty property); |
33 | 33 |
34 private: | 34 private: |
35 NPP instance_; | 35 NPP instance_; |
36 int id_; | 36 int id_; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(PepperWidget); | 38 DISALLOW_COPY_AND_ASSIGN(PepperWidget); |
39 }; | 39 }; |
40 | 40 |
41 #endif // CHROME_RENDERER_PEPPER_WIDGET_H_ | 41 #endif // CHROME_RENDERER_PEPPER_WIDGET_H_ |
OLD | NEW |