Index: chrome/app/chrome_dll_main.cc |
=================================================================== |
--- chrome/app/chrome_dll_main.cc (revision 13311) |
+++ chrome/app/chrome_dll_main.cc (working copy) |
@@ -125,36 +125,16 @@ |
#pragma optimize("", on) |
-// Early versions of Chrome incorrectly registered a chromehtml: URL handler. |
-// Later versions fixed the registration but in some cases (e.g. Vista and non- |
-// admin installs) the fix could not be applied. This prevents Chrome to be |
-// launched with the incorrect format. |
-// CORRECT: <broser.exe> -- "chromehtml:<url>" |
-// INVALID: <broser.exe> "chromehtml:<url>" |
-bool IncorrectChromeHtmlArguments(const std::wstring& command_line) { |
- const wchar_t kChromeHtml[] = L"-- \"chromehtml:"; |
- const wchar_t kOffset = 5; // Where chromehtml: starts in above |
+// Early versions of Chrome incorrectly registered a chromehtml: URL handler, |
+// which gives us nothing but trouble. Avoid launching chrome this way since |
+// some apps fail to properly escape arguments. |
+bool HasDeprecatedArguments(const std::wstring& command_line) { |
+ const wchar_t kChromeHtml[] = L"chromehtml:"; |
std::wstring command_line_lower = command_line; |
- |
// We are only searching for ASCII characters so this is OK. |
StringToLowerASCII(&command_line_lower); |
- |
- std::wstring::size_type pos = command_line_lower.find( |
- kChromeHtml + kOffset); |
- |
- if (pos == std::wstring::npos) |
- return false; |
- |
- // The browser is being launched with chromehtml: somewhere on the command |
- // line. We will not launch unless it's preceded by the -- switch terminator. |
- if (pos >= kOffset) { |
- if (equal(kChromeHtml, kChromeHtml + arraysize(kChromeHtml) - 1, |
- command_line_lower.begin() + pos - kOffset)) { |
- return false; |
- } |
- } |
- |
- return true; |
+ std::wstring::size_type pos = command_line_lower.find(kChromeHtml); |
+ return (pos != std::wstring::npos); |
} |
#endif // OS_WIN |
@@ -300,7 +280,7 @@ |
#if defined(OS_WIN) |
// Must do this before any other usage of command line! |
- if (::IncorrectChromeHtmlArguments(parsed_command_line.command_line_string())) |
+ if (HasDeprecatedArguments(parsed_command_line.command_line_string())) |
return 1; |
#endif |