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

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

Issue 13864015: Move app launcher and chrome apps shortcut strings into the installer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migrate_app_id_fix
Patch Set: add #ifdef for linux only property Created 7 years, 1 month 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
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 24 matching lines...) Expand all
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_BEGIN = 0,
gab 2013/11/21 05:50:19 I would prefer SHORTCUT_LOCATION_FIRST here.
calamity 2013/11/21 06:52:46 Done.
46 SHORTCUT_LOCATION_DESKTOP = SHORTCUT_LOCATION_BEGIN,
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
54 // This always appears last.
gab 2013/11/21 05:50:19 I think this is a fairly common idiom (I don't thi
calamity 2013/11/21 06:52:46 Removed comment. I don't understand what you mean
gab 2013/11/21 19:52:24 Nah, remove the blank line; my bad, I meant "no-tr
calamity 2013/11/24 23:55:15 Done.
55 NUM_SHORTCUT_LOCATION
gab 2013/11/21 05:50:19 NUM_SHORTCUT_LOCATIONS
calamity 2013/11/21 06:52:46 Done.
50 }; 56 };
51 57
52 enum ShortcutOperation { 58 enum ShortcutOperation {
53 // Create a new shortcut (overwriting if necessary). 59 // Create a new shortcut (overwriting if necessary).
54 SHELL_SHORTCUT_CREATE_ALWAYS, 60 SHELL_SHORTCUT_CREATE_ALWAYS,
55 // Create the per-user shortcut only if its system-level equivalent (with 61 // Create the per-user shortcut only if its system-level equivalent (with
56 // the same name) is not present. 62 // the same name) is not present.
57 SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL, 63 SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL,
58 // Overwrite an existing shortcut (fail if the shortcut doesn't exist). 64 // 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 65 // 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
308 BrowserDistribution* dist, 314 BrowserDistribution* dist,
309 ShellChange level, 315 ShellChange level,
310 base::FilePath* path); 316 base::FilePath* path);
311 317
312 // Updates shortcut in |location| (or creates it if |options| specify 318 // Updates shortcut in |location| (or creates it if |options| specify
313 // SHELL_SHORTCUT_CREATE_ALWAYS). 319 // SHELL_SHORTCUT_CREATE_ALWAYS).
314 // |dist| gives the type of browser distribution currently in use. 320 // |dist| gives the type of browser distribution currently in use.
315 // |properties| and |operation| affect this method as described on their 321 // |properties| and |operation| affect this method as described on their
316 // invidividual definitions above. 322 // invidividual definitions above.
317 // |location| may be one of SHORTCUT_LOCATION_DESKTOP, 323 // |location| may be one of SHORTCUT_LOCATION_DESKTOP,
318 // SHORTCUT_LOCATION_QUICK_LAUNCH, or SHORTCUT_LOCATION_START_MENU. 324 // SHORTCUT_LOCATION_QUICK_LAUNCH, SHORTCUT_LOCATION_START_MENU_ROOT,
325 // SHORTCUT_LOCATION_START_MENU_CHROME_DIR, or
326 // SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR.
319 static bool CreateOrUpdateShortcut( 327 static bool CreateOrUpdateShortcut(
320 ShellUtil::ShortcutLocation location, 328 ShellUtil::ShortcutLocation location,
321 BrowserDistribution* dist, 329 BrowserDistribution* dist,
322 const ShellUtil::ShortcutProperties& properties, 330 const ShellUtil::ShortcutProperties& properties,
323 ShellUtil::ShortcutOperation operation); 331 ShellUtil::ShortcutOperation operation);
324 332
325 // Returns the string "|icon_path|,|icon_index|" (see, for example, 333 // Returns the string "|icon_path|,|icon_index|" (see, for example,
326 // http://msdn.microsoft.com/library/windows/desktop/dd391573.aspx). 334 // http://msdn.microsoft.com/library/windows/desktop/dd391573.aspx).
327 static string16 FormatIconLocation(const string16& icon_path, int icon_index); 335 static string16 FormatIconLocation(const string16& icon_path, int icon_index);
328 336
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 const string16& chrome_exe, 511 const string16& chrome_exe,
504 const string16& unique_suffix, 512 const string16& unique_suffix,
505 const string16& protocol, 513 const string16& protocol,
506 bool elevate_if_not_admin); 514 bool elevate_if_not_admin);
507 515
508 // Removes installed shortcut(s) at |location|. 516 // Removes installed shortcut(s) at |location|.
509 // |level|: CURRENT_USER to remove per-user shortcuts, or SYSTEM_LEVEL to 517 // |level|: CURRENT_USER to remove per-user shortcuts, or SYSTEM_LEVEL to
510 // remove all-users shortcuts. 518 // remove all-users shortcuts.
511 // |target_exe|: Shortcut target exe; shortcuts will only be deleted when 519 // |target_exe|: Shortcut target exe; shortcuts will only be deleted when
512 // their target is |target_exe|. 520 // their target is |target_exe|.
513 // If |location| is SHORTCUT_LOCATION_START_MENU, the shortcut folder specific 521 // If |location| is a Chrome-specific folder, it will be deleted as well.
514 // to |dist| is deleted.
515 // Returns true if all shortcuts pointing to |target_exe| are successfully 522 // Returns true if all shortcuts pointing to |target_exe| are successfully
516 // deleted, including the case where no such shortcuts are found. 523 // deleted, including the case where no such shortcuts are found.
517 static bool RemoveShortcuts(ShellUtil::ShortcutLocation location, 524 static bool RemoveShortcuts(ShellUtil::ShortcutLocation location,
518 BrowserDistribution* dist, 525 BrowserDistribution* dist,
519 ShellChange level, 526 ShellChange level,
520 const base::FilePath& target_exe); 527 const base::FilePath& target_exe);
521 528
522 // Applies the updates in |properties| to all matching shortcuts in 529 // Applies the updates in |properties| to all matching shortcuts in
523 // |location|, i.e.: 530 // |location|, i.e.:
524 // - the shortcut's original target is |target_exe|, 531 // - the shortcut's original target is |target_exe|,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 // required by the base32 standard for inputs that aren't a multiple of 5 568 // required by the base32 standard for inputs that aren't a multiple of 5
562 // bytes. 569 // bytes.
563 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); 570 static string16 ByteArrayToBase32(const uint8* bytes, size_t size);
564 571
565 private: 572 private:
566 DISALLOW_COPY_AND_ASSIGN(ShellUtil); 573 DISALLOW_COPY_AND_ASSIGN(ShellUtil);
567 }; 574 };
568 575
569 576
570 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ 577 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698