| Index: chrome/browser/ui/webui/extensions/install_extension_handler.cc
|
| diff --git a/chrome/browser/ui/webui/extensions/install_extension_handler.cc b/chrome/browser/ui/webui/extensions/install_extension_handler.cc
|
| index 002cebd6f9d6060c7e9d54a48a0af8f71482aafb..0e4b82fdad38f47c008ec0ad5b8e317137bbc544 100644
|
| --- a/chrome/browser/ui/webui/extensions/install_extension_handler.cc
|
| +++ b/chrome/browser/ui/webui/extensions/install_extension_handler.cc
|
| @@ -79,10 +79,8 @@ void InstallExtensionHandler::HandleStartDragMessage(
|
| file_to_install_ = file_info.path;
|
| // Use the display name if provided, for checking file names
|
| // (.path is likely a random hash value in that case).
|
| - // TODO(dcheng): It would be nice to make this a FilePath too.
|
| - file_display_name_ = file_info.display_name.empty()
|
| - ? file_info.path.AsUTF16Unsafe()
|
| - : file_info.display_name.AsUTF16Unsafe();
|
| + file_display_name_ =
|
| + file_info.display_name.empty() ? file_info.path : file_info.display_name;
|
| }
|
|
|
| void InstallExtensionHandler::HandleStopDragMessage(
|
| @@ -101,10 +99,7 @@ void InstallExtensionHandler::HandleInstallMessage(
|
| Profile* profile = Profile::FromBrowserContext(
|
| web_ui()->GetWebContents()->GetBrowserContext());
|
|
|
| - const bool kCaseSensitive = false;
|
| -
|
| - if (EndsWith(
|
| - file_display_name_, base::ASCIIToUTF16(".zip"), kCaseSensitive)) {
|
| + if (file_display_name_.MatchesExtension(FILE_PATH_LITERAL(".zip"))) {
|
| ZipFileInstaller::Create(ExtensionSystem::Get(profile)->extension_service())
|
| ->LoadFromZipFile(file_to_install_);
|
| } else {
|
| @@ -117,14 +112,10 @@ void InstallExtensionHandler::HandleInstallMessage(
|
| CrxInstaller::OffStoreInstallAllowedFromSettingsPage);
|
| crx_installer->set_install_immediately(true);
|
|
|
| - if (EndsWith(file_display_name_,
|
| - base::ASCIIToUTF16(".user.js"),
|
| - kCaseSensitive)) {
|
| + if (file_display_name_.MatchesExtension(FILE_PATH_LITERAL(".user.js"))) {
|
| crx_installer->InstallUserScript(
|
| file_to_install_, net::FilePathToFileURL(file_to_install_));
|
| - } else if (EndsWith(file_display_name_,
|
| - base::ASCIIToUTF16(".crx"),
|
| - kCaseSensitive)) {
|
| + } else if (file_display_name_.MatchesExtension(FILE_PATH_LITERAL(".crx"))) {
|
| crx_installer->InstallCrx(file_to_install_);
|
| } else {
|
| CHECK(false);
|
|
|