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

Side by Side Diff: chrome/browser/ui/webui/extensions/pack_extension_handler.cc

Issue 10824204: Move small c/b/extensions classes into extensions namespace no.2 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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) 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/ui/webui/extensions/pack_extension_handler.h" 5 #include "chrome/browser/ui/webui/extensions/pack_extension_handler.h"
6 6
7 #include "chrome/browser/extensions/extension_creator.h" 7 #include "chrome/browser/extensions/extension_creator.h"
8 #include "chrome/browser/ui/chrome_select_file_policy.h" 8 #include "chrome/browser/ui/chrome_select_file_policy.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 web_ui()->RegisterMessageCallback( 62 web_ui()->RegisterMessageCallback(
63 "packExtensionSelectFilePath", 63 "packExtensionSelectFilePath",
64 base::Bind(&PackExtensionHandler::HandleSelectFilePathMessage, 64 base::Bind(&PackExtensionHandler::HandleSelectFilePathMessage,
65 base::Unretained(this))); 65 base::Unretained(this)));
66 } 66 }
67 67
68 void PackExtensionHandler::OnPackSuccess(const FilePath& crx_file, 68 void PackExtensionHandler::OnPackSuccess(const FilePath& crx_file,
69 const FilePath& pem_file) { 69 const FilePath& pem_file) {
70 ListValue arguments; 70 ListValue arguments;
71 arguments.Append(Value::CreateStringValue( 71 arguments.Append(Value::CreateStringValue(
72 UTF16ToUTF8(PackExtensionJob::StandardSuccessMessage(crx_file, 72 UTF16ToUTF8(extensions::PackExtensionJob::StandardSuccessMessage(
73 pem_file)))); 73 crx_file, pem_file))));
74 web_ui()->CallJavascriptFunction( 74 web_ui()->CallJavascriptFunction(
75 "PackExtensionOverlay.showSuccessMessage", arguments); 75 "PackExtensionOverlay.showSuccessMessage", arguments);
76 } 76 }
77 77
78 void PackExtensionHandler::OnPackFailure( 78 void PackExtensionHandler::OnPackFailure(
79 const std::string& error, 79 const std::string& error,
80 extensions::ExtensionCreator::ErrorType type) { 80 extensions::ExtensionCreator::ErrorType type) {
81 if (type == extensions::ExtensionCreator::kCRXExists) { 81 if (type == extensions::ExtensionCreator::kCRXExists) {
82 base::StringValue error_str(error); 82 base::StringValue error_str(error);
83 base::StringValue extension_path_str(extension_path_); 83 base::StringValue extension_path_str(extension_path_);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 return; 135 return;
136 } 136 }
137 137
138 if (!private_key_path_.empty() && key_file.empty()) { 138 if (!private_key_path_.empty() && key_file.empty()) {
139 ShowAlert(l10n_util::GetStringUTF8( 139 ShowAlert(l10n_util::GetStringUTF8(
140 IDS_EXTENSION_PACK_DIALOG_ERROR_KEY_INVALID)); 140 IDS_EXTENSION_PACK_DIALOG_ERROR_KEY_INVALID));
141 return; 141 return;
142 } 142 }
143 143
144 pack_job_ = new PackExtensionJob(this, root_directory, key_file, run_flags); 144 pack_job_ = new extensions::PackExtensionJob(
145 this, root_directory, key_file, run_flags);
145 pack_job_->Start(); 146 pack_job_->Start();
146 } 147 }
147 148
148 void PackExtensionHandler::HandleSelectFilePathMessage( 149 void PackExtensionHandler::HandleSelectFilePathMessage(
149 const ListValue* args) { 150 const ListValue* args) {
150 DCHECK_EQ(2U, args->GetSize()); 151 DCHECK_EQ(2U, args->GetSize());
151 152
152 std::string select_type; 153 std::string select_type;
153 if (!args->GetString(0, &select_type)) 154 if (!args->GetString(0, &select_type))
154 NOTREACHED(); 155 NOTREACHED();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 FILE_PATH_LITERAL(""), 188 FILE_PATH_LITERAL(""),
188 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), 189 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(),
189 NULL); 190 NULL);
190 } 191 }
191 192
192 void PackExtensionHandler::ShowAlert(const std::string& message) { 193 void PackExtensionHandler::ShowAlert(const std::string& message) {
193 ListValue arguments; 194 ListValue arguments;
194 arguments.Append(Value::CreateStringValue(message)); 195 arguments.Append(Value::CreateStringValue(message));
195 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments); 196 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments);
196 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698