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/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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(PackExtensionJob::StandardSuccessMessage(crx_file, |
73 pem_file)))); | 73 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(const std::string& error, | 78 void PackExtensionHandler::OnPackFailure( |
79 ExtensionCreator::ErrorType type) { | 79 const std::string& error, |
80 if (type == ExtensionCreator::kCRXExists) { | 80 extensions::ExtensionCreator::ErrorType type) { |
| 81 if (type == extensions::ExtensionCreator::kCRXExists) { |
81 base::StringValue error_str(error); | 82 base::StringValue error_str(error); |
82 base::StringValue extension_path_str(extension_path_); | 83 base::StringValue extension_path_str(extension_path_); |
83 base::StringValue key_path_str(private_key_path_); | 84 base::StringValue key_path_str(private_key_path_); |
84 base::FundamentalValue overwrite_flag(ExtensionCreator::kOverwriteCRX); | 85 base::FundamentalValue overwrite_flag( |
| 86 extensions::ExtensionCreator::kOverwriteCRX); |
85 | 87 |
86 web_ui()->CallJavascriptFunction( | 88 web_ui()->CallJavascriptFunction( |
87 "ExtensionSettings.askToOverrideWarning", error_str, extension_path_str, | 89 "ExtensionSettings.askToOverrideWarning", error_str, extension_path_str, |
88 key_path_str, overwrite_flag); | 90 key_path_str, overwrite_flag); |
89 } else { | 91 } else { |
90 ShowAlert(error); | 92 ShowAlert(error); |
91 } | 93 } |
92 } | 94 } |
93 | 95 |
94 void PackExtensionHandler::FileSelected(const FilePath& path, int index, | 96 void PackExtensionHandler::FileSelected(const FilePath& path, int index, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 FILE_PATH_LITERAL(""), | 187 FILE_PATH_LITERAL(""), |
186 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), | 188 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), |
187 NULL); | 189 NULL); |
188 } | 190 } |
189 | 191 |
190 void PackExtensionHandler::ShowAlert(const std::string& message) { | 192 void PackExtensionHandler::ShowAlert(const std::string& message) { |
191 ListValue arguments; | 193 ListValue arguments; |
192 arguments.Append(Value::CreateStringValue(message)); | 194 arguments.Append(Value::CreateStringValue(message)); |
193 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments); | 195 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments); |
194 } | 196 } |
OLD | NEW |