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

Side by Side Diff: chrome/browser/nacl_host/nacl_host_message_filter.cc

Issue 17826006: Remove dependency of NaClHostMessageFilter code on Profiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 5 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
« no previous file with comments | « chrome/browser/nacl_host/nacl_host_message_filter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/nacl_host/nacl_host_message_filter.h" 5 #include "chrome/browser/nacl_host/nacl_host_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "chrome/browser/extensions/extension_info_map.h" 11 #include "chrome/browser/extensions/extension_info_map.h"
12 #include "chrome/browser/extensions/extension_system.h" 12 #include "chrome/browser/extensions/extension_system.h"
13 #include "chrome/browser/nacl_host/nacl_file_host.h" 13 #include "chrome/browser/nacl_host/nacl_file_host.h"
14 #include "chrome/browser/nacl_host/nacl_infobar.h" 14 #include "chrome/browser/nacl_host/nacl_infobar.h"
15 #include "chrome/browser/nacl_host/nacl_process_host.h" 15 #include "chrome/browser/nacl_host/nacl_process_host.h"
16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/nacl_host_messages.h" 17 #include "chrome/common/nacl_host_messages.h"
19 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
20 #include "net/url_request/url_request_context.h" 19 #include "net/url_request/url_request_context.h"
21 #include "net/url_request/url_request_context_getter.h" 20 #include "net/url_request/url_request_context_getter.h"
22 21
23 NaClHostMessageFilter::NaClHostMessageFilter( 22 NaClHostMessageFilter::NaClHostMessageFilter(
24 int render_process_id, 23 int render_process_id,
25 Profile* profile, 24 bool is_off_the_record,
25 const base::FilePath& profile_directory,
26 ExtensionInfoMap* extension_info_map,
26 net::URLRequestContextGetter* request_context) 27 net::URLRequestContextGetter* request_context)
27 : render_process_id_(render_process_id), 28 : render_process_id_(render_process_id),
28 profile_(profile), 29 off_the_record_(is_off_the_record),
29 off_the_record_(profile_->IsOffTheRecord()), 30 profile_directory_(profile_directory),
30 request_context_(request_context), 31 request_context_(request_context),
31 extension_info_map_( 32 extension_info_map_(extension_info_map),
32 extensions::ExtensionSystem::Get(profile)->info_map()),
33 weak_ptr_factory_(this) { 33 weak_ptr_factory_(this) {
34 } 34 }
35 35
36 NaClHostMessageFilter::~NaClHostMessageFilter() { 36 NaClHostMessageFilter::~NaClHostMessageFilter() {
37 } 37 }
38 38
39 bool NaClHostMessageFilter::OnMessageReceived(const IPC::Message& message, 39 bool NaClHostMessageFilter::OnMessageReceived(const IPC::Message& message,
40 bool* message_was_ok) { 40 bool* message_was_ok) {
41 bool handled = true; 41 bool handled = true;
42 IPC_BEGIN_MESSAGE_MAP_EX(NaClHostMessageFilter, message, *message_was_ok) 42 IPC_BEGIN_MESSAGE_MAP_EX(NaClHostMessageFilter, message, *message_was_ok)
(...skipping 22 matching lines...) Expand all
65 const nacl::NaClLaunchParams& launch_params, 65 const nacl::NaClLaunchParams& launch_params,
66 IPC::Message* reply_msg) { 66 IPC::Message* reply_msg) {
67 NaClProcessHost* host = new NaClProcessHost( 67 NaClProcessHost* host = new NaClProcessHost(
68 GURL(launch_params.manifest_url), 68 GURL(launch_params.manifest_url),
69 launch_params.render_view_id, 69 launch_params.render_view_id,
70 launch_params.permission_bits, 70 launch_params.permission_bits,
71 launch_params.uses_irt, 71 launch_params.uses_irt,
72 launch_params.enable_dyncode_syscalls, 72 launch_params.enable_dyncode_syscalls,
73 launch_params.enable_exception_handling, 73 launch_params.enable_exception_handling,
74 off_the_record_, 74 off_the_record_,
75 profile_->GetPath()); 75 profile_directory_);
76 host->Launch(this, reply_msg, extension_info_map_); 76 host->Launch(this, reply_msg, extension_info_map_);
77 } 77 }
78 78
79 void NaClHostMessageFilter::OnGetReadonlyPnaclFd( 79 void NaClHostMessageFilter::OnGetReadonlyPnaclFd(
80 const std::string& filename, IPC::Message* reply_msg) { 80 const std::string& filename, IPC::Message* reply_msg) {
81 // This posts a task to another thread, but the renderer will 81 // This posts a task to another thread, but the renderer will
82 // block until the reply is sent. 82 // block until the reply is sent.
83 nacl_file_host::GetReadonlyPnaclFd(this, filename, reply_msg); 83 nacl_file_host::GetReadonlyPnaclFd(this, filename, reply_msg);
84 } 84 }
85 85
86 void NaClHostMessageFilter::OnNaClCreateTemporaryFile( 86 void NaClHostMessageFilter::OnNaClCreateTemporaryFile(
87 IPC::Message* reply_msg) { 87 IPC::Message* reply_msg) {
88 nacl_file_host::CreateTemporaryFile(this, reply_msg); 88 nacl_file_host::CreateTemporaryFile(this, reply_msg);
89 } 89 }
90 90
91 void NaClHostMessageFilter::OnNaClErrorStatus(int render_view_id, 91 void NaClHostMessageFilter::OnNaClErrorStatus(int render_view_id,
92 int error_id) { 92 int error_id) {
93 // Currently there is only one kind of error status, for which 93 // Currently there is only one kind of error status, for which
94 // we want to show the user an infobar. 94 // we want to show the user an infobar.
95 ShowNaClInfobar(render_process_id_, render_view_id, error_id); 95 ShowNaClInfobar(render_process_id_, render_view_id, error_id);
96 } 96 }
97 97
98 void NaClHostMessageFilter::OnOpenNaClExecutable(int render_view_id, 98 void NaClHostMessageFilter::OnOpenNaClExecutable(int render_view_id,
99 const GURL& file_url, 99 const GURL& file_url,
100 IPC::Message* reply_msg) { 100 IPC::Message* reply_msg) {
101 nacl_file_host::OpenNaClExecutable(this, extension_info_map_, 101 nacl_file_host::OpenNaClExecutable(this, extension_info_map_,
102 render_view_id, file_url, reply_msg); 102 render_view_id, file_url, reply_msg);
103 } 103 }
104 #endif 104 #endif
OLDNEW
« no previous file with comments | « chrome/browser/nacl_host/nacl_host_message_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698