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

Unified Diff: ppapi/example/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
« no previous file with comments | « content/renderer/pepper/pepper_plugin_delegate_impl.cc ('k') | ppapi/host/host_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/example/example.cc
diff --git a/ppapi/example/example.cc b/ppapi/example/example.cc
index 0832deedcbcd2801d8433f2c6a35e46948c9aed0..073596a06a63309b950d830fb5e53f638015024b 100644
--- a/ppapi/example/example.cc
+++ b/ppapi/example/example.cc
@@ -19,6 +19,7 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_rect.h"
#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/dev/file_chooser_dev.h"
#include "ppapi/cpp/dev/memory_dev.h"
#include "ppapi/cpp/dev/scriptable_object_deprecated.h"
#include "ppapi/cpp/graphics_2d.h"
@@ -180,6 +181,7 @@ class MyInstance : public pp::InstancePrivate, public MyFetcherClient {
print_settings_valid_(false),
showing_custom_cursor_(false) {
RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
+ callback_factory_.Initialize(this);
}
virtual ~MyInstance() {
@@ -207,11 +209,20 @@ class MyInstance : public pp::InstancePrivate, public MyFetcherClient {
return true;
}
+ 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:
- SayHello();
- ToggleCursor();
+ chooser_ = pp::FileChooser_Dev(this, PP_FILECHOOSERMODE_OPEN, "text/html");
+ //< std::vector<FileRef> >
+ chooser_.Show(callback_factory_.NewCallbackWithOutput(&MyInstance::GotFile));
+ //SayHello();
+ //ToggleCursor();
return true;
case PP_INPUTEVENT_TYPE_MOUSEMOVE:
return true;
« no previous file with comments | « content/renderer/pepper/pepper_plugin_delegate_impl.cc ('k') | ppapi/host/host_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698