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