OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/pnacl_file_host.h" | 5 #include "chrome/browser/nacl_host/nacl_file_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" | 14 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 void DoOpenPnaclFile( | 52 void DoOpenPnaclFile( |
53 ChromeRenderMessageFilter* chrome_render_message_filter, | 53 ChromeRenderMessageFilter* chrome_render_message_filter, |
54 const std::string& filename, | 54 const std::string& filename, |
55 IPC::Message* reply_msg) { | 55 IPC::Message* reply_msg) { |
56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
57 base::FilePath full_filepath; | 57 base::FilePath full_filepath; |
58 | 58 |
59 // Do some validation. | 59 // Do some validation. |
60 if (!pnacl_file_host::PnaclCanOpenFile(filename, &full_filepath)) { | 60 if (!nacl_file_host::PnaclCanOpenFile(filename, &full_filepath)) { |
61 NotifyRendererOfError(chrome_render_message_filter, reply_msg); | 61 NotifyRendererOfError(chrome_render_message_filter, reply_msg); |
62 return; | 62 return; |
63 } | 63 } |
64 | 64 |
65 base::PlatformFile file_to_open; | 65 base::PlatformFile file_to_open; |
66 if (!PnaclDoOpenFile(full_filepath, &file_to_open)) { | 66 if (!PnaclDoOpenFile(full_filepath, &file_to_open)) { |
67 NotifyRendererOfError(chrome_render_message_filter, reply_msg); | 67 NotifyRendererOfError(chrome_render_message_filter, reply_msg); |
68 return; | 68 return; |
69 } | 69 } |
70 | 70 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return; | 118 return; |
119 } | 119 } |
120 | 120 |
121 ChromeViewHostMsg_NaClCreateTemporaryFile::WriteReplyParams( | 121 ChromeViewHostMsg_NaClCreateTemporaryFile::WriteReplyParams( |
122 reply_msg, target_desc); | 122 reply_msg, target_desc); |
123 chrome_render_message_filter->Send(reply_msg); | 123 chrome_render_message_filter->Send(reply_msg); |
124 } | 124 } |
125 | 125 |
126 } // namespace | 126 } // namespace |
127 | 127 |
128 namespace pnacl_file_host { | 128 namespace nacl_file_host { |
129 | 129 |
130 void GetReadonlyPnaclFd( | 130 void GetReadonlyPnaclFd( |
131 ChromeRenderMessageFilter* chrome_render_message_filter, | 131 ChromeRenderMessageFilter* chrome_render_message_filter, |
132 const std::string& filename, | 132 const std::string& filename, |
133 IPC::Message* reply_msg) { | 133 IPC::Message* reply_msg) { |
134 if (!BrowserThread::PostTask( | 134 if (!BrowserThread::PostTask( |
135 BrowserThread::FILE, FROM_HERE, | 135 BrowserThread::FILE, FROM_HERE, |
136 base::Bind(&DoOpenPnaclFile, | 136 base::Bind(&DoOpenPnaclFile, |
137 make_scoped_refptr(chrome_render_message_filter), | 137 make_scoped_refptr(chrome_render_message_filter), |
138 filename, | 138 filename, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 IPC::Message* reply_msg) { | 179 IPC::Message* reply_msg) { |
180 if (!BrowserThread::PostTask( | 180 if (!BrowserThread::PostTask( |
181 BrowserThread::FILE, FROM_HERE, | 181 BrowserThread::FILE, FROM_HERE, |
182 base::Bind(&DoCreateTemporaryFile, | 182 base::Bind(&DoCreateTemporaryFile, |
183 make_scoped_refptr(chrome_render_message_filter), | 183 make_scoped_refptr(chrome_render_message_filter), |
184 reply_msg))) { | 184 reply_msg))) { |
185 NotifyRendererOfError(chrome_render_message_filter, reply_msg); | 185 NotifyRendererOfError(chrome_render_message_filter, reply_msg); |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 } // namespace pnacl_file_host | 189 } // namespace nacl_file_host |
OLD | NEW |