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

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

Issue 13726024: Refactor FileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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.h
diff --git a/content/renderer/pepper/pepper_file_system_host.h b/content/renderer/pepper/pepper_file_system_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..251426f9abb1e4578183fa0955421829665436fc
--- /dev/null
+++ b/content/renderer/pepper/pepper_file_system_host.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_
+#define CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/weak_ptr.h"
+#include "content/public/renderer/renderer_ppapi_host.h"
yzshen1 2013/04/08 21:05:16 Please move this to the .cc file, you have forward
victorhsieh 2013/04/08 23:44:38 Done.
+#include "googleurl/src/gurl.h"
+#include "ppapi/c/pp_file_info.h"
+#include "ppapi/host/host_message_context.h"
+#include "ppapi/host/resource_host.h"
+
+using ppapi::host::ReplyMessageContext;
yzshen1 2013/04/08 21:05:16 no using in .h files, please.
victorhsieh 2013/04/08 23:44:38 Done.
+using webkit::ppapi::PluginDelegate;
+
+namespace content {
+
+class RendererPpapiHost;
+
+class PepperFileSystemHost :
+ public ppapi::host::ResourceHost,
yzshen1 2013/04/08 21:05:16 Wrong indent.
victorhsieh 2013/04/08 23:44:38 Done.
+ public base::SupportsWeakPtr<PepperFileSystemHost> {
+ public:
+ PepperFileSystemHost(RendererPpapiHost* host,
+ PP_Instance instance,
+ PP_Resource resource,
+ PP_FileSystemType type);
+ virtual ~PepperFileSystemHost();
+
+ // ppapi::host::ResourceHost override.
+ virtual int32_t OnResourceMessageReceived(
+ const IPC::Message& msg,
+ ppapi::host::HostMessageContext* context) OVERRIDE;
+
+ // Supports FileRefs direct access on the host side.
+ PP_FileSystemType GetType() const { return type_; }
+ bool IsOpened() const { return opened_; }
+ std::string GetRootUrl() const { return root_url_; }
yzshen1 2013/04/08 21:05:16 Shall we use GURL instead of std::string?
victorhsieh 2013/04/08 23:44:38 Done. I made it a string to avoid sending GURL th
+
+ void OpenFileSystemReply(int pp_error,
yzshen1 2013/04/08 21:05:16 It could be private method. Please always use int
victorhsieh 2013/04/08 23:44:38 It's put in public to allow PlatformCallbackAdapto
yzshen1 2013/04/09 17:25:42 It is fine to leave it as it is. On 2013/04/08 23:
+ const std::string& root);
+
+ private:
+ int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context,
+ int64_t expected_size);
+
+ RendererPpapiHost* renderer_ppapi_host_;
+ ReplyMessageContext reply_context_;
+ base::WeakPtrFactory<PepperFileSystemHost> weak_factory_;
+
+ PP_FileSystemType type_;
+ bool opened_; // whether open is successful.
+ std::string root_url_;
+ bool called_open_; // whether open has been called.
+
+ DISALLOW_COPY_AND_ASSIGN(PepperFileSystemHost);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_

Powered by Google App Engine
This is Rietveld 408576698