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/extensions/startup_helper.h" | 5 #include "chrome/browser/extensions/startup_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/webstore_startup_installer.h" | 18 #include "chrome/browser/extensions/webstore_startup_installer.h" |
18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/extensions/chrome_extensions_client.h" | 21 #include "chrome/common/extensions/chrome_extensions_client.h" |
21 #include "components/crx_file/id_util.h" | 22 #include "components/crx_file/id_util.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 168 } |
168 | 169 |
169 void FinishOnUIThread() { | 170 void FinishOnUIThread() { |
170 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 171 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
171 if (run_loop_->running()) | 172 if (run_loop_->running()) |
172 run_loop_->Quit(); | 173 run_loop_->Quit(); |
173 } | 174 } |
174 | 175 |
175 void StartOnFileThread() { | 176 void StartOnFileThread() { |
176 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 177 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
177 scoped_refptr<base::MessageLoopProxy> file_thread_proxy = | 178 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = |
178 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); | 179 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); |
179 | 180 |
180 scoped_refptr<SandboxedUnpacker> unpacker( | 181 scoped_refptr<SandboxedUnpacker> unpacker( |
181 new SandboxedUnpacker(crx_file_, | 182 new SandboxedUnpacker(crx_file_, |
182 Manifest::INTERNAL, | 183 Manifest::INTERNAL, |
183 0, /* no special creation flags */ | 184 0, /* no special creation flags */ |
184 temp_dir_, | 185 temp_dir_, |
185 file_thread_proxy.get(), | 186 file_task_runner.get(), |
186 this)); | 187 this)); |
187 unpacker->Start(); | 188 unpacker->Start(); |
188 } | 189 } |
189 | 190 |
190 // The file being validated. | 191 // The file being validated. |
191 const CRXFileInfo& crx_file_; | 192 const CRXFileInfo& crx_file_; |
192 | 193 |
193 // The temporary directory where the sandboxed unpacker will do work. | 194 // The temporary directory where the sandboxed unpacker will do work. |
194 const base::FilePath& temp_dir_; | 195 const base::FilePath& temp_dir_; |
195 | 196 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 LOG(ERROR) << "InstallFromWebstore failed with error: " << helper.error(); | 328 LOG(ERROR) << "InstallFromWebstore failed with error: " << helper.error(); |
328 return helper.success(); | 329 return helper.success(); |
329 } | 330 } |
330 | 331 |
331 StartupHelper::~StartupHelper() { | 332 StartupHelper::~StartupHelper() { |
332 if (pack_job_.get()) | 333 if (pack_job_.get()) |
333 pack_job_->ClearClient(); | 334 pack_job_->ClearClient(); |
334 } | 335 } |
335 | 336 |
336 } // namespace extensions | 337 } // namespace extensions |
OLD | NEW |