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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_file_io_host.h

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/files/file.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "base/platform_file.h" 14 #include "base/platform_file.h"
14 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" 15 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
15 #include "ipc/ipc_listener.h" 16 #include "ipc/ipc_listener.h"
16 #include "ipc/ipc_platform_file.h" 17 #include "ipc/ipc_platform_file.h"
17 #include "ppapi/c/pp_file_info.h" 18 #include "ppapi/c/pp_file_info.h"
18 #include "ppapi/c/pp_time.h" 19 #include "ppapi/c/pp_time.h"
19 #include "ppapi/host/host_message_context.h" 20 #include "ppapi/host/host_message_context.h"
20 #include "ppapi/host/resource_host.h" 21 #include "ppapi/host/resource_host.h"
21 #include "ppapi/shared_impl/file_io_state_manager.h" 22 #include "ppapi/shared_impl/file_io_state_manager.h"
22 #include "url/gurl.h" 23 #include "url/gurl.h"
23 #include "webkit/browser/fileapi/file_system_context.h" 24 #include "webkit/browser/fileapi/file_system_context.h"
24 25
25 namespace content { 26 namespace content {
26 class PepperFileSystemBrowserHost; 27 class PepperFileSystemBrowserHost;
27 28
28 class PepperFileIOHost : public ppapi::host::ResourceHost, 29 class PepperFileIOHost : public ppapi::host::ResourceHost,
29 public base::SupportsWeakPtr<PepperFileIOHost> { 30 public base::SupportsWeakPtr<PepperFileIOHost> {
30 public: 31 public:
31 typedef base::Callback<void (base::PlatformFileError)> 32 typedef base::Callback<void (base::File::Error)>
32 NotifyCloseFileCallback; 33 NotifyCloseFileCallback;
33 34
34 PepperFileIOHost(BrowserPpapiHostImpl* host, 35 PepperFileIOHost(BrowserPpapiHostImpl* host,
35 PP_Instance instance, 36 PP_Instance instance,
36 PP_Resource resource); 37 PP_Resource resource);
37 virtual ~PepperFileIOHost(); 38 virtual ~PepperFileIOHost();
38 39
39 // ppapi::host::ResourceHost override. 40 // ppapi::host::ResourceHost override.
40 virtual int32_t OnResourceMessageReceived( 41 virtual int32_t OnResourceMessageReceived(
41 const IPC::Message& msg, 42 const IPC::Message& msg,
(...skipping 17 matching lines...) Expand all
59 int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context, 60 int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context,
60 int64_t max_written_offset); 61 int64_t max_written_offset);
61 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context); 62 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context);
62 int32_t OnHostMsgRequestOSFileHandle( 63 int32_t OnHostMsgRequestOSFileHandle(
63 ppapi::host::HostMessageContext* context); 64 ppapi::host::HostMessageContext* context);
64 65
65 void GotPluginAllowedToCallRequestOSFileHandle( 66 void GotPluginAllowedToCallRequestOSFileHandle(
66 ppapi::host::ReplyMessageContext reply_context, 67 ppapi::host::ReplyMessageContext reply_context,
67 bool plugin_allowed); 68 bool plugin_allowed);
68 69
69 // Callback handlers. These mostly convert the PlatformFileError to the 70 // Callback handlers. These mostly convert the File::Error to the
70 // PP_Error code and send back the reply. Note that the argument 71 // PP_Error code and send back the reply. Note that the argument
71 // ReplyMessageContext is copied so that we have a closure containing all 72 // ReplyMessageContext is copied so that we have a closure containing all
72 // necessary information to reply. 73 // necessary information to reply.
73 void ExecutePlatformGeneralCallback( 74 void ExecutePlatformGeneralCallback(
74 ppapi::host::ReplyMessageContext reply_context, 75 ppapi::host::ReplyMessageContext reply_context,
75 base::PlatformFileError error_code); 76 base::File::Error error_code);
76 void ExecutePlatformOpenFileCallback( 77 void ExecutePlatformOpenFileCallback(
77 ppapi::host::ReplyMessageContext reply_context, 78 ppapi::host::ReplyMessageContext reply_context,
78 base::PlatformFileError error_code, 79 base::File::Error error_code,
79 base::PassPlatformFile file, 80 base::PassPlatformFile file,
80 bool unused_created); 81 bool unused_created);
81 82
82 void GotUIThreadStuffForInternalFileSystems( 83 void GotUIThreadStuffForInternalFileSystems(
83 ppapi::host::ReplyMessageContext reply_context, 84 ppapi::host::ReplyMessageContext reply_context,
84 int platform_file_flags, 85 int platform_file_flags,
85 UIThreadStuff ui_thread_stuff); 86 UIThreadStuff ui_thread_stuff);
86 void DidOpenInternalFile( 87 void DidOpenInternalFile(
87 ppapi::host::ReplyMessageContext reply_context, 88 ppapi::host::ReplyMessageContext reply_context,
88 base::PlatformFileError result, 89 base::File::Error result,
89 base::PlatformFile file, 90 base::PlatformFile file,
90 const base::Closure& on_close_callback); 91 const base::Closure& on_close_callback);
91 void GotResolvedRenderProcessId( 92 void GotResolvedRenderProcessId(
92 ppapi::host::ReplyMessageContext reply_context, 93 ppapi::host::ReplyMessageContext reply_context,
93 base::FilePath path, 94 base::FilePath path,
94 int platform_file_flags, 95 int platform_file_flags,
95 base::ProcessId resolved_render_process_id); 96 base::ProcessId resolved_render_process_id);
96 97
97 void DidOpenQuotaFile(ppapi::host::ReplyMessageContext reply_context, 98 void DidOpenQuotaFile(ppapi::host::ReplyMessageContext reply_context,
98 base::PlatformFile file, 99 base::PlatformFile file,
99 int64_t max_written_offset); 100 int64_t max_written_offset);
100 bool CallSetLength(ppapi::host::ReplyMessageContext reply_context, 101 bool CallSetLength(ppapi::host::ReplyMessageContext reply_context,
101 int64_t length); 102 int64_t length);
102 103
103 void DidCloseFile(base::PlatformFileError error); 104 void DidCloseFile(base::File::Error error);
104 105
105 void SendOpenErrorReply(ppapi::host::ReplyMessageContext reply_context); 106 void SendOpenErrorReply(ppapi::host::ReplyMessageContext reply_context);
106 107
107 // Adds file_ to |reply_context| with the specified |open_flags|. 108 // Adds file_ to |reply_context| with the specified |open_flags|.
108 bool AddFileToReplyContext( 109 bool AddFileToReplyContext(
109 int32_t open_flags, 110 int32_t open_flags,
110 ppapi::host::ReplyMessageContext* reply_context) const; 111 ppapi::host::ReplyMessageContext* reply_context) const;
111 112
112 BrowserPpapiHostImpl* browser_ppapi_host_; 113 BrowserPpapiHostImpl* browser_ppapi_host_;
113 114
(...skipping 22 matching lines...) Expand all
136 scoped_refptr<base::MessageLoopProxy> file_message_loop_; 137 scoped_refptr<base::MessageLoopProxy> file_message_loop_;
137 138
138 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; 139 base::WeakPtrFactory<PepperFileIOHost> weak_factory_;
139 140
140 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); 141 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost);
141 }; 142 };
142 143
143 } // namespace content 144 } // namespace content
144 145
145 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ 146 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698