Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Unified Diff: ppapi/examples/2d/paint_manager_example.cc

Issue 10544089: Implement the file chooser as a new resource "host" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/examples/2d/paint_manager_example.cc
diff --git a/ppapi/examples/2d/paint_manager_example.cc b/ppapi/examples/2d/paint_manager_example.cc
index 86bdbe79ed8f9f2a8e820cd682f24c57cbb413d7..8cbd372d322c2654b1569829e97501461750c1d2 100644
--- a/ppapi/examples/2d/paint_manager_example.cc
+++ b/ppapi/examples/2d/paint_manager_example.cc
@@ -11,6 +11,8 @@
#include "ppapi/cpp/size.h"
#include "ppapi/cpp/view.h"
#include "ppapi/utility/graphics/paint_manager.h"
+#include "ppapi/cpp/dev/file_chooser_dev.h"
brettw 2012/06/30 19:01:58 Ignore the changes in this file; I'll revert befor
+#include "ppapi/utility/completion_callback_factory.h"
// Number of pixels to each side of the center of the square that we draw.
static const int kSquareRadius = 2;
@@ -44,11 +46,21 @@ class MyInstance : public pp::Instance, public pp::PaintManager::Client {
last_y_(0) {
paint_manager_.Initialize(this, this, false);
RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
+ callback_factory_.Initialize(this);
+ }
+
+ pp::FileChooser_Dev chooser_;
+ pp::CompletionCallbackFactory<MyInstance> callback_factory_;
+
+ void GotFile(int32_t result, const std::vector<pp::FileRef>& files) {
}
virtual bool HandleInputEvent(const pp::InputEvent& event) {
switch (event.GetType()) {
case PP_INPUTEVENT_TYPE_MOUSEDOWN: {
+ chooser_ = pp::FileChooser_Dev(this, PP_FILECHOOSERMODE_OPEN, "text/html");
+ chooser_.Show(callback_factory_.NewCallbackWithOutput(&MyInstance::GotFile));
+
pp::MouseInputEvent mouse_event(event);
// Update the square on a mouse down.
if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) {

Powered by Google App Engine
This is Rietveld 408576698