| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // setting |options| as desired. | 71 // setting |options| as desired. |
| 72 struct ShortcutProperties { | 72 struct ShortcutProperties { |
| 73 enum IndividualProperties { | 73 enum IndividualProperties { |
| 74 PROPERTIES_TARGET = 1 << 0, | 74 PROPERTIES_TARGET = 1 << 0, |
| 75 PROPERTIES_ARGUMENTS = 1 << 1, | 75 PROPERTIES_ARGUMENTS = 1 << 1, |
| 76 PROPERTIES_DESCRIPTION = 1 << 2, | 76 PROPERTIES_DESCRIPTION = 1 << 2, |
| 77 PROPERTIES_ICON = 1 << 3, | 77 PROPERTIES_ICON = 1 << 3, |
| 78 PROPERTIES_APP_ID = 1 << 4, | 78 PROPERTIES_APP_ID = 1 << 4, |
| 79 PROPERTIES_SHORTCUT_NAME = 1 << 5, | 79 PROPERTIES_SHORTCUT_NAME = 1 << 5, |
| 80 PROPERTIES_DUAL_MODE = 1 << 6, | 80 PROPERTIES_DUAL_MODE = 1 << 6, |
| 81 PROPERTIES_HOTKEY = 1 << 7, |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 explicit ShortcutProperties(ShellChange level_in) | 84 explicit ShortcutProperties(ShellChange level_in) |
| 84 : level(level_in), icon_index(0), dual_mode(false), | 85 : level(level_in), icon_index(0), dual_mode(false), |
| 85 pin_to_taskbar(false), options(0U) {} | 86 pin_to_taskbar(false), hotkey(0), options(0U) {} |
| 86 | 87 |
| 87 // Sets the target executable to launch from this shortcut. | 88 // Sets the target executable to launch from this shortcut. |
| 88 // This is mandatory when creating a shortcut. | 89 // This is mandatory when creating a shortcut. |
| 89 void set_target(const base::FilePath& target_in) { | 90 void set_target(const base::FilePath& target_in) { |
| 90 target = target_in; | 91 target = target_in; |
| 91 options |= PROPERTIES_TARGET; | 92 options |= PROPERTIES_TARGET; |
| 92 } | 93 } |
| 93 | 94 |
| 94 // Sets the arguments to be passed to |target| when launching from this | 95 // Sets the arguments to be passed to |target| when launching from this |
| 95 // shortcut. | 96 // shortcut. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 options |= PROPERTIES_DUAL_MODE; | 144 options |= PROPERTIES_DUAL_MODE; |
| 144 } | 145 } |
| 145 | 146 |
| 146 // Sets whether to pin this shortcut to the taskbar after creating it | 147 // Sets whether to pin this shortcut to the taskbar after creating it |
| 147 // (ignored if the shortcut is only being updated). | 148 // (ignored if the shortcut is only being updated). |
| 148 // Note: This property doesn't have a mask in |options|. | 149 // Note: This property doesn't have a mask in |options|. |
| 149 void set_pin_to_taskbar(bool pin_to_taskbar_in) { | 150 void set_pin_to_taskbar(bool pin_to_taskbar_in) { |
| 150 pin_to_taskbar = pin_to_taskbar_in; | 151 pin_to_taskbar = pin_to_taskbar_in; |
| 151 } | 152 } |
| 152 | 153 |
| 154 void set_hotkey(int hotkey_in) { |
| 155 hotkey = hotkey_in; |
| 156 options |= PROPERTIES_HOTKEY; |
| 157 } |
| 158 |
| 153 bool has_target() const { | 159 bool has_target() const { |
| 154 return (options & PROPERTIES_TARGET) != 0; | 160 return (options & PROPERTIES_TARGET) != 0; |
| 155 } | 161 } |
| 156 | 162 |
| 157 bool has_arguments() const { | 163 bool has_arguments() const { |
| 158 return (options & PROPERTIES_ARGUMENTS) != 0; | 164 return (options & PROPERTIES_ARGUMENTS) != 0; |
| 159 } | 165 } |
| 160 | 166 |
| 161 bool has_description() const { | 167 bool has_description() const { |
| 162 return (options & PROPERTIES_DESCRIPTION) != 0; | 168 return (options & PROPERTIES_DESCRIPTION) != 0; |
| 163 } | 169 } |
| 164 | 170 |
| 165 bool has_icon() const { | 171 bool has_icon() const { |
| 166 return (options & PROPERTIES_ICON) != 0; | 172 return (options & PROPERTIES_ICON) != 0; |
| 167 } | 173 } |
| 168 | 174 |
| 169 bool has_app_id() const { | 175 bool has_app_id() const { |
| 170 return (options & PROPERTIES_APP_ID) != 0; | 176 return (options & PROPERTIES_APP_ID) != 0; |
| 171 } | 177 } |
| 172 | 178 |
| 173 bool has_shortcut_name() const { | 179 bool has_shortcut_name() const { |
| 174 return (options & PROPERTIES_SHORTCUT_NAME) != 0; | 180 return (options & PROPERTIES_SHORTCUT_NAME) != 0; |
| 175 } | 181 } |
| 176 | 182 |
| 177 bool has_dual_mode() const { | 183 bool has_dual_mode() const { |
| 178 return (options & PROPERTIES_DUAL_MODE) != 0; | 184 return (options & PROPERTIES_DUAL_MODE) != 0; |
| 179 } | 185 } |
| 180 | 186 |
| 187 bool has_hotkey() const { |
| 188 return (options & PROPERTIES_HOTKEY) != 0; |
| 189 } |
| 181 // The level to install this shortcut at (CURRENT_USER for a per-user | 190 // The level to install this shortcut at (CURRENT_USER for a per-user |
| 182 // shortcut and SYSTEM_LEVEL for an all-users shortcut). | 191 // shortcut and SYSTEM_LEVEL for an all-users shortcut). |
| 183 ShellChange level; | 192 ShellChange level; |
| 184 | 193 |
| 185 base::FilePath target; | 194 base::FilePath target; |
| 186 string16 arguments; | 195 string16 arguments; |
| 187 string16 description; | 196 string16 description; |
| 188 base::FilePath icon; | 197 base::FilePath icon; |
| 189 int icon_index; | 198 int icon_index; |
| 190 string16 app_id; | 199 string16 app_id; |
| 191 string16 shortcut_name; | 200 string16 shortcut_name; |
| 192 bool dual_mode; | 201 bool dual_mode; |
| 193 bool pin_to_taskbar; | 202 bool pin_to_taskbar; |
| 203 int hotkey; |
| 194 // Bitfield made of IndividualProperties. Properties set in |options| will | 204 // Bitfield made of IndividualProperties. Properties set in |options| will |
| 195 // be used to create/update the shortcut, others will be ignored on update | 205 // be used to create/update the shortcut, others will be ignored on update |
| 196 // and possibly replaced by default values on create (see individual | 206 // and possibly replaced by default values on create (see individual |
| 197 // property setters above for details on default values). | 207 // property setters above for details on default values). |
| 198 uint32 options; | 208 uint32 options; |
| 199 }; | 209 }; |
| 200 | 210 |
| 201 // Relative path of the URL Protocol registry entry (prefixed with '\'). | 211 // Relative path of the URL Protocol registry entry (prefixed with '\'). |
| 202 static const wchar_t* kRegURLProtocol; | 212 static const wchar_t* kRegURLProtocol; |
| 203 | 213 |
| (...skipping 357 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 | 571 // required by the base32 standard for inputs that aren't a multiple of 5 |
| 562 // bytes. | 572 // bytes. |
| 563 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); | 573 static string16 ByteArrayToBase32(const uint8* bytes, size_t size); |
| 564 | 574 |
| 565 private: | 575 private: |
| 566 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 576 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
| 567 }; | 577 }; |
| 568 | 578 |
| 569 | 579 |
| 570 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 580 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
| OLD | NEW |