| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file defines functions that integrate Chrome in Windows shell. These | 5 // This file defines functions that integrate Chrome in Windows shell. These |
| 6 // functions can be used by Chrome as well as Chrome installer. All of the | 6 // functions can be used by Chrome as well as Chrome installer. All of the |
| 7 // work is done by the local functions defined in anonymous namespace in | 7 // work is done by the local functions defined in anonymous namespace in |
| 8 // this class. | 8 // this class. |
| 9 | 9 |
| 10 #include "chrome/installer/util/shell_util.h" | 10 #include "chrome/installer/util/shell_util.h" |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 !AnotherUserHasDefaultBrowser(dist, chrome_exe)) { | 1154 !AnotherUserHasDefaultBrowser(dist, chrome_exe)) { |
| 1155 suffix = L""; | 1155 suffix = L""; |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 // Check if Chromium is already registered with this suffix. | 1158 // Check if Chromium is already registered with this suffix. |
| 1159 if (IsChromeRegisteredForProtocol(dist, suffix, protocol)) | 1159 if (IsChromeRegisteredForProtocol(dist, suffix, protocol)) |
| 1160 return true; | 1160 return true; |
| 1161 | 1161 |
| 1162 if (IsUserAnAdmin()) { | 1162 if (IsUserAnAdmin()) { |
| 1163 // We can do this operation directly. | 1163 // We can do this operation directly. |
| 1164 // If we're not registered at all, try to register. If that fails | 1164 // First, make sure Chrome is fully registered on this machine. |
| 1165 // we should give up. | 1165 if (!RegisterChromeBrowser(dist, chrome_exe, suffix, false)) |
| 1166 if (!IsChromeRegistered(dist, chrome_exe, suffix) && | |
| 1167 !RegisterChromeBrowser(dist, chrome_exe, suffix, false)) { | |
| 1168 return false; | 1166 return false; |
| 1169 } | |
| 1170 | 1167 |
| 1171 // Write in the capabillity for the protocol. | 1168 // Write in the capabillity for the protocol. |
| 1172 std::list<RegistryEntry*> entries; | 1169 std::list<RegistryEntry*> entries; |
| 1173 STLElementDeleter<std::list<RegistryEntry*> > entries_deleter(&entries); | 1170 STLElementDeleter<std::list<RegistryEntry*> > entries_deleter(&entries); |
| 1174 RegistryEntry::GetProtocolCapabilityEntries(dist, suffix, protocol, | 1171 RegistryEntry::GetProtocolCapabilityEntries(dist, suffix, protocol, |
| 1175 &entries); | 1172 &entries); |
| 1176 return AddRegistryEntries(HKEY_LOCAL_MACHINE, entries); | 1173 return AddRegistryEntries(HKEY_LOCAL_MACHINE, entries); |
| 1177 } else if (elevate_if_not_admin && | 1174 } else if (elevate_if_not_admin && |
| 1178 base::win::GetVersion() >= base::win::VERSION_VISTA) { | 1175 base::win::GetVersion() >= base::win::VERSION_VISTA) { |
| 1179 // Elevate to do the whole job | 1176 // Elevate to do the whole job |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 chrome_exe.c_str(), | 1288 chrome_exe.c_str(), |
| 1292 shortcut.c_str(), | 1289 shortcut.c_str(), |
| 1293 chrome_path.c_str(), | 1290 chrome_path.c_str(), |
| 1294 arguments.c_str(), | 1291 arguments.c_str(), |
| 1295 description.c_str(), | 1292 description.c_str(), |
| 1296 icon_path.c_str(), | 1293 icon_path.c_str(), |
| 1297 icon_index, | 1294 icon_index, |
| 1298 dist->GetBrowserAppId().c_str(), | 1295 dist->GetBrowserAppId().c_str(), |
| 1299 ConvertShellUtilShortcutOptionsToFileUtil(options)); | 1296 ConvertShellUtilShortcutOptionsToFileUtil(options)); |
| 1300 } | 1297 } |
| OLD | NEW |