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_ |
11 | 11 |
12 #include <windows.h> | 12 #include <windows.h> |
| 13 #include <stddef.h> |
| 14 #include <stdint.h> |
13 | 15 |
14 #include <map> | 16 #include <map> |
15 #include <set> | 17 #include <set> |
16 #include <utility> | 18 #include <utility> |
17 #include <vector> | 19 #include <vector> |
18 | 20 |
19 #include "base/basictypes.h" | |
20 #include "base/files/file_path.h" | 21 #include "base/files/file_path.h" |
21 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/macros.h" |
22 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
23 #include "base/memory/scoped_vector.h" | 25 #include "base/memory/scoped_vector.h" |
24 #include "base/strings/string16.h" | 26 #include "base/strings/string16.h" |
25 #include "chrome/installer/util/work_item_list.h" | 27 #include "chrome/installer/util/work_item_list.h" |
26 | 28 |
27 class BrowserDistribution; | 29 class BrowserDistribution; |
28 class RegistryEntry; | 30 class RegistryEntry; |
29 | 31 |
30 namespace base { | 32 namespace base { |
31 class CancellationFlag; | 33 class CancellationFlag; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 base::FilePath icon; | 205 base::FilePath icon; |
204 int icon_index; | 206 int icon_index; |
205 base::string16 app_id; | 207 base::string16 app_id; |
206 base::string16 shortcut_name; | 208 base::string16 shortcut_name; |
207 bool dual_mode; | 209 bool dual_mode; |
208 bool pin_to_taskbar; | 210 bool pin_to_taskbar; |
209 // Bitfield made of IndividualProperties. Properties set in |options| will | 211 // Bitfield made of IndividualProperties. Properties set in |options| will |
210 // be used to create/update the shortcut, others will be ignored on update | 212 // be used to create/update the shortcut, others will be ignored on update |
211 // and possibly replaced by default values on create (see individual | 213 // and possibly replaced by default values on create (see individual |
212 // property setters above for details on default values). | 214 // property setters above for details on default values). |
213 uint32 options; | 215 uint32_t options; |
214 }; | 216 }; |
215 | 217 |
216 // Relative path of the URL Protocol registry entry (prefixed with '\'). | 218 // Relative path of the URL Protocol registry entry (prefixed with '\'). |
217 static const wchar_t* kRegURLProtocol; | 219 static const wchar_t* kRegURLProtocol; |
218 | 220 |
219 // Relative path of DefaultIcon registry entry (prefixed with '\'). | 221 // Relative path of DefaultIcon registry entry (prefixed with '\'). |
220 static const wchar_t* kRegDefaultIcon; | 222 static const wchar_t* kRegDefaultIcon; |
221 | 223 |
222 // Relative path of "shell" registry key. | 224 // Relative path of "shell" registry key. |
223 static const wchar_t* kRegShellPath; | 225 static const wchar_t* kRegShellPath; |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 // Returns true unless the OS call to retrieve the username fails. | 611 // Returns true unless the OS call to retrieve the username fails. |
610 // NOTE: Only the installer should use this suffix directly. Other callers | 612 // NOTE: Only the installer should use this suffix directly. Other callers |
611 // should call GetCurrentInstallationSuffix(). | 613 // should call GetCurrentInstallationSuffix(). |
612 static bool GetOldUserSpecificRegistrySuffix(base::string16* suffix); | 614 static bool GetOldUserSpecificRegistrySuffix(base::string16* suffix); |
613 | 615 |
614 // Returns the base32 encoding (using the [A-Z2-7] alphabet) of |bytes|. | 616 // Returns the base32 encoding (using the [A-Z2-7] alphabet) of |bytes|. |
615 // |size| is the length of |bytes|. | 617 // |size| is the length of |bytes|. |
616 // Note: This method does not suffix the output with '=' signs as technically | 618 // Note: This method does not suffix the output with '=' signs as technically |
617 // required by the base32 standard for inputs that aren't a multiple of 5 | 619 // required by the base32 standard for inputs that aren't a multiple of 5 |
618 // bytes. | 620 // bytes. |
619 static base::string16 ByteArrayToBase32(const uint8* bytes, size_t size); | 621 static base::string16 ByteArrayToBase32(const uint8_t* bytes, size_t size); |
620 | 622 |
621 // Associates a set of file extensions with a particular application in the | 623 // Associates a set of file extensions with a particular application in the |
622 // Windows registry, for the current user only. If an extension has no | 624 // Windows registry, for the current user only. If an extension has no |
623 // existing default association, the given application becomes the default. | 625 // existing default association, the given application becomes the default. |
624 // Otherwise, the application is added to the Open With menu for this type, | 626 // Otherwise, the application is added to the Open With menu for this type, |
625 // but does not become the default. | 627 // but does not become the default. |
626 // | 628 // |
627 // |prog_id| is the ProgId used by Windows for file associations with this | 629 // |prog_id| is the ProgId used by Windows for file associations with this |
628 // application. Must not be empty or start with a '.'. | 630 // application. Must not be empty or start with a '.'. |
629 // |command_line| is the command to execute when opening a file via this | 631 // |command_line| is the command to execute when opening a file via this |
(...skipping 24 matching lines...) Expand all Loading... |
654 // Set/CreateRegWorkItems and runs them using WorkItemList. | 656 // Set/CreateRegWorkItems and runs them using WorkItemList. |
655 static bool AddRegistryEntries(HKEY root, | 657 static bool AddRegistryEntries(HKEY root, |
656 const ScopedVector<RegistryEntry>& entries); | 658 const ScopedVector<RegistryEntry>& entries); |
657 | 659 |
658 private: | 660 private: |
659 DISALLOW_COPY_AND_ASSIGN(ShellUtil); | 661 DISALLOW_COPY_AND_ASSIGN(ShellUtil); |
660 }; | 662 }; |
661 | 663 |
662 | 664 |
663 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ | 665 #endif // CHROME_INSTALLER_UTIL_SHELL_UTIL_H_ |
OLD | NEW |