OLD | NEW |
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 CHROME_BROWSER_NACL_HOST_NACL_HOST_MESSAGE_FILTER_H_ | 5 #ifndef CHROME_BROWSER_NACL_HOST_NACL_HOST_MESSAGE_FILTER_H_ |
6 #define CHROME_BROWSER_NACL_HOST_NACL_HOST_MESSAGE_FILTER_H_ | 6 #define CHROME_BROWSER_NACL_HOST_NACL_HOST_MESSAGE_FILTER_H_ |
7 | 7 |
| 8 #include "base/files/file_path.h" |
8 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
9 #include "content/public/browser/browser_message_filter.h" | 10 #include "content/public/browser/browser_message_filter.h" |
10 | 11 |
11 class ExtensionInfoMap; | 12 class ExtensionInfoMap; |
12 class GURL; | 13 class GURL; |
13 class Profile; | |
14 | 14 |
15 namespace nacl { | 15 namespace nacl { |
16 struct NaClLaunchParams; | 16 struct NaClLaunchParams; |
17 } | 17 } |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 class HostResolver; | 20 class HostResolver; |
21 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
22 } | 22 } |
23 | 23 |
24 // This class filters out incoming Chrome-specific IPC messages for the renderer | 24 // This class filters out incoming Chrome-specific IPC messages for the renderer |
25 // process on the IPC thread. | 25 // process on the IPC thread. |
26 class NaClHostMessageFilter : public content::BrowserMessageFilter { | 26 class NaClHostMessageFilter : public content::BrowserMessageFilter { |
27 public: | 27 public: |
28 NaClHostMessageFilter(int render_process_id, | 28 NaClHostMessageFilter(int render_process_id, |
29 Profile* profile, | 29 bool is_off_the_record, |
| 30 const base::FilePath& profile_directory, |
| 31 ExtensionInfoMap* extension_info_map, |
30 net::URLRequestContextGetter* request_context); | 32 net::URLRequestContextGetter* request_context); |
31 | 33 |
32 // content::BrowserMessageFilter methods: | 34 // content::BrowserMessageFilter methods: |
33 virtual bool OnMessageReceived(const IPC::Message& message, | 35 virtual bool OnMessageReceived(const IPC::Message& message, |
34 bool* message_was_ok) OVERRIDE; | 36 bool* message_was_ok) OVERRIDE; |
35 | 37 |
36 int render_process_id() { return render_process_id_; } | 38 int render_process_id() { return render_process_id_; } |
37 bool off_the_record() { return off_the_record_; } | 39 bool off_the_record() { return off_the_record_; } |
38 net::HostResolver* GetHostResolver(); | 40 net::HostResolver* GetHostResolver(); |
39 | 41 |
40 private: | 42 private: |
41 friend class content::BrowserThread; | 43 friend class content::BrowserThread; |
42 friend class base::DeleteHelper<NaClHostMessageFilter>; | 44 friend class base::DeleteHelper<NaClHostMessageFilter>; |
43 | 45 |
44 virtual ~NaClHostMessageFilter(); | 46 virtual ~NaClHostMessageFilter(); |
45 | 47 |
46 #if !defined(DISABLE_NACL) | 48 #if !defined(DISABLE_NACL) |
47 void OnLaunchNaCl(const nacl::NaClLaunchParams& launch_params, | 49 void OnLaunchNaCl(const nacl::NaClLaunchParams& launch_params, |
48 IPC::Message* reply_msg); | 50 IPC::Message* reply_msg); |
49 void OnGetReadonlyPnaclFd(const std::string& filename, | 51 void OnGetReadonlyPnaclFd(const std::string& filename, |
50 IPC::Message* reply_msg); | 52 IPC::Message* reply_msg); |
51 void OnNaClCreateTemporaryFile(IPC::Message* reply_msg); | 53 void OnNaClCreateTemporaryFile(IPC::Message* reply_msg); |
52 void OnNaClErrorStatus(int render_view_id, int error_id); | 54 void OnNaClErrorStatus(int render_view_id, int error_id); |
53 void OnOpenNaClExecutable(int render_view_id, | 55 void OnOpenNaClExecutable(int render_view_id, |
54 const GURL& file_url, | 56 const GURL& file_url, |
55 IPC::Message* reply_msg); | 57 IPC::Message* reply_msg); |
56 #endif | 58 #endif |
57 int render_process_id_; | 59 int render_process_id_; |
58 | 60 |
59 // The Profile associated with our renderer process. This should only be | 61 // off_the_record_ is copied from the profile partly so that it can be |
60 // accessed on the UI thread! | 62 // read on the IO thread. |
61 Profile* profile_; | |
62 // Copied from the profile so that it can be read on the IO thread. | |
63 bool off_the_record_; | 63 bool off_the_record_; |
| 64 base::FilePath profile_directory_; |
64 scoped_refptr<net::URLRequestContextGetter> request_context_; | 65 scoped_refptr<net::URLRequestContextGetter> request_context_; |
65 scoped_refptr<ExtensionInfoMap> extension_info_map_; | 66 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
66 | 67 |
67 base::WeakPtrFactory<NaClHostMessageFilter> weak_ptr_factory_; | 68 base::WeakPtrFactory<NaClHostMessageFilter> weak_ptr_factory_; |
68 | 69 |
69 DISALLOW_COPY_AND_ASSIGN(NaClHostMessageFilter); | 70 DISALLOW_COPY_AND_ASSIGN(NaClHostMessageFilter); |
70 }; | 71 }; |
71 | 72 |
72 #endif // CHROME_BROWSER_NACL_HOST_NACL_HOST_MESSAGE_FILTER_H_ | 73 #endif // CHROME_BROWSER_NACL_HOST_NACL_HOST_MESSAGE_FILTER_H_ |
OLD | NEW |