OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_UTIL_H__ | 5 #ifndef BASE_WIN_UTIL_H__ |
6 #define BASE_WIN_UTIL_H__ | 6 #define BASE_WIN_UTIL_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
| 13 #include "base/keyboard_codes.h" |
13 #include "base/string16.h" | 14 #include "base/string16.h" |
14 | 15 |
15 struct IPropertyStore; | 16 struct IPropertyStore; |
16 struct _tagpropertykey; | 17 struct _tagpropertykey; |
17 typedef _tagpropertykey PROPERTYKEY; | 18 typedef _tagpropertykey PROPERTYKEY; |
18 | 19 |
19 namespace win_util { | 20 namespace win_util { |
20 | 21 |
21 // NOTE: Keep these in order so callers can do things like | 22 // NOTE: Keep these in order so callers can do things like |
22 // "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values, | 23 // "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // if the OS is Vista. | 109 // if the OS is Vista. |
109 bool UserAccountControlIsEnabled(); | 110 bool UserAccountControlIsEnabled(); |
110 | 111 |
111 // Use the Win32 API FormatMessage() function to generate a string, using | 112 // Use the Win32 API FormatMessage() function to generate a string, using |
112 // Windows's default Message Compiled resources; ignoring the inserts. | 113 // Windows's default Message Compiled resources; ignoring the inserts. |
113 std::wstring FormatMessage(unsigned messageid); | 114 std::wstring FormatMessage(unsigned messageid); |
114 | 115 |
115 // Uses the last Win32 error to generate a human readable message string. | 116 // Uses the last Win32 error to generate a human readable message string. |
116 std::wstring FormatLastWin32Error(); | 117 std::wstring FormatLastWin32Error(); |
117 | 118 |
| 119 // Methods to convert base::KeyboardCode/Windows virtual key type methods. |
| 120 WORD KeyboardCodeToWin(base::KeyboardCode keycode); |
| 121 base::KeyboardCode WinToKeyboardCode(WORD keycode); |
| 122 |
118 // Sets the application id in given IPropertyStore. The function is intended | 123 // Sets the application id in given IPropertyStore. The function is intended |
119 // for tagging application/chromium shortcut, browser window and jump list for | 124 // for tagging application/chromium shortcut, browser window and jump list for |
120 // Win7. | 125 // Win7. |
121 bool SetAppIdForPropertyStore(IPropertyStore* property_store, | 126 bool SetAppIdForPropertyStore(IPropertyStore* property_store, |
122 const wchar_t* app_id); | 127 const wchar_t* app_id); |
123 | 128 |
124 // Adds the specified |command| using the specified |name| to the AutoRun key. | 129 // Adds the specified |command| using the specified |name| to the AutoRun key. |
125 // |root_key| could be HKCU or HKLM or the root of any user hive. | 130 // |root_key| could be HKCU or HKLM or the root of any user hive. |
126 bool AddCommandToAutoRun(HKEY root_key, const string16& name, | 131 bool AddCommandToAutoRun(HKEY root_key, const string16& name, |
127 const string16& command); | 132 const string16& command); |
128 // Removes the command specified by |name| from the AutoRun key. |root_key| | 133 // Removes the command specified by |name| from the AutoRun key. |root_key| |
129 // could be HKCU or HKLM or the root of any user hive. | 134 // could be HKCU or HKLM or the root of any user hive. |
130 bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name); | 135 bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name); |
131 | 136 |
132 } // namespace win_util | 137 } // namespace win_util |
133 | 138 |
134 #endif // BASE_WIN_UTIL_H__ | 139 #endif // BASE_WIN_UTIL_H__ |
OLD | NEW |