diff options
-rw-r--r-- | webkit/glue/plugins/plugin_instance.cc | 12 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_instance.h | 5 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_stream.cc | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_stream.h | 3 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_stream_posix.cc | 6 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_stream_win.cc | 8 |
6 files changed, 19 insertions, 19 deletions
diff --git a/webkit/glue/plugins/plugin_instance.cc b/webkit/glue/plugins/plugin_instance.cc index 893b6ec..54711b7 100644 --- a/webkit/glue/plugins/plugin_instance.cc +++ b/webkit/glue/plugins/plugin_instance.cc @@ -4,6 +4,7 @@ #include "webkit/glue/plugins/plugin_instance.h" +#include "base/file_util.h" #include "base/message_loop.h" #include "base/string_util.h" #include "base/thread_local_storage.h" @@ -205,6 +206,11 @@ void PluginInstance::NPP_Destroy() { mozilla_extenstions_ = NULL; } #endif + + for (unsigned int file_index = 0; file_index < files_created_.size(); + file_index++) { + file_util::Delete(files_created_[file_index], false); + } } NPError PluginInstance::NPP_SetWindow(NPWindow *window) { @@ -272,6 +278,12 @@ void PluginInstance::NPP_StreamAsFile(NPStream *stream, const char *fname) { if (npp_functions_->asfile != 0) { npp_functions_->asfile(npp_, stream, fname); } + + // Creating a temporary FilePath instance on the stack as the explicit + // FilePath constructor with StringType as an argument causes a compiler + // error when invoked via vector push back. + FilePath file_name(UTF8ToWide(fname)); + files_created_.push_back(file_name); } void PluginInstance::NPP_URLNotify(const char *url, diff --git a/webkit/glue/plugins/plugin_instance.h b/webkit/glue/plugins/plugin_instance.h index 953c303..82042c2 100644 --- a/webkit/glue/plugins/plugin_instance.h +++ b/webkit/glue/plugins/plugin_instance.h @@ -13,6 +13,7 @@ #include <stack> #include "base/basictypes.h" +#include "base/file_path.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/thread_local_storage.h" @@ -254,6 +255,10 @@ class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { // True if in CloseStreams(). bool in_close_streams_; + // List of files created for the current plugin instance. File names are + // added to the list every time the NPP_StreamAsFile function is called. + std::vector<FilePath> files_created_; + DISALLOW_EVIL_CONSTRUCTORS(PluginInstance); }; diff --git a/webkit/glue/plugins/plugin_stream.cc b/webkit/glue/plugins/plugin_stream.cc index 0af76c5..bc12ace 100644 --- a/webkit/glue/plugins/plugin_stream.cc +++ b/webkit/glue/plugins/plugin_stream.cc @@ -17,8 +17,8 @@ namespace NPAPI { PluginStream::~PluginStream() { - // always cleanup our temporary files. - CleanupTempFile(); + // always close our temporary files. + CloseTempFile(); free(const_cast<char*>(stream_.url)); } diff --git a/webkit/glue/plugins/plugin_stream.h b/webkit/glue/plugins/plugin_stream.h index 6c5875b..7b1250f 100644 --- a/webkit/glue/plugins/plugin_stream.h +++ b/webkit/glue/plugins/plugin_stream.h @@ -87,9 +87,6 @@ class PluginStream : public base::RefCounted<PluginStream> { // Closes the temporary file if it is open. void CloseTempFile(); - // Closes the temporary file if it is open and deletes the file. - void CleanupTempFile(); - // Sends the data to the file. Called From WriteToFile. size_t WriteBytes(const char *buf, size_t length); diff --git a/webkit/glue/plugins/plugin_stream_posix.cc b/webkit/glue/plugins/plugin_stream_posix.cc index 3eb7c4a..10bcdfd7 100644 --- a/webkit/glue/plugins/plugin_stream_posix.cc +++ b/webkit/glue/plugins/plugin_stream_posix.cc @@ -67,12 +67,6 @@ void PluginStream::CloseTempFile() { temp_file_ = NULL; } -void PluginStream::CleanupTempFile() { - CloseTempFile(); - file_util::Delete(temp_file_path_, false); - temp_file_path_ = FilePath(""); -} - bool PluginStream::TempFileIsValid() { return temp_file_ != NULL; } diff --git a/webkit/glue/plugins/plugin_stream_win.cc b/webkit/glue/plugins/plugin_stream_win.cc index d1c7519..2ab4a92 100644 --- a/webkit/glue/plugins/plugin_stream_win.cc +++ b/webkit/glue/plugins/plugin_stream_win.cc @@ -89,14 +89,6 @@ void PluginStream::CloseTempFile() { } } -void PluginStream::CleanupTempFile() { - CloseTempFile(); - if (temp_file_name_[0] != '\0') { - DeleteFileA(temp_file_name_); - temp_file_name_[0] = '\0'; - } -} - bool PluginStream::TempFileIsValid() { return temp_file_handle_ != INVALID_HANDLE_VALUE; } |