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 "extensions/browser/sandboxed_unpacker.h" | 5 #include "extensions/browser/sandboxed_unpacker.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (!base::ReadFileToString(path, &file_str)) | 205 if (!base::ReadFileToString(path, &file_str)) |
206 return false; | 206 return false; |
207 | 207 |
208 IPC::Message pickle(file_str.data(), file_str.size()); | 208 IPC::Message pickle(file_str.data(), file_str.size()); |
209 PickleIterator iter(pickle); | 209 PickleIterator iter(pickle); |
210 return IPC::ReadParam(&pickle, &iter, catalogs); | 210 return IPC::ReadParam(&pickle, &iter, catalogs); |
211 } | 211 } |
212 | 212 |
213 } // namespace | 213 } // namespace |
214 | 214 |
| 215 SandboxedUnpackerClient::SandboxedUnpackerClient() |
| 216 : RefCountedDeleteOnMessageLoop<SandboxedUnpackerClient>( |
| 217 content::BrowserThread::GetMessageLoopProxyForThread( |
| 218 content::BrowserThread::UI)) { |
| 219 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 220 } |
| 221 |
215 SandboxedUnpacker::SandboxedUnpacker( | 222 SandboxedUnpacker::SandboxedUnpacker( |
216 const CRXFileInfo& file, | 223 const CRXFileInfo& file, |
217 Manifest::Location location, | 224 Manifest::Location location, |
218 int creation_flags, | 225 int creation_flags, |
219 const base::FilePath& extensions_dir, | 226 const base::FilePath& extensions_dir, |
220 const scoped_refptr<base::SequencedTaskRunner>& unpacker_io_task_runner, | 227 const scoped_refptr<base::SequencedTaskRunner>& unpacker_io_task_runner, |
221 SandboxedUnpackerClient* client) | 228 SandboxedUnpackerClient* client) |
222 : crx_path_(file.path), | 229 : crx_path_(file.path), |
223 package_hash_(base::StringToLowerASCII(file.expected_hash)), | 230 package_hash_(base::StringToLowerASCII(file.expected_hash)), |
224 check_crx_hash_(false), | 231 check_crx_hash_(false), |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 | 850 |
844 void SandboxedUnpacker::Cleanup() { | 851 void SandboxedUnpacker::Cleanup() { |
845 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); | 852 DCHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); |
846 if (!temp_dir_.Delete()) { | 853 if (!temp_dir_.Delete()) { |
847 LOG(WARNING) << "Can not delete temp directory at " | 854 LOG(WARNING) << "Can not delete temp directory at " |
848 << temp_dir_.path().value(); | 855 << temp_dir_.path().value(); |
849 } | 856 } |
850 } | 857 } |
851 | 858 |
852 } // namespace extensions | 859 } // namespace extensions |
OLD | NEW |