| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/shell_integration.h" | 5 #include "chrome/browser/shell_integration.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <shobjidl.h> | 9 #include <shobjidl.h> |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 RegKey key(root_key, key_path.c_str(), KEY_READ); | 103 RegKey key(root_key, key_path.c_str(), KEY_READ); |
| 104 std::wstring value; | 104 std::wstring value; |
| 105 if (!key.Valid() || !key.ReadValue(L"", &value)) | 105 if (!key.Valid() || !key.ReadValue(L"", &value)) |
| 106 return false; | 106 return false; |
| 107 // Need to normalize path in case it's been munged. | 107 // Need to normalize path in case it's been munged. |
| 108 CommandLine command_line(L""); | 108 CommandLine command_line(L""); |
| 109 command_line.ParseFromString(value); | 109 command_line.ParseFromString(value); |
| 110 std::wstring short_path; | 110 std::wstring short_path; |
| 111 GetShortPathName(command_line.program().c_str(), | 111 GetShortPathName(command_line.program().c_str(), |
| 112 WriteInto(&short_path, MAX_PATH), MAX_PATH); | 112 WriteInto(&short_path, MAX_PATH), MAX_PATH); |
| 113 if (short_path != short_app_path) | 113 if ((short_path.size() != short_app_path.size()) || |
| 114 (!std::equal(short_path.begin(), |
| 115 short_path.end(), |
| 116 short_app_path.begin(), |
| 117 CaseInsensitiveCompare<wchar_t>()))) |
| 114 return false; | 118 return false; |
| 115 } | 119 } |
| 116 } | 120 } |
| 117 return true; | 121 return true; |
| 118 } | 122 } |
| 119 | 123 |
| 120 // There is no reliable way to say which browser is default on a machine (each | 124 // There is no reliable way to say which browser is default on a machine (each |
| 121 // browser can have some of the protocols/shortcuts). So we look for only HTTP | 125 // browser can have some of the protocols/shortcuts). So we look for only HTTP |
| 122 // protocol handler. Even this handler is located at different places in | 126 // protocol handler. Even this handler is located at different places in |
| 123 // registry on XP and Vista: | 127 // registry on XP and Vista: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 140 std::wstring key_path(L"http"); | 144 std::wstring key_path(L"http"); |
| 141 key_path.append(ShellUtil::kRegShellOpen); | 145 key_path.append(ShellUtil::kRegShellOpen); |
| 142 RegKey key(HKEY_CLASSES_ROOT, key_path.c_str(), KEY_READ); | 146 RegKey key(HKEY_CLASSES_ROOT, key_path.c_str(), KEY_READ); |
| 143 std::wstring app_cmd; | 147 std::wstring app_cmd; |
| 144 if (key.Valid() && key.ReadValue(L"", &app_cmd) && | 148 if (key.Valid() && key.ReadValue(L"", &app_cmd) && |
| 145 std::wstring::npos != StringToLowerASCII(app_cmd).find(L"firefox")) | 149 std::wstring::npos != StringToLowerASCII(app_cmd).find(L"firefox")) |
| 146 ff_default = true; | 150 ff_default = true; |
| 147 } | 151 } |
| 148 return ff_default; | 152 return ff_default; |
| 149 } | 153 } |
| OLD | NEW |