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/pack_extension_job.h" | 5 #include "chrome/browser/extensions/pack_extension_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/extensions/extension_creator.h" | 11 #include "chrome/browser/extensions/extension_creator.h" |
12 #include "chrome/common/chrome_constants.h" | 12 #include "extensions/common/constants.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 PackExtensionJob::PackExtensionJob(Client* client, | 20 PackExtensionJob::PackExtensionJob(Client* client, |
21 const base::FilePath& root_directory, | 21 const base::FilePath& root_directory, |
22 const base::FilePath& key_file, | 22 const base::FilePath& key_file, |
(...skipping 15 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 void PackExtensionJob::ClearClient() { | 40 void PackExtensionJob::ClearClient() { |
41 client_ = NULL; | 41 client_ = NULL; |
42 } | 42 } |
43 | 43 |
44 PackExtensionJob::~PackExtensionJob() {} | 44 PackExtensionJob::~PackExtensionJob() {} |
45 | 45 |
46 void PackExtensionJob::Run() { | 46 void PackExtensionJob::Run() { |
47 crx_file_out_ = base::FilePath(root_directory_.value() + | 47 crx_file_out_ = base::FilePath(root_directory_.value() + |
48 chrome::kExtensionFileExtension); | 48 kExtensionFileExtension); |
49 | 49 |
50 if (key_file_.empty()) | 50 if (key_file_.empty()) |
51 key_file_out_ = base::FilePath(root_directory_.value() + | 51 key_file_out_ = base::FilePath(root_directory_.value() + |
52 chrome::kExtensionKeyFileExtension); | 52 kExtensionKeyFileExtension); |
53 | 53 |
54 // TODO(aa): Need to internationalize the errors that ExtensionCreator | 54 // TODO(aa): Need to internationalize the errors that ExtensionCreator |
55 // returns. See bug 20734. | 55 // returns. See bug 20734. |
56 ExtensionCreator creator; | 56 ExtensionCreator creator; |
57 if (creator.Run(root_directory_, crx_file_out_, key_file_, key_file_out_, | 57 if (creator.Run(root_directory_, crx_file_out_, key_file_, key_file_out_, |
58 run_flags_)) { | 58 run_flags_)) { |
59 if (asynchronous_) { | 59 if (asynchronous_) { |
60 BrowserThread::PostTask( | 60 BrowserThread::PostTask( |
61 client_thread_id_, FROM_HERE, | 61 client_thread_id_, FROM_HERE, |
62 base::Bind(&PackExtensionJob::ReportSuccessOnClientThread, this)); | 62 base::Bind(&PackExtensionJob::ReportSuccessOnClientThread, this)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 crx_file_string); | 101 crx_file_string); |
102 } else { | 102 } else { |
103 return l10n_util::GetStringFUTF16( | 103 return l10n_util::GetStringFUTF16( |
104 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW, | 104 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW, |
105 crx_file_string, | 105 crx_file_string, |
106 key_file_string); | 106 key_file_string); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 } // namespace extensions | 110 } // namespace extensions |
OLD | NEW |