Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Side by Side Diff: chrome/browser/extensions/pack_extension_job.cc

Issue 10665053: Move ExtensionCreator into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 8 #include "base/message_loop.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void PackExtensionJob::Run() { 44 void PackExtensionJob::Run() {
45 crx_file_out_ = FilePath(root_directory_.value() + 45 crx_file_out_ = FilePath(root_directory_.value() +
46 chrome::kExtensionFileExtension); 46 chrome::kExtensionFileExtension);
47 47
48 if (key_file_.empty()) 48 if (key_file_.empty())
49 key_file_out_ = FilePath(root_directory_.value() + 49 key_file_out_ = FilePath(root_directory_.value() +
50 chrome::kExtensionKeyFileExtension); 50 chrome::kExtensionKeyFileExtension);
51 51
52 // TODO(aa): Need to internationalize the errors that ExtensionCreator 52 // TODO(aa): Need to internationalize the errors that ExtensionCreator
53 // returns. See bug 20734. 53 // returns. See bug 20734.
54 ExtensionCreator creator; 54 extensions::ExtensionCreator creator;
55 if (creator.Run(root_directory_, crx_file_out_, key_file_, key_file_out_, 55 if (creator.Run(root_directory_, crx_file_out_, key_file_, key_file_out_,
56 run_flags_)) { 56 run_flags_)) {
57 if (asynchronous_) { 57 if (asynchronous_) {
58 BrowserThread::PostTask( 58 BrowserThread::PostTask(
59 client_thread_id_, FROM_HERE, 59 client_thread_id_, FROM_HERE,
60 base::Bind(&PackExtensionJob::ReportSuccessOnClientThread, this)); 60 base::Bind(&PackExtensionJob::ReportSuccessOnClientThread, this));
61 } else { 61 } else {
62 ReportSuccessOnClientThread(); 62 ReportSuccessOnClientThread();
63 } 63 }
64 } else { 64 } else {
(...skipping 10 matching lines...) Expand all
75 } 75 }
76 } 76 }
77 77
78 void PackExtensionJob::ReportSuccessOnClientThread() { 78 void PackExtensionJob::ReportSuccessOnClientThread() {
79 if (client_) 79 if (client_)
80 client_->OnPackSuccess(crx_file_out_, key_file_out_); 80 client_->OnPackSuccess(crx_file_out_, key_file_out_);
81 } 81 }
82 82
83 void PackExtensionJob::ReportFailureOnClientThread( 83 void PackExtensionJob::ReportFailureOnClientThread(
84 const std::string& error, 84 const std::string& error,
85 ExtensionCreator::ErrorType error_type) { 85 extensions::ExtensionCreator::ErrorType error_type) {
86 if (client_) 86 if (client_)
87 client_->OnPackFailure(error, error_type); 87 client_->OnPackFailure(error, error_type);
88 } 88 }
89 89
90 // static 90 // static
91 string16 PackExtensionJob::StandardSuccessMessage(const FilePath& crx_file, 91 string16 PackExtensionJob::StandardSuccessMessage(const FilePath& crx_file,
92 const FilePath& key_file) { 92 const FilePath& key_file) {
93 string16 crx_file_string = crx_file.LossyDisplayName(); 93 string16 crx_file_string = crx_file.LossyDisplayName();
94 string16 key_file_string = key_file.LossyDisplayName(); 94 string16 key_file_string = key_file.LossyDisplayName();
95 if (key_file_string.empty()) { 95 if (key_file_string.empty()) {
96 return l10n_util::GetStringFUTF16( 96 return l10n_util::GetStringFUTF16(
97 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_UPDATE, 97 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_UPDATE,
98 crx_file_string); 98 crx_file_string);
99 } else { 99 } else {
100 return l10n_util::GetStringFUTF16( 100 return l10n_util::GetStringFUTF16(
101 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW, 101 IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW,
102 crx_file_string, 102 crx_file_string,
103 key_file_string); 103 key_file_string);
104 } 104 }
105 } 105 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/pack_extension_job.h ('k') | chrome/browser/ui/webui/extensions/pack_extension_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698