| 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" | |
| 9 #include "base/bind.h" | 8 #include "base/bind.h" |
| 10 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 11 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/browser/web_contents_view.h" | 11 #include "content/public/browser/web_contents_view.h" |
| 13 #include "content/public/browser/web_ui.h" | 12 #include "content/public/browser/web_ui.h" |
| 14 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 16 | 15 |
| 17 PackExtensionHandler::PackExtensionHandler() { | 16 PackExtensionHandler::PackExtensionHandler() { |
| 18 } | 17 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 info.extensions.front().push_back(FILE_PATH_LITERAL("pem")); | 170 info.extensions.front().push_back(FILE_PATH_LITERAL("pem")); |
| 172 info.extension_description_overrides.push_back( | 171 info.extension_description_overrides.push_back( |
| 173 l10n_util::GetStringUTF16( | 172 l10n_util::GetStringUTF16( |
| 174 IDS_EXTENSION_PACK_DIALOG_KEY_FILE_TYPE_DESCRIPTION)); | 173 IDS_EXTENSION_PACK_DIALOG_KEY_FILE_TYPE_DESCRIPTION)); |
| 175 info.include_all_files = true; | 174 info.include_all_files = true; |
| 176 file_type_index = 1; | 175 file_type_index = 1; |
| 177 } else { | 176 } else { |
| 178 NOTREACHED(); | 177 NOTREACHED(); |
| 179 } | 178 } |
| 180 | 179 |
| 181 load_extension_dialog_ = SelectFileDialog::Create( | 180 load_extension_dialog_ = SelectFileDialog::Create(this); |
| 182 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); | |
| 183 load_extension_dialog_->SelectFile( | 181 load_extension_dialog_->SelectFile( |
| 184 type, select_title, FilePath(), &info, file_type_index, | 182 type, select_title, FilePath(), &info, file_type_index, |
| 185 FILE_PATH_LITERAL(""), | 183 FILE_PATH_LITERAL(""), web_ui()->GetWebContents(), |
| 186 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), | 184 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); |
| 187 NULL); | |
| 188 } | 185 } |
| 189 | 186 |
| 190 void PackExtensionHandler::ShowAlert(const std::string& message) { | 187 void PackExtensionHandler::ShowAlert(const std::string& message) { |
| 191 ListValue arguments; | 188 ListValue arguments; |
| 192 arguments.Append(Value::CreateStringValue(message)); | 189 arguments.Append(Value::CreateStringValue(message)); |
| 193 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments); | 190 web_ui()->CallJavascriptFunction("PackExtensionOverlay.showError", arguments); |
| 194 } | 191 } |
| OLD | NEW |