summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/pepper_widget.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 18:09:38 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 18:09:38 +0000
commit4b5ea27735e55571b5c745e5827fc1e217d97447 (patch)
treecda78aa3bf86fa440525126f8daf2404782450fc /chrome/renderer/pepper_widget.h
parent18b0832d7e012df21a196777add97c67e4b72cd9 (diff)
downloadchromium_src-4b5ea27735e55571b5c745e5827fc1e217d97447.zip
chromium_src-4b5ea27735e55571b5c745e5827fc1e217d97447.tar.gz
chromium_src-4b5ea27735e55571b5c745e5827fc1e217d97447.tar.bz2
Add new widget API to Pepper to replace the old theming API. The implementation is a copy of the WebKit code, I will figure out how to reuse it soon.
Review URL: http://codereview.chromium.org/2011004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46710 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/pepper_widget.h')
-rw-r--r--chrome/renderer/pepper_widget.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/chrome/renderer/pepper_widget.h b/chrome/renderer/pepper_widget.h
new file mode 100644
index 0000000..1cc84f6
--- /dev/null
+++ b/chrome/renderer/pepper_widget.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_RENDERER_PEPPER_WIDGET_H_
+#define CHROME_RENDERER_PEPPER_WIDGET_H_
+
+#include "base/basictypes.h"
+#include "third_party/npapi/bindings/npapi_extensions.h"
+
+class Graphics2DDeviceContext;
+
+// Every class that implements a Pepper widget derives from this.
+class PepperWidget {
+ public:
+ static NPWidgetExtensions* GetWidgetExtensions();
+
+ PepperWidget();
+ void Init(NPP instance, int id);
+
+ // Called as a result of the corresponding Pepper functions.
+ virtual void Destroy() = 0;
+ virtual void Paint(Graphics2DDeviceContext* context, const NPRect& dirty) = 0;
+ virtual bool HandleEvent(const NPPepperEvent& event) = 0;
+ virtual void GetProperty(NPWidgetProperty property, void* value) = 0;
+ virtual void SetProperty(NPWidgetProperty property, void* value) = 0;
+
+ protected:
+ ~PepperWidget();
+
+ // Tells the plugin that a property changed.
+ void WidgetPropertyChanged(NPWidgetProperty property);
+
+ private:
+ NPP instance_;
+ int id_;
+
+ DISALLOW_COPY_AND_ASSIGN(PepperWidget);
+};
+
+#endif // CHROME_RENDERER_PEPPER_WIDGET_H_