| Index: webkit/plugins/ppapi/ppb_file_chooser_impl.cc
|
| ===================================================================
|
| --- webkit/plugins/ppapi/ppb_file_chooser_impl.cc (revision 0)
|
| +++ webkit/plugins/ppapi/ppb_file_chooser_impl.cc (working copy)
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/glue/plugins/pepper_file_chooser.h"
|
| +#include "webkit/plugins/ppapi/ppb_file_chooser_impl.h"
|
|
|
| #include <string>
|
| #include <vector>
|
| @@ -15,11 +15,11 @@
|
| #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
|
| -#include "webkit/glue/plugins/pepper_common.h"
|
| -#include "webkit/glue/plugins/pepper_file_ref.h"
|
| -#include "webkit/glue/plugins/pepper_plugin_delegate.h"
|
| -#include "webkit/glue/plugins/pepper_plugin_instance.h"
|
| -#include "webkit/glue/plugins/pepper_resource_tracker.h"
|
| +#include "webkit/plugins/ppapi/common.h"
|
| +#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
|
| +#include "webkit/plugins/ppapi/plugin_delegate.h"
|
| +#include "webkit/plugins/ppapi/plugin_instance.h"
|
| +#include "webkit/plugins/ppapi/resource_tracker.h"
|
| #include "webkit/glue/webkit_glue.h"
|
|
|
| using WebKit::WebCString;
|
| @@ -28,7 +28,8 @@
|
| using WebKit::WebString;
|
| using WebKit::WebVector;
|
|
|
| -namespace pepper {
|
| +namespace webkit {
|
| +namespace ppapi {
|
|
|
| namespace {
|
|
|
| @@ -42,17 +43,17 @@
|
| (options->mode != PP_FILECHOOSERMODE_OPENMULTIPLE))
|
| return 0;
|
|
|
| - FileChooser* chooser = new FileChooser(instance, options);
|
| + PPB_FileChooser_Impl* chooser = new PPB_FileChooser_Impl(instance, options);
|
| return chooser->GetReference();
|
| }
|
|
|
| PP_Bool IsFileChooser(PP_Resource resource) {
|
| - return BoolToPPBool(!!Resource::GetAs<FileChooser>(resource));
|
| + return BoolToPPBool(!!Resource::GetAs<PPB_FileChooser_Impl>(resource));
|
| }
|
|
|
| int32_t Show(PP_Resource chooser_id, PP_CompletionCallback callback) {
|
| - scoped_refptr<FileChooser> chooser(
|
| - Resource::GetAs<FileChooser>(chooser_id));
|
| + scoped_refptr<PPB_FileChooser_Impl> chooser(
|
| + Resource::GetAs<PPB_FileChooser_Impl>(chooser_id));
|
| if (!chooser)
|
| return PP_ERROR_BADRESOURCE;
|
|
|
| @@ -60,12 +61,12 @@
|
| }
|
|
|
| PP_Resource GetNextChosenFile(PP_Resource chooser_id) {
|
| - scoped_refptr<FileChooser> chooser(
|
| - Resource::GetAs<FileChooser>(chooser_id));
|
| + scoped_refptr<PPB_FileChooser_Impl> chooser(
|
| + Resource::GetAs<PPB_FileChooser_Impl>(chooser_id));
|
| if (!chooser)
|
| return 0;
|
|
|
| - scoped_refptr<FileRef> file_ref(chooser->GetNextChosenFile());
|
| + scoped_refptr<PPB_FileRef_Impl> file_ref(chooser->GetNextChosenFile());
|
| if (!file_ref)
|
| return 0;
|
|
|
| @@ -81,7 +82,7 @@
|
|
|
| class FileChooserCompletionImpl : public WebFileChooserCompletion {
|
| public:
|
| - FileChooserCompletionImpl(pepper::FileChooser* file_chooser)
|
| + FileChooserCompletionImpl(PPB_FileChooser_Impl* file_chooser)
|
| : file_chooser_(file_chooser) {
|
| DCHECK(file_chooser_);
|
| }
|
| @@ -97,12 +98,12 @@
|
| }
|
|
|
| private:
|
| - FileChooser* file_chooser_;
|
| + PPB_FileChooser_Impl* file_chooser_;
|
| };
|
|
|
| } // namespace
|
|
|
| -FileChooser::FileChooser(PluginInstance* instance,
|
| +PPB_FileChooser_Impl::PPB_FileChooser_Impl(PluginInstance* instance,
|
| const PP_FileChooserOptions_Dev* options)
|
| : Resource(instance->module()),
|
| delegate_(instance->delegate()),
|
| @@ -111,25 +112,26 @@
|
| completion_callback_() {
|
| }
|
|
|
| -FileChooser::~FileChooser() {
|
| +PPB_FileChooser_Impl::~PPB_FileChooser_Impl() {
|
| }
|
|
|
| // static
|
| -const PPB_FileChooser_Dev* FileChooser::GetInterface() {
|
| +const PPB_FileChooser_Dev* PPB_FileChooser_Impl::GetInterface() {
|
| return &ppb_filechooser;
|
| }
|
|
|
| -FileChooser* FileChooser::AsFileChooser() {
|
| +PPB_FileChooser_Impl* PPB_FileChooser_Impl::AsPPB_FileChooser_Impl() {
|
| return this;
|
| }
|
|
|
| -void FileChooser::StoreChosenFiles(const std::vector<std::string>& files) {
|
| +void PPB_FileChooser_Impl::StoreChosenFiles(
|
| + const std::vector<std::string>& files) {
|
| next_chosen_file_index_ = 0;
|
| std::vector<std::string>::const_iterator end_it = files.end();
|
| for (std::vector<std::string>::const_iterator it = files.begin();
|
| it != end_it; it++) {
|
| chosen_files_.push_back(make_scoped_refptr(
|
| - new FileRef(module(), FilePath().AppendASCII(*it))));
|
| + new PPB_FileRef_Impl(module(), FilePath().AppendASCII(*it))));
|
| }
|
|
|
| if (!completion_callback_.func)
|
| @@ -140,7 +142,7 @@
|
| PP_RunCompletionCallback(&callback, 0);
|
| }
|
|
|
| -int32_t FileChooser::Show(PP_CompletionCallback callback) {
|
| +int32_t PPB_FileChooser_Impl::Show(PP_CompletionCallback callback) {
|
| DCHECK((mode_ == PP_FILECHOOSERMODE_OPEN) ||
|
| (mode_ == PP_FILECHOOSERMODE_OPENMULTIPLE));
|
| DCHECK(!completion_callback_.func);
|
| @@ -155,11 +157,13 @@
|
| params, new FileChooserCompletionImpl(this));
|
| }
|
|
|
| -scoped_refptr<FileRef> FileChooser::GetNextChosenFile() {
|
| +scoped_refptr<PPB_FileRef_Impl> PPB_FileChooser_Impl::GetNextChosenFile() {
|
| if (next_chosen_file_index_ >= chosen_files_.size())
|
| return NULL;
|
|
|
| return chosen_files_[next_chosen_file_index_++];
|
| }
|
|
|
| -} // namespace pepper
|
| +} // namespace ppapi
|
| +} // namespace webkit
|
| +
|
|
|