OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/pack_extension_job.h" | 5 #include "chrome/browser/extensions/pack_extension_job.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "chrome/browser/chrome_thread.h" |
10 #include "chrome/browser/extensions/extension_creator.h" | 11 #include "chrome/browser/extensions/extension_creator.h" |
11 | 12 |
12 PackExtensionJob::PackExtensionJob(Client* client, | 13 PackExtensionJob::PackExtensionJob(Client* client, |
13 const FilePath& root_directory, | 14 const FilePath& root_directory, |
14 const FilePath& key_file, | 15 const FilePath& key_file) |
15 MessageLoop* file_loop) | 16 : ui_loop_(MessageLoop::current()), client_(client), |
16 : ui_loop_(MessageLoop::current()), file_loop_(file_loop), client_(client), | |
17 root_directory_(root_directory), key_file_(key_file) { | 17 root_directory_(root_directory), key_file_(key_file) { |
18 file_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 18 ChromeThread::PostTask( |
19 &PackExtensionJob::RunOnFileThread)); | 19 ChromeThread::FILE, FROM_HERE, |
| 20 NewRunnableMethod(this, &PackExtensionJob::RunOnFileThread)); |
20 } | 21 } |
21 | 22 |
22 void PackExtensionJob::ClearClient() { | 23 void PackExtensionJob::ClearClient() { |
23 client_ = NULL; | 24 client_ = NULL; |
24 } | 25 } |
25 | 26 |
26 void PackExtensionJob::RunOnFileThread() { | 27 void PackExtensionJob::RunOnFileThread() { |
27 crx_file_out_ = root_directory_.ReplaceExtension(FILE_PATH_LITERAL("crx")); | 28 crx_file_out_ = root_directory_.ReplaceExtension(FILE_PATH_LITERAL("crx")); |
28 | 29 |
29 if (key_file_.empty()) | 30 if (key_file_.empty()) |
(...skipping 13 matching lines...) Expand all Loading... |
43 | 44 |
44 void PackExtensionJob::ReportSuccessOnUIThread() { | 45 void PackExtensionJob::ReportSuccessOnUIThread() { |
45 if (client_) | 46 if (client_) |
46 client_->OnPackSuccess(crx_file_out_, key_file_out_); | 47 client_->OnPackSuccess(crx_file_out_, key_file_out_); |
47 } | 48 } |
48 | 49 |
49 void PackExtensionJob::ReportFailureOnUIThread(const std::string& error) { | 50 void PackExtensionJob::ReportFailureOnUIThread(const std::string& error) { |
50 if (client_) | 51 if (client_) |
51 client_->OnPackFailure(UTF8ToWide(error)); | 52 client_->OnPackFailure(UTF8ToWide(error)); |
52 } | 53 } |
OLD | NEW |