| 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 #include "ppapi/c/dev/ppb_file_chooser_dev.h" | 5 #include "ppapi/c/dev/ppb_file_chooser_dev.h" |
| 6 #include "ppapi/c/pp_input_event.h" | 6 #include "ppapi/c/pp_input_event.h" |
| 7 #include "ppapi/cpp/completion_callback.h" | 7 #include "ppapi/cpp/completion_callback.h" |
| 8 #include "ppapi/cpp/dev/file_chooser_dev.h" | 8 #include "ppapi/cpp/dev/file_chooser_dev.h" |
| 9 #include "ppapi/cpp/dev/file_ref_dev.h" | 9 #include "ppapi/cpp/file_ref.h" |
| 10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
| 11 #include "ppapi/cpp/private/instance_private.h" | 11 #include "ppapi/cpp/private/instance_private.h" |
| 12 #include "ppapi/cpp/private/var_private.h" | 12 #include "ppapi/cpp/private/var_private.h" |
| 13 | 13 |
| 14 class MyInstance : public pp::InstancePrivate { | 14 class MyInstance : public pp::InstancePrivate { |
| 15 public: | 15 public: |
| 16 MyInstance(PP_Instance instance) | 16 MyInstance(PP_Instance instance) |
| 17 : pp::InstancePrivate(instance) { | 17 : pp::InstancePrivate(instance) { |
| 18 callback_factory_.Initialize(this); | 18 callback_factory_.Initialize(this); |
| 19 } | 19 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 49 pp::FileChooser_Dev* file_chooser = new pp::FileChooser_Dev( | 49 pp::FileChooser_Dev* file_chooser = new pp::FileChooser_Dev( |
| 50 *this, options); | 50 *this, options); |
| 51 file_chooser->Show(callback_factory_.NewCallback( | 51 file_chooser->Show(callback_factory_.NewCallback( |
| 52 &MyInstance::ShowSelectedFileNames, file_chooser)); | 52 &MyInstance::ShowSelectedFileNames, file_chooser)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void ShowSelectedFileNames(int32_t, pp::FileChooser_Dev* file_chooser) { | 55 void ShowSelectedFileNames(int32_t, pp::FileChooser_Dev* file_chooser) { |
| 56 if (!file_chooser) | 56 if (!file_chooser) |
| 57 return; | 57 return; |
| 58 | 58 |
| 59 pp::FileRef_Dev file_ref = file_chooser->GetNextChosenFile(); | 59 pp::FileRef file_ref = file_chooser->GetNextChosenFile(); |
| 60 while (!file_ref.is_null()) { | 60 while (!file_ref.is_null()) { |
| 61 Log(file_ref.GetName()); | 61 Log(file_ref.GetName()); |
| 62 file_ref = file_chooser->GetNextChosenFile(); | 62 file_ref = file_chooser->GetNextChosenFile(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 delete file_chooser; | 65 delete file_chooser; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void RecreateConsole() { | 68 void RecreateConsole() { |
| 69 pp::VarPrivate doc = GetWindowObject().GetProperty("document"); | 69 pp::VarPrivate doc = GetWindowObject().GetProperty("document"); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 namespace pp { | 100 namespace pp { |
| 101 | 101 |
| 102 // Factory function for your specialization of the Module object. | 102 // Factory function for your specialization of the Module object. |
| 103 Module* CreateModule() { | 103 Module* CreateModule() { |
| 104 return new MyModule(); | 104 return new MyModule(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace pp | 107 } // namespace pp |
| OLD | NEW |