| 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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 !AnotherUserHasDefaultBrowser(dist, chrome_exe)) { | 1187 !AnotherUserHasDefaultBrowser(dist, chrome_exe)) { |
| 1188 suffix = L""; | 1188 suffix = L""; |
| 1189 } | 1189 } |
| 1190 | 1190 |
| 1191 // Check if Chromium is already registered with this suffix. | 1191 // Check if Chromium is already registered with this suffix. |
| 1192 if (IsChromeRegisteredForProtocol(dist, suffix, protocol)) | 1192 if (IsChromeRegisteredForProtocol(dist, suffix, protocol)) |
| 1193 return true; | 1193 return true; |
| 1194 | 1194 |
| 1195 if (IsUserAnAdmin()) { | 1195 if (IsUserAnAdmin()) { |
| 1196 // We can do this operation directly. | 1196 // We can do this operation directly. |
| 1197 // If we're not registered at all, try to register. If that fails | 1197 // First, make sure Chrome is fully registered on this machine. |
| 1198 // we should give up. | 1198 if (!RegisterChromeBrowser(dist, chrome_exe, suffix, false)) |
| 1199 if (!IsChromeRegistered(dist, chrome_exe, suffix) && | |
| 1200 !RegisterChromeBrowser(dist, chrome_exe, suffix, false)) { | |
| 1201 return false; | 1199 return false; |
| 1202 } | |
| 1203 | 1200 |
| 1204 // Write in the capabillity for the protocol. | 1201 // Write in the capabillity for the protocol. |
| 1205 std::list<RegistryEntry*> entries; | 1202 std::list<RegistryEntry*> entries; |
| 1206 STLElementDeleter<std::list<RegistryEntry*> > entries_deleter(&entries); | 1203 STLElementDeleter<std::list<RegistryEntry*> > entries_deleter(&entries); |
| 1207 RegistryEntry::GetProtocolCapabilityEntries(dist, suffix, protocol, | 1204 RegistryEntry::GetProtocolCapabilityEntries(dist, suffix, protocol, |
| 1208 &entries); | 1205 &entries); |
| 1209 return AddRegistryEntries(HKEY_LOCAL_MACHINE, entries); | 1206 return AddRegistryEntries(HKEY_LOCAL_MACHINE, entries); |
| 1210 } else if (elevate_if_not_admin && | 1207 } else if (elevate_if_not_admin && |
| 1211 base::win::GetVersion() >= base::win::VERSION_VISTA) { | 1208 base::win::GetVersion() >= base::win::VERSION_VISTA) { |
| 1212 // Elevate to do the whole job | 1209 // Elevate to do the whole job |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 chrome_exe.c_str(), | 1321 chrome_exe.c_str(), |
| 1325 shortcut.c_str(), | 1322 shortcut.c_str(), |
| 1326 chrome_path.c_str(), | 1323 chrome_path.c_str(), |
| 1327 arguments.c_str(), | 1324 arguments.c_str(), |
| 1328 description.c_str(), | 1325 description.c_str(), |
| 1329 icon_path.c_str(), | 1326 icon_path.c_str(), |
| 1330 icon_index, | 1327 icon_index, |
| 1331 dist->GetBrowserAppId().c_str(), | 1328 dist->GetBrowserAppId().c_str(), |
| 1332 ConvertShellUtilShortcutOptionsToFileUtil(options)); | 1329 ConvertShellUtilShortcutOptionsToFileUtil(options)); |
| 1333 } | 1330 } |
| OLD | NEW |