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

Unified Diff: content/renderer/pepper/pepper_file_system_host.cc

Issue 14796018: Cleanup: Deprecate FileSystemCallbackDispatcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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: content/renderer/pepper/pepper_file_system_host.cc
diff --git a/content/renderer/pepper/pepper_file_system_host.cc b/content/renderer/pepper/pepper_file_system_host.cc
index 13bff9a6678f218e7c854cd5e073121fb294b5f0..ac36cd0a6dc1f059c7139c1714ea7f7399898f8d 100644
--- a/content/renderer/pepper/pepper_file_system_host.cc
+++ b/content/renderer/pepper/pepper_file_system_host.cc
@@ -10,7 +10,6 @@
#include "content/common/fileapi/file_system_dispatcher.h"
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/renderer_ppapi_host.h"
-#include "content/renderer/pepper/null_file_system_callback_dispatcher.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/host/dispatch_host_message.h"
#include "ppapi/host/ppapi_host.h"
@@ -28,31 +27,6 @@ namespace content {
namespace {
-class PlatformCallbackAdaptor : public NullFileSystemCallbackDispatcher {
- public:
- explicit PlatformCallbackAdaptor(
- const base::WeakPtr<PepperFileSystemHost>& weak_host)
- : weak_host_(weak_host) {}
-
- virtual ~PlatformCallbackAdaptor() {}
-
- virtual void DidOpenFileSystem(const std::string& /* unused */,
- const GURL& root) OVERRIDE {
- if (weak_host_)
- weak_host_->OpenFileSystemReply(PP_OK, root);
- }
-
- virtual void DidFail(base::PlatformFileError platform_error) OVERRIDE {
- if (weak_host_) {
- weak_host_->OpenFileSystemReply(
- ppapi::PlatformFileErrorToPepperError(platform_error), GURL());
- }
- }
-
- private:
- base::WeakPtr<PepperFileSystemHost> weak_host_;
-};
-
bool LooksLikeAGuid(const std::string& fsid) {
const size_t kExpectedFsIdSize = 32;
if (fsid.size() != kExpectedFsIdSize)
@@ -97,13 +71,22 @@ int32_t PepperFileSystemHost::OnResourceMessageReceived(
return PP_ERROR_FAILED;
}
-void PepperFileSystemHost::OpenFileSystemReply(int32_t pp_error,
- const GURL& root) {
- opened_ = (pp_error == PP_OK);
+void PepperFileSystemHost::DidOpenFileSystem(
+ const std::string& /* name_unused */,
+ const GURL& root) {
+ opened_ = true;
root_url_ = root;
+ reply_context_.params.set_result(PP_OK);
+ host()->SendReply(reply_context_, PpapiPluginMsg_FileSystem_OpenReply());
+ reply_context_ = ppapi::host::ReplyMessageContext();
+}
+
+void PepperFileSystemHost::DidFailOpenFileSystem(
+ base::PlatformFileError error) {
+ int32 pp_error = ppapi::PlatformFileErrorToPepperError(error);
+ opened_ = (pp_error == PP_OK);
reply_context_.params.set_result(pp_error);
- host()->SendReply(reply_context_,
- PpapiPluginMsg_FileSystem_OpenReply());
+ host()->SendReply(reply_context_, PpapiPluginMsg_FileSystem_OpenReply());
reply_context_ = ppapi::host::ReplyMessageContext();
}
@@ -142,7 +125,10 @@ int32_t PepperFileSystemHost::OnHostMsgOpen(
GURL(plugin_instance->container()->element().document().url()).
GetOrigin(),
file_system_type, expected_size, true /* create */,
- new PlatformCallbackAdaptor(weak_factory_.GetWeakPtr()))) {
+ base::Bind(&PepperFileSystemHost::DidOpenFileSystem,
+ weak_factory_.GetWeakPtr()),
+ base::Bind(&PepperFileSystemHost::DidFailOpenFileSystem,
+ weak_factory_.GetWeakPtr()))) {
return PP_ERROR_FAILED;
}
« no previous file with comments | « content/renderer/pepper/pepper_file_system_host.h ('k') | content/renderer/pepper/pepper_plugin_delegate_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698