1 // Copyright (c) 2012 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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_FILE_MESSAGE_FILTER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_FILE_MESSAGE_FILTER_H_
8 #include "base/callback_forward.h"
9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/process/process.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/host/resource_host.h"
15 #include "ppapi/host/resource_message_filter.h"
18 class BrowserPpapiHost;
27 struct HostMessageContext;
33 class BrowserPpapiHost;
35 // All file messages are handled by BrowserThread's blocking pool.
36 class PepperFlashFileMessageFilter : public ppapi::host::ResourceMessageFilter {
38 PepperFlashFileMessageFilter(PP_Instance instance, BrowserPpapiHost* host);
40 static base::FilePath GetDataDirName(const base::FilePath& profile_path);
43 typedef base::Callback<bool(int, const base::FilePath&)>
44 CheckPermissionsCallback;
46 virtual ~PepperFlashFileMessageFilter();
48 // ppapi::host::ResourceMessageFilter overrides.
49 virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
50 const IPC::Message& msg) OVERRIDE;
51 virtual int32_t OnResourceMessageReceived(
52 const IPC::Message& msg,
53 ppapi::host::HostMessageContext* context) OVERRIDE;
55 int32_t OnOpenFile(ppapi::host::HostMessageContext* context,
56 const ppapi::PepperFilePath& path,
58 int32_t OnRenameFile(ppapi::host::HostMessageContext* context,
59 const ppapi::PepperFilePath& from_path,
60 const ppapi::PepperFilePath& to_path);
61 int32_t OnDeleteFileOrDir(ppapi::host::HostMessageContext* context,
62 const ppapi::PepperFilePath& path,
64 int32_t OnCreateDir(ppapi::host::HostMessageContext* context,
65 const ppapi::PepperFilePath& path);
66 int32_t OnQueryFile(ppapi::host::HostMessageContext* context,
67 const ppapi::PepperFilePath& path);
68 int32_t OnGetDirContents(ppapi::host::HostMessageContext* context,
69 const ppapi::PepperFilePath& path);
70 int32_t OnCreateTemporaryFile(ppapi::host::HostMessageContext* context);
72 base::FilePath ValidateAndConvertPepperFilePath(
73 const ppapi::PepperFilePath& pepper_path,
74 const CheckPermissionsCallback& check_permissions_callback) const;
76 base::FilePath plugin_data_directory_;
77 int render_process_id_;
78 base::ProcessHandle plugin_process_handle_;
80 DISALLOW_COPY_AND_ASSIGN(PepperFlashFileMessageFilter);
83 } // namespace content
85 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_FLASH_FILE_MESSAGE_FILTER_H_