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

Side by Side Diff: base/win/shortcut.h

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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
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 #ifndef BASE_WIN_SHORTCUT_H_ 5 #ifndef BASE_WIN_SHORTCUT_H_
6 #define BASE_WIN_SHORTCUT_H_ 6 #define BASE_WIN_SHORTCUT_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/base_export.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 14
14 namespace base { 15 namespace base {
15 namespace win { 16 namespace win {
16 17
17 enum ShortcutOperation { 18 enum ShortcutOperation {
18 // Create a new shortcut (overwriting if necessary). 19 // Create a new shortcut (overwriting if necessary).
19 SHORTCUT_CREATE_ALWAYS = 0, 20 SHORTCUT_CREATE_ALWAYS = 0,
20 // Overwrite an existing shortcut (fails if the shortcut doesn't exist). 21 // Overwrite an existing shortcut (fails if the shortcut doesn't exist).
21 // If the arguments are not specified on the new shortcut, keep the old 22 // If the arguments are not specified on the new shortcut, keep the old
22 // shortcut's arguments. 23 // shortcut's arguments.
23 SHORTCUT_REPLACE_EXISTING, 24 SHORTCUT_REPLACE_EXISTING,
24 // Update specified properties only on an existing shortcut. 25 // Update specified properties only on an existing shortcut.
25 SHORTCUT_UPDATE_EXISTING, 26 SHORTCUT_UPDATE_EXISTING,
26 }; 27 };
27 28
28 // Properties for shortcuts. Properties set will be applied to the shortcut on 29 // Properties for shortcuts. Properties set will be applied to the shortcut on
29 // creation/update, others will be ignored. 30 // creation/update, others will be ignored.
30 // Callers are encouraged to use the setters provided which take care of 31 // Callers are encouraged to use the setters provided which take care of
31 // setting |options| as desired. 32 // setting |options| as desired.
32 struct ShortcutProperties { 33 struct BASE_EXPORT ShortcutProperties {
33 enum IndividualProperties { 34 enum IndividualProperties {
34 PROPERTIES_TARGET = 1U << 0, 35 PROPERTIES_TARGET = 1U << 0,
35 PROPERTIES_WORKING_DIR = 1U << 1, 36 PROPERTIES_WORKING_DIR = 1U << 1,
36 PROPERTIES_ARGUMENTS = 1U << 2, 37 PROPERTIES_ARGUMENTS = 1U << 2,
37 PROPERTIES_DESCRIPTION = 1U << 3, 38 PROPERTIES_DESCRIPTION = 1U << 3,
38 PROPERTIES_ICON = 1U << 4, 39 PROPERTIES_ICON = 1U << 4,
39 PROPERTIES_APP_ID = 1U << 5, 40 PROPERTIES_APP_ID = 1U << 5,
40 PROPERTIES_DUAL_MODE = 1U << 6, 41 PROPERTIES_DUAL_MODE = 1U << 6,
41 // Be sure to update the values below when adding a new property. 42 // Be sure to update the values below when adding a new property.
42 PROPERTIES_BASIC = PROPERTIES_TARGET | 43 PROPERTIES_BASIC = PROPERTIES_TARGET |
43 PROPERTIES_WORKING_DIR | 44 PROPERTIES_WORKING_DIR |
44 PROPERTIES_ARGUMENTS | 45 PROPERTIES_ARGUMENTS |
45 PROPERTIES_DESCRIPTION | 46 PROPERTIES_DESCRIPTION |
46 PROPERTIES_ICON, 47 PROPERTIES_ICON,
47 PROPERTIES_WIN7 = PROPERTIES_APP_ID | PROPERTIES_DUAL_MODE, 48 PROPERTIES_WIN7 = PROPERTIES_APP_ID | PROPERTIES_DUAL_MODE,
48 PROPERTIES_ALL = PROPERTIES_BASIC | PROPERTIES_WIN7 49 PROPERTIES_ALL = PROPERTIES_BASIC | PROPERTIES_WIN7
49 }; 50 };
50 51
51 ShortcutProperties() : icon_index(-1), dual_mode(false), options(0U) {} 52 ShortcutProperties();
53 ~ShortcutProperties();
52 54
53 void set_target(const FilePath& target_in) { 55 void set_target(const FilePath& target_in) {
54 target = target_in; 56 target = target_in;
55 options |= PROPERTIES_TARGET; 57 options |= PROPERTIES_TARGET;
56 } 58 }
57 59
58 void set_working_dir(const FilePath& working_dir_in) { 60 void set_working_dir(const FilePath& working_dir_in) {
59 working_dir = working_dir_in; 61 working_dir = working_dir_in;
60 options |= PROPERTIES_WORKING_DIR; 62 options |= PROPERTIES_WORKING_DIR;
61 } 63 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 159
158 // Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and 160 // Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and
159 // already be pinned to the taskbar. The app id of the shortcut is used as the 161 // already be pinned to the taskbar. The app id of the shortcut is used as the
160 // identifier for the taskbar item to remove and must be set correctly. 162 // identifier for the taskbar item to remove and must be set correctly.
161 BASE_EXPORT bool TaskbarUnpinShortcutLink(const wchar_t* shortcut); 163 BASE_EXPORT bool TaskbarUnpinShortcutLink(const wchar_t* shortcut);
162 164
163 } // namespace win 165 } // namespace win
164 } // namespace base 166 } // namespace base
165 167
166 #endif // BASE_WIN_SHORTCUT_H_ 168 #endif // BASE_WIN_SHORTCUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698