OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Check in HKEY_CLASSES_ROOT that is the result of merge between | 104 // Check in HKEY_CLASSES_ROOT that is the result of merge between |
105 // HKLM and HKCU | 105 // HKLM and HKCU |
106 HKEY root_key = HKEY_CLASSES_ROOT; | 106 HKEY root_key = HKEY_CLASSES_ROOT; |
107 // Check <protocol>\shell\open\command | 107 // Check <protocol>\shell\open\command |
108 std::wstring key_path(kChromeProtocols[i] + ShellUtil::kRegShellOpen); | 108 std::wstring key_path(kChromeProtocols[i] + ShellUtil::kRegShellOpen); |
109 RegKey key(root_key, key_path.c_str(), KEY_READ); | 109 RegKey key(root_key, key_path.c_str(), KEY_READ); |
110 std::wstring value; | 110 std::wstring value; |
111 if (!key.Valid() || !key.ReadValue(L"", &value)) | 111 if (!key.Valid() || !key.ReadValue(L"", &value)) |
112 return UNKNOWN_DEFAULT_BROWSER; | 112 return UNKNOWN_DEFAULT_BROWSER; |
113 // Need to normalize path in case it's been munged. | 113 // Need to normalize path in case it's been munged. |
114 CommandLine command_line(L""); | 114 CommandLine command_line = CommandLine::FromString(value); |
115 command_line.ParseFromString(value); | |
116 std::wstring short_path; | 115 std::wstring short_path; |
117 GetShortPathName(command_line.program().c_str(), | 116 GetShortPathName(command_line.program().c_str(), |
118 WriteInto(&short_path, MAX_PATH), MAX_PATH); | 117 WriteInto(&short_path, MAX_PATH), MAX_PATH); |
119 if ((short_path.size() != short_app_path.size()) || | 118 if ((short_path.size() != short_app_path.size()) || |
120 (!std::equal(short_path.begin(), | 119 (!std::equal(short_path.begin(), |
121 short_path.end(), | 120 short_path.end(), |
122 short_app_path.begin(), | 121 short_app_path.begin(), |
123 CaseInsensitiveCompare<wchar_t>()))) | 122 CaseInsensitiveCompare<wchar_t>()))) |
124 return NOT_DEFAULT_BROWSER; | 123 return NOT_DEFAULT_BROWSER; |
125 } | 124 } |
(...skipping 24 matching lines...) Expand all Loading... |
150 std::wstring key_path(L"http"); | 149 std::wstring key_path(L"http"); |
151 key_path.append(ShellUtil::kRegShellOpen); | 150 key_path.append(ShellUtil::kRegShellOpen); |
152 RegKey key(HKEY_CLASSES_ROOT, key_path.c_str(), KEY_READ); | 151 RegKey key(HKEY_CLASSES_ROOT, key_path.c_str(), KEY_READ); |
153 std::wstring app_cmd; | 152 std::wstring app_cmd; |
154 if (key.Valid() && key.ReadValue(L"", &app_cmd) && | 153 if (key.Valid() && key.ReadValue(L"", &app_cmd) && |
155 std::wstring::npos != StringToLowerASCII(app_cmd).find(L"firefox")) | 154 std::wstring::npos != StringToLowerASCII(app_cmd).find(L"firefox")) |
156 ff_default = true; | 155 ff_default = true; |
157 } | 156 } |
158 return ff_default; | 157 return ff_default; |
159 } | 158 } |
OLD | NEW |