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

Side by Side Diff: chrome/browser/shell_integration_win.cc

Issue 337042: Revert 30168 - Commit patch set from http://codereview.chromium.org/149796... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/url_fixer_upper_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = CommandLine::FromString(value); 114 CommandLine command_line = CommandLine::FromString(value);
115 std::wstring short_path; 115 std::wstring short_path;
116 GetShortPathName(command_line.program().c_str(), 116 GetShortPathName(command_line.program().c_str(),
117 WriteInto(&short_path, MAX_PATH), MAX_PATH); 117 WriteInto(&short_path, MAX_PATH), MAX_PATH);
118 if (!FilePath::CompareEqualIgnoreCase(short_path, short_app_path)) 118 if ((short_path.size() != short_app_path.size()) ||
119 (!std::equal(short_path.begin(),
120 short_path.end(),
121 short_app_path.begin(),
122 CaseInsensitiveCompare<wchar_t>())))
119 return NOT_DEFAULT_BROWSER; 123 return NOT_DEFAULT_BROWSER;
120 } 124 }
121 } 125 }
122 return IS_DEFAULT_BROWSER; 126 return IS_DEFAULT_BROWSER;
123 } 127 }
124 128
125 // There is no reliable way to say which browser is default on a machine (each 129 // There is no reliable way to say which browser is default on a machine (each
126 // browser can have some of the protocols/shortcuts). So we look for only HTTP 130 // browser can have some of the protocols/shortcuts). So we look for only HTTP
127 // protocol handler. Even this handler is located at different places in 131 // protocol handler. Even this handler is located at different places in
128 // registry on XP and Vista: 132 // registry on XP and Vista:
(...skipping 16 matching lines...) Expand all
145 std::wstring key_path(L"http"); 149 std::wstring key_path(L"http");
146 key_path.append(ShellUtil::kRegShellOpen); 150 key_path.append(ShellUtil::kRegShellOpen);
147 RegKey key(HKEY_CLASSES_ROOT, key_path.c_str(), KEY_READ); 151 RegKey key(HKEY_CLASSES_ROOT, key_path.c_str(), KEY_READ);
148 std::wstring app_cmd; 152 std::wstring app_cmd;
149 if (key.Valid() && key.ReadValue(L"", &app_cmd) && 153 if (key.Valid() && key.ReadValue(L"", &app_cmd) &&
150 std::wstring::npos != StringToLowerASCII(app_cmd).find(L"firefox")) 154 std::wstring::npos != StringToLowerASCII(app_cmd).find(L"firefox"))
151 ff_default = true; 155 ff_default = true;
152 } 156 }
153 return ff_default; 157 return ff_default;
154 } 158 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_fixer_upper_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698