OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_ | |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #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.
| |
13 #include "googleurl/src/gurl.h" | |
14 #include "ppapi/c/pp_file_info.h" | |
15 #include "ppapi/host/host_message_context.h" | |
16 #include "ppapi/host/resource_host.h" | |
17 | |
18 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.
| |
19 using webkit::ppapi::PluginDelegate; | |
20 | |
21 namespace content { | |
22 | |
23 class RendererPpapiHost; | |
24 | |
25 class PepperFileSystemHost : | |
26 public ppapi::host::ResourceHost, | |
yzshen1
2013/04/08 21:05:16
Wrong indent.
victorhsieh
2013/04/08 23:44:38
Done.
| |
27 public base::SupportsWeakPtr<PepperFileSystemHost> { | |
28 public: | |
29 PepperFileSystemHost(RendererPpapiHost* host, | |
30 PP_Instance instance, | |
31 PP_Resource resource, | |
32 PP_FileSystemType type); | |
33 virtual ~PepperFileSystemHost(); | |
34 | |
35 // ppapi::host::ResourceHost override. | |
36 virtual int32_t OnResourceMessageReceived( | |
37 const IPC::Message& msg, | |
38 ppapi::host::HostMessageContext* context) OVERRIDE; | |
39 | |
40 // Supports FileRefs direct access on the host side. | |
41 PP_FileSystemType GetType() const { return type_; } | |
42 bool IsOpened() const { return opened_; } | |
43 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
| |
44 | |
45 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:
| |
46 const std::string& root); | |
47 | |
48 private: | |
49 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, | |
50 int64_t expected_size); | |
51 | |
52 RendererPpapiHost* renderer_ppapi_host_; | |
53 ReplyMessageContext reply_context_; | |
54 base::WeakPtrFactory<PepperFileSystemHost> weak_factory_; | |
55 | |
56 PP_FileSystemType type_; | |
57 bool opened_; // whether open is successful. | |
58 std::string root_url_; | |
59 bool called_open_; // whether open has been called. | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(PepperFileSystemHost); | |
62 }; | |
63 | |
64 } // namespace content | |
65 | |
66 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_SYSTEM_HOST_H_ | |
OLD | NEW |