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

Side by Side Diff: chrome/installer/util/shell_util.h

Issue 10451074: Always suffix ChromeHTML entries on Windows for user-level installs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments + introduce ShellUtil::QuickIsChromeRegistered() Created 8 years, 6 months 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
OLDNEW
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 declares methods that are useful for integrating Chrome in 5 // This file declares methods that are useful for integrating Chrome in
6 // Windows shell. These methods are all static and currently part of 6 // Windows shell. These methods are all static and currently part of
7 // ShellUtil class. 7 // ShellUtil class.
8 8
9 #ifndef CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ 9 #ifndef CHROME_INSTALLER_UTIL_SHELL_UTIL_H_
10 #define CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ 10 #define CHROME_INSTALLER_UTIL_SHELL_UTIL_H_
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // returns false. If system_level is true this function returns the path 197 // returns false. If system_level is true this function returns the path
198 // to Default Users Quick Launch shortcuts path. Adding a shortcut to Default 198 // to Default Users Quick Launch shortcuts path. Adding a shortcut to Default
199 // User's profile only affects any new user profiles (not existing ones). 199 // User's profile only affects any new user profiles (not existing ones).
200 static bool GetQuickLaunchPath(bool system_level, FilePath* path); 200 static bool GetQuickLaunchPath(bool system_level, FilePath* path);
201 201
202 // Gets a mapping of all registered browser (on local machine) names and 202 // Gets a mapping of all registered browser (on local machine) names and
203 // their reinstall command (which usually sets browser as default). 203 // their reinstall command (which usually sets browser as default).
204 static void GetRegisteredBrowsers(BrowserDistribution* dist, 204 static void GetRegisteredBrowsers(BrowserDistribution* dist,
205 std::map<string16, string16>* browsers); 205 std::map<string16, string16>* browsers);
206 206
207 // This function gets a suffix (user's login name) that can be added 207 // Returns the suffix this user's Chrome install is registered with.
208 // to Chromium default browser entry in the registry to create a unique name 208 // Always returns the empty string on system-level installs.
209 // if there are multiple users on the machine, each with their own copy of 209 //
210 // Chromium that they want to set as default browser. 210 // This method is meant for external methods which need to know the suffix of
211 // This suffix value is assigned to |entry|. The function also checks for 211 // the current install at run-time, not for install-time decisions.
212 // existence of Default Browser registry key with this suffix and 212 // There are no guarantees that this suffix will not change later:
213 // returns true if it exists. In all other cases it returns false. 213 // (e.g. if two user-level installs were previously installed in parallel on
214 static bool GetUserSpecificDefaultBrowserSuffix(BrowserDistribution* dist, 214 // the same machine, both without admin rights and with no user-level install
215 string16* entry); 215 // having claimed the non-suffixed HKLM registrations, they both have no
216 // suffix in their progId entries (as per the old suffix rules). If they were
217 // to both fully register (i.e. click "Make Chrome Default" and go through
218 // UAC; or upgrade to Win8 and get the automatic no UAC full registration)
219 // they would then both get a suffixed registration as per the new suffix
220 // rules).
221 //
222 // |chrome_exe| The path to the currently installed (or running) chrome.exe.
223 static string16 GetCurrentInstallationSuffix(BrowserDistribution* dist,
224 const string16& chrome_exe);
225
226 // An enum used to tell CurrentUserIsRegisteredWithSuffix() which level of
grt (UTC plus 2) 2012/06/08 16:24:13 CurrentUserIsRegisteredWithSuffix -> QuickIsChrome
gab 2012/06/08 20:15:51 Done.
227 // registration we want to confirm.
228 enum RegistrationConfirmationLevel {
grt (UTC plus 2) 2012/06/08 16:24:13 chromium style: enums come before methods in a cla
gab 2012/06/08 20:15:51 Done.
229 // Only look for Chrome's ProgIds.
230 // This is sufficient when we are trying to determine the suffix of the
231 // currently running Chrome as system registrations might not be present.
232 CONFIRM_PROGID_REGISTRATION = 0,
233 // Confirm that Chrome is registered on the system (i.e. registered with
234 // Defaut Programs).
235 CONFIRM_SYSTEM_REGISTRATION,
236 };
237
238 // Returns true if the current install's |chrome_exe| has been registered with
239 // |suffix|.
240 // |confirmation_level| is the level of verification desired as described in
241 // the RegistrationConfirmationLevel enum above.
242 // |suffix| can be the empty string (this is used to support old installs
243 // where we used to not suffix user-level installs if they were the first to
244 // request the non-suffixed registry entries on the machine).
245 // NOTE: This a quick check that only validates that a single registry entry
246 // points to |chrome_exe|. This should only be used at run-time to determine
247 // how Chrome is registered, not to know whether the registration is complete
248 // at install-time (IsChromeRegistered() can be used for that).
249 static bool QuickIsChromeRegistered(
grt (UTC plus 2) 2012/06/08 16:24:13 Looks like you can simplify things if you remove R
gab 2012/06/08 20:15:51 Thanks for pointing this out, it turns out that wi
250 BrowserDistribution* dist,
251 const string16& chrome_exe,
252 const string16& suffix,
253 RegistrationConfirmationLevel confirmation_level);
216 254
217 // Make Chrome the default browser. This function works by going through 255 // Make Chrome the default browser. This function works by going through
218 // the url protocols and file associations that are related to general 256 // the url protocols and file associations that are related to general
219 // browsing, e.g. http, https, .html etc., and requesting to become the 257 // browsing, e.g. http, https, .html etc., and requesting to become the
220 // default handler for each. If any of these fails the operation will return 258 // default handler for each. If any of these fails the operation will return
221 // false to indicate failure, which is consistent with the return value of 259 // false to indicate failure, which is consistent with the return value of
222 // ShellIntegration::IsDefaultBrowser. 260 // ShellIntegration::IsDefaultBrowser.
223 // 261 //
224 // In the case of failure any successful changes will be left, however no 262 // In the case of failure any successful changes will be left, however no
225 // more changes will be attempted. 263 // more changes will be attempted.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 const string16& icon_path, 382 const string16& icon_path,
345 int icon_index, 383 int icon_index,
346 uint32 options); 384 uint32 options);
347 385
348 private: 386 private:
349 DISALLOW_COPY_AND_ASSIGN(ShellUtil); 387 DISALLOW_COPY_AND_ASSIGN(ShellUtil);
350 }; 388 };
351 389
352 390
353 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ 391 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698