OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/zipfile_installer.h" | 5 #include "chrome/browser/extensions/zipfile_installer.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/thread_task_runner_handle.h" |
9 #include "chrome/browser/extensions/extension_error_reporter.h" | 10 #include "chrome/browser/extensions/extension_error_reporter.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/unpacked_installer.h" | 12 #include "chrome/browser/extensions/unpacked_installer.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 14 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/utility_process_host.h" | 17 #include "content/public/browser/utility_process_host.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 | 19 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 scoped_refptr<ZipFileInstaller> ZipFileInstaller::Create( | 68 scoped_refptr<ZipFileInstaller> ZipFileInstaller::Create( |
68 ExtensionService* extension_service) { | 69 ExtensionService* extension_service) { |
69 DCHECK(extension_service); | 70 DCHECK(extension_service); |
70 return scoped_refptr<ZipFileInstaller>( | 71 return scoped_refptr<ZipFileInstaller>( |
71 new ZipFileInstaller(extension_service)); | 72 new ZipFileInstaller(extension_service)); |
72 } | 73 } |
73 | 74 |
74 void ZipFileInstaller::StartWorkOnIOThread(const base::FilePath& temp_dir) { | 75 void ZipFileInstaller::StartWorkOnIOThread(const base::FilePath& temp_dir) { |
75 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 76 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
76 UtilityProcessHost* host = | 77 UtilityProcessHost* host = |
77 UtilityProcessHost::Create(this, base::MessageLoopProxy::current().get()); | 78 UtilityProcessHost::Create(this, |
| 79 base::ThreadTaskRunnerHandle::Get().get()); |
78 host->SetName(l10n_util::GetStringUTF16( | 80 host->SetName(l10n_util::GetStringUTF16( |
79 IDS_UTILITY_PROCESS_ZIP_FILE_INSTALLER_NAME)); | 81 IDS_UTILITY_PROCESS_ZIP_FILE_INSTALLER_NAME)); |
80 host->SetExposedDir(temp_dir); | 82 host->SetExposedDir(temp_dir); |
81 host->Send(new ChromeUtilityMsg_UnzipToDir(zip_path_, temp_dir)); | 83 host->Send(new ChromeUtilityMsg_UnzipToDir(zip_path_, temp_dir)); |
82 } | 84 } |
83 | 85 |
84 void ZipFileInstaller::ReportSuccessOnUIThread( | 86 void ZipFileInstaller::ReportSuccessOnUIThread( |
85 const base::FilePath& unzipped_path) { | 87 const base::FilePath& unzipped_path) { |
86 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 88 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
87 if (extension_service_weak_.get()) | 89 if (extension_service_weak_.get()) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 IPC_BEGIN_MESSAGE_MAP(ZipFileInstaller, message) | 124 IPC_BEGIN_MESSAGE_MAP(ZipFileInstaller, message) |
123 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnzipToDir_Succeeded, | 125 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnzipToDir_Succeeded, |
124 OnUnzipSucceeded) | 126 OnUnzipSucceeded) |
125 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnzipToDir_Failed, OnUnzipFailed) | 127 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnzipToDir_Failed, OnUnzipFailed) |
126 IPC_MESSAGE_UNHANDLED(handled = false) | 128 IPC_MESSAGE_UNHANDLED(handled = false) |
127 IPC_END_MESSAGE_MAP() | 129 IPC_END_MESSAGE_MAP() |
128 return handled; | 130 return handled; |
129 } | 131 } |
130 | 132 |
131 } // namespace extensions | 133 } // namespace extensions |
OLD | NEW |