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 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 // Registry value name for the DelegateExecute verb handler. | 288 // Registry value name for the DelegateExecute verb handler. |
289 static const wchar_t* kRegDelegateExecute; | 289 static const wchar_t* kRegDelegateExecute; |
290 | 290 |
291 // Registry value name for the OpenWithProgids entry for file associations. | 291 // Registry value name for the OpenWithProgids entry for file associations. |
292 static const wchar_t* kRegOpenWithProgids; | 292 static const wchar_t* kRegOpenWithProgids; |
293 | 293 |
294 // Returns true if |chrome_exe| is registered in HKLM with |suffix|. | 294 // Returns true if |chrome_exe| is registered in HKLM with |suffix|. |
295 // Note: This only checks one deterministic key in HKLM for |chrome_exe| and | 295 // Note: This only checks one deterministic key in HKLM for |chrome_exe| and |
296 // doesn't otherwise validate a full Chrome install in HKLM. | 296 // doesn't otherwise validate a full Chrome install in HKLM. |
297 static bool QuickIsChromeRegisteredInHKLM(BrowserDistribution* dist, | 297 static bool QuickIsChromeRegisteredInHKLM(const base::FilePath& chrome_exe, |
298 const base::FilePath& chrome_exe, | |
299 const base::string16& suffix); | 298 const base::string16& suffix); |
300 | 299 |
301 // Returns true if the current Windows version supports the presence of | 300 // Returns true if the current Windows version supports the presence of |
302 // shortcuts at |location|. | 301 // shortcuts at |location|. |
303 static bool ShortcutLocationIsSupported(ShortcutLocation location); | 302 static bool ShortcutLocationIsSupported(ShortcutLocation location); |
304 | 303 |
305 // Sets |path| to the path for a shortcut at the |location| desired for the | 304 // Sets |path| to the path for a shortcut at the |location| desired for the |
306 // given |level| (CURRENT_USER for per-user path and SYSTEM_LEVEL for | 305 // given |level| (CURRENT_USER for per-user path and SYSTEM_LEVEL for |
307 // all-users path). | 306 // all-users path). |
308 // Returns false on failure. | 307 // Returns false on failure. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 static base::string16 GetChromeDelegateCommand( | 350 static base::string16 GetChromeDelegateCommand( |
352 const base::FilePath& chrome_exe); | 351 const base::FilePath& chrome_exe); |
353 | 352 |
354 // Gets a mapping of all registered browser names (excluding browsers in the | 353 // Gets a mapping of all registered browser names (excluding browsers in the |
355 // |dist| distribution) and their reinstall command (which usually sets | 354 // |dist| distribution) and their reinstall command (which usually sets |
356 // browser as default). | 355 // browser as default). |
357 // Given browsers can be registered in HKCU (as of Win7) and/or in HKLM, this | 356 // Given browsers can be registered in HKCU (as of Win7) and/or in HKLM, this |
358 // method looks in both and gives precedence to values in HKCU as per the msdn | 357 // method looks in both and gives precedence to values in HKCU as per the msdn |
359 // standard: http://goo.gl/xjczJ. | 358 // standard: http://goo.gl/xjczJ. |
360 static void GetRegisteredBrowsers( | 359 static void GetRegisteredBrowsers( |
361 BrowserDistribution* dist, | |
362 std::map<base::string16, base::string16>* browsers); | 360 std::map<base::string16, base::string16>* browsers); |
363 | 361 |
364 // Returns the suffix this user's Chrome install is registered with. | 362 // Returns the suffix this user's Chrome install is registered with. |
365 // Always returns the empty string on system-level installs. | 363 // Always returns the empty string on system-level installs. |
366 // | 364 // |
367 // This method is meant for external methods which need to know the suffix of | 365 // This method is meant for external methods which need to know the suffix of |
368 // the current install at run-time, not for install-time decisions. | 366 // the current install at run-time, not for install-time decisions. |
369 // There are no guarantees that this suffix will not change later: | 367 // There are no guarantees that this suffix will not change later: |
370 // (e.g. if two user-level installs were previously installed in parallel on | 368 // (e.g. if two user-level installs were previously installed in parallel on |
371 // the same machine, both without admin rights and with no user-level install | 369 // the same machine, both without admin rights and with no user-level install |
372 // having claimed the non-suffixed HKLM registrations, they both have no | 370 // having claimed the non-suffixed HKLM registrations, they both have no |
373 // suffix in their progId entries (as per the old suffix rules). If they were | 371 // suffix in their progId entries (as per the old suffix rules). If they were |
374 // to both fully register (i.e. click "Make Chrome Default" and go through | 372 // to both fully register (i.e. click "Make Chrome Default" and go through |
375 // UAC; or upgrade to Win8 and get the automatic no UAC full registration) | 373 // UAC; or upgrade to Win8 and get the automatic no UAC full registration) |
376 // they would then both get a suffixed registration as per the new suffix | 374 // they would then both get a suffixed registration as per the new suffix |
377 // rules). | 375 // rules). |
378 // | 376 // |
379 // |chrome_exe| The path to the currently installed (or running) chrome.exe. | 377 // |chrome_exe| The path to the currently installed (or running) chrome.exe. |
380 static base::string16 GetCurrentInstallationSuffix( | 378 static base::string16 GetCurrentInstallationSuffix( |
381 BrowserDistribution* dist, | |
382 const base::FilePath& chrome_exe); | 379 const base::FilePath& chrome_exe); |
383 | 380 |
384 // Returns the application name of the program under |dist|. | |
385 // This application name will be suffixed as is appropriate for the current | |
386 // install. | |
387 // This is the name that is registered with Default Programs on Windows and | |
388 // that should thus be used to "make chrome default" and such. | |
389 static base::string16 GetApplicationName(BrowserDistribution* dist, | |
390 const base::FilePath& chrome_exe); | |
391 | |
392 // Returns the AppUserModelId. This identifier is unconditionally suffixed | 381 // Returns the AppUserModelId. This identifier is unconditionally suffixed |
393 // with a unique id for this user on user-level installs (in contrast to other | 382 // with a unique id for this user on user-level installs (in contrast to other |
394 // registration entries which are suffixed as described in | 383 // registration entries which are suffixed as described in |
395 // GetCurrentInstallationSuffix() above). | 384 // GetCurrentInstallationSuffix() above). |
396 static base::string16 GetBrowserModelId(bool is_per_user_install); | 385 static base::string16 GetBrowserModelId(bool is_per_user_install); |
397 | 386 |
398 // Returns an AppUserModelId composed of each member of |components| separated | 387 // Returns an AppUserModelId composed of each member of |components| separated |
399 // by dots. | 388 // by dots. |
400 // The returned appid is guaranteed to be no longer than | 389 // The returned appid is guaranteed to be no longer than |
401 // chrome::kMaxAppModelIdLength (some of the components might have been | 390 // chrome::kMaxAppModelIdLength (some of the components might have been |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 // Set/CreateRegWorkItems and runs them using WorkItemList. | 635 // Set/CreateRegWorkItems and runs them using WorkItemList. |
647 static bool AddRegistryEntries(HKEY root, | 636 static bool AddRegistryEntries(HKEY root, |
648 const ScopedVector<RegistryEntry>& entries); | 637 const ScopedVector<RegistryEntry>& entries); |
649 | 638 |
650 private: | 639 private: |
651 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 640 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
652 }; | 641 }; |
653 | 642 |
654 | 643 |
655 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 644 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |