summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 22:03:41 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 22:03:41 +0000
commita4b862b91183cc63c120d2ab50f1445068379884 (patch)
tree1ecde495e42db3ceea24722d2b8f42cb7c7efdaa
parentb9a3581cb5d3b0c93f0ad36c0a135038bbc7ce2f (diff)
downloadchromium_src-a4b862b91183cc63c120d2ab50f1445068379884.zip
chromium_src-a4b862b91183cc63c120d2ab50f1445068379884.tar.gz
chromium_src-a4b862b91183cc63c120d2ab50f1445068379884.tar.bz2
Fix for invocation over deprecated protocol handler
- We don't support chromehtml protocol anymore and future installers do not register it - Avoid stale registry entries to invoke us BUG=9860 BUG=9862 Review URL: http://codereview.chromium.org/64003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13384 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/chrome_dll_main.cc36
1 files changed, 8 insertions, 28 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 5281553..547e3fa 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -127,36 +127,16 @@ void ChromeAssert(const std::string& str) {
#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
@@ -302,7 +282,7 @@ int ChromeMain(int argc, const char** argv) {
#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