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