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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/sys_string_conversions.h" | |
10 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
11 #include "base/task.h" | 10 #include "base/task.h" |
12 #include "chrome/browser/extensions/extension_creator.h" | 11 #include "chrome/browser/extensions/extension_creator.h" |
13 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
14 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
15 | 14 |
16 PackExtensionJob::PackExtensionJob(Client* client, | 15 PackExtensionJob::PackExtensionJob(Client* client, |
17 const FilePath& root_directory, | 16 const FilePath& root_directory, |
18 const FilePath& key_file) | 17 const FilePath& key_file) |
19 : client_(client), key_file_(key_file), asynchronous_(true) { | 18 : client_(client), key_file_(key_file), asynchronous_(true) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (client_) | 73 if (client_) |
75 client_->OnPackSuccess(crx_file_out_, key_file_out_); | 74 client_->OnPackSuccess(crx_file_out_, key_file_out_); |
76 } | 75 } |
77 | 76 |
78 void PackExtensionJob::ReportFailureOnClientThread(const std::string& error) { | 77 void PackExtensionJob::ReportFailureOnClientThread(const std::string& error) { |
79 if (client_) | 78 if (client_) |
80 client_->OnPackFailure(error); | 79 client_->OnPackFailure(error); |
81 } | 80 } |
82 | 81 |
83 // static | 82 // static |
84 string16 PackExtensionJob::StandardSuccessMessage(const FilePath& crx_file, | 83 std::wstring PackExtensionJob::StandardSuccessMessage(const FilePath& crx_file, |
85 const FilePath& key_file) { | 84 const FilePath& key_file) |
86 string16 crx_file_string = WideToUTF16(crx_file.ToWStringHack()); | 85 { |
87 string16 key_file_string = WideToUTF16(key_file.ToWStringHack()); | 86 // TODO(isherman): we should use string16 instead of wstring. |
88 if (key_file_string.empty()) { | 87 // See crbug.com/23581 and crbug.com/24672 |
89 return l10n_util::GetStringFUTF16( | 88 std::wstring message; |
| 89 if (key_file.empty()) { |
| 90 return l10n_util::GetStringF( |
90 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_UPDATE, | 91 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_UPDATE, |
91 crx_file_string); | 92 crx_file.ToWStringHack()); |
92 } else { | 93 } else { |
93 return l10n_util::GetStringFUTF16( | 94 return l10n_util::GetStringF( |
94 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW, | 95 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW, |
95 crx_file_string, | 96 crx_file.ToWStringHack(), |
96 key_file_string); | 97 key_file.ToWStringHack()); |
97 } | 98 } |
98 } | 99 } |
OLD | NEW |