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

Unified Diff: chrome/browser/ui/webui/extensions/install_extension_handler.cc

Issue 1129103006: Converting file_display_name_ type from base::string16 to base::FilePath. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/extensions/install_extension_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/browser/ui/webui/extensions/install_extension_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698