| 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/extensions/extension_creator.h" | 10 #include "chrome/browser/extensions/extension_creator.h" |
| 11 | 11 |
| 12 PackExtensionJob::PackExtensionJob(Client* client, | 12 PackExtensionJob::PackExtensionJob(Client* client, |
| 13 const FilePath& root_directory, | 13 const FilePath& root_directory, |
| 14 const FilePath& key_file) | 14 const FilePath& key_file) |
| 15 : client_(client), root_directory_(root_directory), key_file_(key_file) { | 15 : client_(client), root_directory_(root_directory), key_file_(key_file) { |
| 16 CHECK(ChromeThread::GetCurrentThreadIdentifier(&client_thread_id_)); | 16 CHECK(ChromeThread::GetCurrentThreadIdentifier(&client_thread_id_)); |
| 17 } |
| 18 |
| 19 void PackExtensionJob::Start() { |
| 17 ChromeThread::PostTask( | 20 ChromeThread::PostTask( |
| 18 ChromeThread::FILE, FROM_HERE, | 21 ChromeThread::FILE, FROM_HERE, |
| 19 NewRunnableMethod(this, &PackExtensionJob::RunOnFileThread)); | 22 NewRunnableMethod(this, &PackExtensionJob::RunOnFileThread)); |
| 20 } | 23 } |
| 21 | 24 |
| 22 void PackExtensionJob::ClearClient() { | 25 void PackExtensionJob::ClearClient() { |
| 23 client_ = NULL; | 26 client_ = NULL; |
| 24 } | 27 } |
| 25 | 28 |
| 26 void PackExtensionJob::RunOnFileThread() { | 29 void PackExtensionJob::RunOnFileThread() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 47 | 50 |
| 48 void PackExtensionJob::ReportSuccessOnUIThread() { | 51 void PackExtensionJob::ReportSuccessOnUIThread() { |
| 49 if (client_) | 52 if (client_) |
| 50 client_->OnPackSuccess(crx_file_out_, key_file_out_); | 53 client_->OnPackSuccess(crx_file_out_, key_file_out_); |
| 51 } | 54 } |
| 52 | 55 |
| 53 void PackExtensionJob::ReportFailureOnUIThread(const std::string& error) { | 56 void PackExtensionJob::ReportFailureOnUIThread(const std::string& error) { |
| 54 if (client_) | 57 if (client_) |
| 55 client_->OnPackFailure(UTF8ToWide(error)); | 58 client_->OnPackFailure(UTF8ToWide(error)); |
| 56 } | 59 } |
| OLD | NEW |