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 24 matching lines...) Expand all Loading... | |
35 // Chrome's default handler state for a given protocol. | 35 // Chrome's default handler state for a given protocol. |
36 enum DefaultState { | 36 enum DefaultState { |
37 UNKNOWN_DEFAULT, | 37 UNKNOWN_DEFAULT, |
38 NOT_DEFAULT, | 38 NOT_DEFAULT, |
39 IS_DEFAULT, | 39 IS_DEFAULT, |
40 }; | 40 }; |
41 | 41 |
42 // Typical shortcut directories. Resolved in GetShortcutPath(). | 42 // Typical shortcut directories. Resolved in GetShortcutPath(). |
43 // Also used in ShortcutLocationIsSupported(). | 43 // Also used in ShortcutLocationIsSupported(). |
44 enum ShortcutLocation { | 44 enum ShortcutLocation { |
45 SHORTCUT_LOCATION_DESKTOP, | 45 SHORTCUT_LOCATION_START = 0, |
46 SHORTCUT_LOCATION_DESKTOP = SHORTCUT_LOCATION_START, | |
46 SHORTCUT_LOCATION_QUICK_LAUNCH, | 47 SHORTCUT_LOCATION_QUICK_LAUNCH, |
47 SHORTCUT_LOCATION_START_MENU, | 48 SHORTCUT_LOCATION_START_MENU_ROOT, |
49 SHORTCUT_LOCATION_START_MENU_CHROME_DIR, | |
50 SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, | |
48 SHORTCUT_LOCATION_TASKBAR_PINS, // base::win::VERSION_WIN7 + | 51 SHORTCUT_LOCATION_TASKBAR_PINS, // base::win::VERSION_WIN7 + |
49 SHORTCUT_LOCATION_APP_SHORTCUTS, // base::win::VERSION_WIN8 + | 52 SHORTCUT_LOCATION_APP_SHORTCUTS, // base::win::VERSION_WIN8 + |
53 SHORTCUT_LOCATION_END, | |
gab
2013/10/03 17:22:49
nit: it was suggested to me in a previous code rev
| |
50 }; | 54 }; |
51 | 55 |
52 enum ShortcutOperation { | 56 enum ShortcutOperation { |
53 // Create a new shortcut (overwriting if necessary). | 57 // Create a new shortcut (overwriting if necessary). |
54 SHELL_SHORTCUT_CREATE_ALWAYS, | 58 SHELL_SHORTCUT_CREATE_ALWAYS, |
55 // Create the per-user shortcut only if its system-level equivalent (with | 59 // Create the per-user shortcut only if its system-level equivalent (with |
56 // the same name) is not present. | 60 // the same name) is not present. |
57 SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL, | 61 SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL, |
58 // Overwrite an existing shortcut (fail if the shortcut doesn't exist). | 62 // Overwrite an existing shortcut (fail if the shortcut doesn't exist). |
59 // If the arguments are not specified on the new shortcut, keep the old | 63 // If the arguments are not specified on the new shortcut, keep the old |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 BrowserDistribution* dist, | 312 BrowserDistribution* dist, |
309 ShellChange level, | 313 ShellChange level, |
310 base::FilePath* path); | 314 base::FilePath* path); |
311 | 315 |
312 // Updates shortcut in |location| (or creates it if |options| specify | 316 // Updates shortcut in |location| (or creates it if |options| specify |
313 // SHELL_SHORTCUT_CREATE_ALWAYS). | 317 // SHELL_SHORTCUT_CREATE_ALWAYS). |
314 // |dist| gives the type of browser distribution currently in use. | 318 // |dist| gives the type of browser distribution currently in use. |
315 // |properties| and |operation| affect this method as described on their | 319 // |properties| and |operation| affect this method as described on their |
316 // invidividual definitions above. | 320 // invidividual definitions above. |
317 // |location| may be one of SHORTCUT_LOCATION_DESKTOP, | 321 // |location| may be one of SHORTCUT_LOCATION_DESKTOP, |
318 // SHORTCUT_LOCATION_QUICK_LAUNCH, or SHORTCUT_LOCATION_START_MENU. | 322 // SHORTCUT_LOCATION_QUICK_LAUNCH, SHORTCUT_LOCATION_START_MENU_ROOT, |
323 // SHORTCUT_LOCATION_START_MENU_CHROME_DIR, or | |
324 // SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR. | |
319 static bool CreateOrUpdateShortcut( | 325 static bool CreateOrUpdateShortcut( |
320 ShellUtil::ShortcutLocation location, | 326 ShellUtil::ShortcutLocation location, |
321 BrowserDistribution* dist, | 327 BrowserDistribution* dist, |
322 const ShellUtil::ShortcutProperties& properties, | 328 const ShellUtil::ShortcutProperties& properties, |
323 ShellUtil::ShortcutOperation operation); | 329 ShellUtil::ShortcutOperation operation); |
324 | 330 |
325 // Returns the string "|icon_path|,|icon_index|" (see, for example, | 331 // Returns the string "|icon_path|,|icon_index|" (see, for example, |
326 // http://msdn.microsoft.com/library/windows/desktop/dd391573.aspx). | 332 // http://msdn.microsoft.com/library/windows/desktop/dd391573.aspx). |
327 static string16 FormatIconLocation(const string16& icon_path, int icon_index); | 333 static string16 FormatIconLocation(const string16& icon_path, int icon_index); |
328 | 334 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 const string16& chrome_exe, | 509 const string16& chrome_exe, |
504 const string16& unique_suffix, | 510 const string16& unique_suffix, |
505 const string16& protocol, | 511 const string16& protocol, |
506 bool elevate_if_not_admin); | 512 bool elevate_if_not_admin); |
507 | 513 |
508 // Removes installed shortcut(s) at |location|. | 514 // Removes installed shortcut(s) at |location|. |
509 // |level|: CURRENT_USER to remove per-user shortcuts, or SYSTEM_LEVEL to | 515 // |level|: CURRENT_USER to remove per-user shortcuts, or SYSTEM_LEVEL to |
510 // remove all-users shortcuts. | 516 // remove all-users shortcuts. |
511 // |target_exe|: Shortcut target exe; shortcuts will only be deleted when | 517 // |target_exe|: Shortcut target exe; shortcuts will only be deleted when |
512 // their target is |target_exe|. | 518 // their target is |target_exe|. |
513 // If |location| is SHORTCUT_LOCATION_START_MENU, the shortcut folder specific | 519 // If |location| is SHORTCUT_LOCATION_START_MENU_CHROME_DIR, the shortcut |
514 // to |dist| is deleted. | 520 // folder specific to |dist| is deleted. |
515 // Returns true if all shortcuts pointing to |target_exe| are successfully | 521 // Returns true if all shortcuts pointing to |target_exe| are successfully |
516 // deleted, including the case where no such shortcuts are found. | 522 // deleted, including the case where no such shortcuts are found. |
517 static bool RemoveShortcuts(ShellUtil::ShortcutLocation location, | 523 static bool RemoveShortcuts(ShellUtil::ShortcutLocation location, |
518 BrowserDistribution* dist, | 524 BrowserDistribution* dist, |
519 ShellChange level, | 525 ShellChange level, |
520 const base::FilePath& target_exe); | 526 const base::FilePath& target_exe); |
521 | 527 |
522 // Applies the updates in |properties| to all matching shortcuts in | 528 // Applies the updates in |properties| to all matching shortcuts in |
523 // |location|, i.e.: | 529 // |location|, i.e.: |
524 // - the shortcut's original target is |target_exe|, | 530 // - the shortcut's original target is |target_exe|, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 // required by the base32 standard for inputs that aren't a multiple of 5 | 567 // required by the base32 standard for inputs that aren't a multiple of 5 |
562 // bytes. | 568 // bytes. |
563 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); | 569 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); |
564 | 570 |
565 private: | 571 private: |
566 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 572 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
567 }; | 573 }; |
568 | 574 |
569 | 575 |
570 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 576 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |