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.
5 #ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_CRX_FILE_SYSTEM_MESSAGE_FILTER_H_
6 #define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_CRX_FILE_SYSTEM_MESSAGE_FILTER_H_
11 #include "base/files/file_path.h"
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/host/resource_host.h"
15 #include "ppapi/host/resource_message_filter.h"
21 class BrowserPpapiHost;
26 struct HostMessageContext;
32 class PepperCrxFileSystemMessageFilter
33 : public ppapi::host::ResourceMessageFilter {
35 static PepperCrxFileSystemMessageFilter* Create(
37 content::BrowserPpapiHost* host);
39 // ppapi::host::ResourceMessageFilter implementation.
40 virtual scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage(
41 const IPC::Message& msg) OVERRIDE;
42 virtual int32_t OnResourceMessageReceived(
43 const IPC::Message& msg,
44 ppapi::host::HostMessageContext* context) OVERRIDE;
47 PepperCrxFileSystemMessageFilter(
48 int render_process_id,
49 const base::FilePath& profile_directory,
50 const GURL& document_url);
52 virtual ~PepperCrxFileSystemMessageFilter();
54 Profile* GetProfile();
56 // Returns filesystem id of isolated filesystem if valid, or empty string
57 // otherwise. This must run on the UI thread because ProfileManager only
58 // allows access on that thread.
59 std::string CreateIsolatedFileSystem(Profile* profile);
61 int32_t OnOpenFileSystem(ppapi::host::HostMessageContext* context);
63 const int render_process_id_;
64 const base::FilePath& profile_directory_;
65 const GURL document_url_;
67 // Set of origins that can use CrxFs private APIs from NaCl.
68 std::set<std::string> allowed_crxfs_origins_;
70 DISALLOW_COPY_AND_ASSIGN(PepperCrxFileSystemMessageFilter);
75 #endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_CRX_FILE_SYSTEM_MESSAGE_FILTER_H_