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

Unified Diff: chrome/browser/shell_integration_win.cc

Issue 2076253002: Simplify the text in the external protocol confirmation dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Const Created 4 years, 2 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
Index: chrome/browser/shell_integration_win.cc
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 34c5e265f42fa19d1bc9cb9c7dd1861d9bcb6f55..68fc2cee91727d6b6822508416f4cefe3f3385c1 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -200,21 +200,28 @@ base::string16 GetAppForProtocolUsingAssocQuery(const GURL& url) {
}
base::string16 GetAppForProtocolUsingRegistry(const GURL& url) {
- const base::string16 cmd_key_path =
- base::ASCIIToUTF16(url.scheme() + "\\shell\\open\\command");
- base::win::RegKey cmd_key(HKEY_CLASSES_ROOT,
- cmd_key_path.c_str(),
- KEY_READ);
- base::string16 application_to_launch;
- if (cmd_key.ReadValue(NULL, &application_to_launch) == ERROR_SUCCESS) {
- const base::string16 url_spec =
- base::ASCIIToUTF16(url.possibly_invalid_spec());
- base::ReplaceSubstringsAfterOffset(&application_to_launch,
- 0,
- L"%1",
- url_spec);
- return application_to_launch;
+ base::string16 command_to_launch;
+
+ // First, try and extract the application's display name.
+ base::string16 cmd_key_path = base::ASCIIToUTF16(url.scheme());
+ base::win::RegKey cmd_key_name(HKEY_CLASSES_ROOT, cmd_key_path.c_str(),
+ KEY_READ);
+ if (cmd_key_name.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS &&
+ !command_to_launch.empty()) {
+ return command_to_launch;
+ }
+
+ // Otherwise, parse the command line in the registry, and return the basename
+ // of the program path if it exists.
+ cmd_key_path = base::ASCIIToUTF16(url.scheme() + "\\shell\\open\\command");
+ base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(),
+ KEY_READ);
+ if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) {
+ base::CommandLine command_line(
+ base::CommandLine::FromString(command_to_launch));
+ return command_line.GetProgram().BaseName().value();
}
+
return base::string16();
}
« no previous file with comments | « chrome/browser/external_protocol/external_protocol_handler.cc ('k') | chrome/browser/ui/cocoa/external_protocol_dialog.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698