OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // ============================================================================= | 5 // ============================================================================= |
6 // PLEASE READ | 6 // PLEASE READ |
7 // | 7 // |
8 // In general, you should not be adding stuff to this file. | 8 // In general, you should not be adding stuff to this file. |
9 // | 9 // |
10 // - If your thing is only used in one place, just put it in a reasonable | 10 // - If your thing is only used in one place, just put it in a reasonable |
11 // location in or near that one place. It's nice you want people to be able | 11 // location in or near that one place. It's nice you want people to be able |
12 // to re-use your function, but realistically, if it hasn't been necessary | 12 // to re-use your function, but realistically, if it hasn't been necessary |
13 // before after so many years of development, it's probably not going to be | 13 // before after so many years of development, it's probably not going to be |
14 // used in other places in the future unless you know of them now. | 14 // used in other places in the future unless you know of them now. |
15 // | 15 // |
16 // - If your thing is used by multiple callers and is UI-related, it should | 16 // - If your thing is used by multiple callers and is UI-related, it should |
17 // probably be in app/win/ instead. Try to put it in the most specific file | 17 // probably be in app/win/ instead. Try to put it in the most specific file |
18 // possible (avoiding the *_util files when practical). | 18 // possible (avoiding the *_util files when practical). |
19 // | 19 // |
20 // ============================================================================= | 20 // ============================================================================= |
21 | 21 |
22 #ifndef BASE_WIN_WIN_UTIL_H_ | 22 #ifndef BASE_WIN_WIN_UTIL_H_ |
23 #define BASE_WIN_WIN_UTIL_H_ | 23 #define BASE_WIN_WIN_UTIL_H_ |
24 #pragma once | 24 #pragma once |
25 | 25 |
26 #include <windows.h> | 26 #include <windows.h> |
27 | 27 |
28 #include <string> | 28 #include <string> |
29 | 29 |
30 #include "base/base_api.h" | 30 #include "base/base_export.h" |
31 #include "base/string16.h" | 31 #include "base/string16.h" |
32 | 32 |
33 struct IPropertyStore; | 33 struct IPropertyStore; |
34 struct _tagpropertykey; | 34 struct _tagpropertykey; |
35 typedef _tagpropertykey PROPERTYKEY; | 35 typedef _tagpropertykey PROPERTYKEY; |
36 | 36 |
37 namespace base { | 37 namespace base { |
38 namespace win { | 38 namespace win { |
39 | 39 |
40 BASE_API void GetNonClientMetrics(NONCLIENTMETRICS* metrics); | 40 BASE_EXPORT void GetNonClientMetrics(NONCLIENTMETRICS* metrics); |
41 | 41 |
42 // Returns the string representing the current user sid. | 42 // Returns the string representing the current user sid. |
43 BASE_API bool GetUserSidString(std::wstring* user_sid); | 43 BASE_EXPORT bool GetUserSidString(std::wstring* user_sid); |
44 | 44 |
45 // Returns true if the shift key is currently pressed. | 45 // Returns true if the shift key is currently pressed. |
46 BASE_API bool IsShiftPressed(); | 46 BASE_EXPORT bool IsShiftPressed(); |
47 | 47 |
48 // Returns true if the ctrl key is currently pressed. | 48 // Returns true if the ctrl key is currently pressed. |
49 BASE_API bool IsCtrlPressed(); | 49 BASE_EXPORT bool IsCtrlPressed(); |
50 | 50 |
51 // Returns true if the alt key is currently pressed. | 51 // Returns true if the alt key is currently pressed. |
52 BASE_API bool IsAltPressed(); | 52 BASE_EXPORT bool IsAltPressed(); |
53 | 53 |
54 // Returns false if user account control (UAC) has been disabled with the | 54 // Returns false if user account control (UAC) has been disabled with the |
55 // EnableLUA registry flag. Returns true if user account control is enabled. | 55 // EnableLUA registry flag. Returns true if user account control is enabled. |
56 // NOTE: The EnableLUA registry flag, which is ignored on Windows XP | 56 // NOTE: The EnableLUA registry flag, which is ignored on Windows XP |
57 // machines, might still exist and be set to 0 (UAC disabled), in which case | 57 // machines, might still exist and be set to 0 (UAC disabled), in which case |
58 // this function will return false. You should therefore check this flag only | 58 // this function will return false. You should therefore check this flag only |
59 // if the OS is Vista or later. | 59 // if the OS is Vista or later. |
60 BASE_API bool UserAccountControlIsEnabled(); | 60 BASE_EXPORT bool UserAccountControlIsEnabled(); |
61 | 61 |
62 // Sets the application id in given IPropertyStore. The function is intended | 62 // Sets the application id in given IPropertyStore. The function is intended |
63 // for tagging application/chromium shortcut, browser window and jump list for | 63 // for tagging application/chromium shortcut, browser window and jump list for |
64 // Win7. | 64 // Win7. |
65 BASE_API bool SetAppIdForPropertyStore(IPropertyStore* property_store, | 65 BASE_EXPORT bool SetAppIdForPropertyStore(IPropertyStore* property_store, |
66 const wchar_t* app_id); | 66 const wchar_t* app_id); |
67 | 67 |
68 // Adds the specified |command| using the specified |name| to the AutoRun key. | 68 // Adds the specified |command| using the specified |name| to the AutoRun key. |
69 // |root_key| could be HKCU or HKLM or the root of any user hive. | 69 // |root_key| could be HKCU or HKLM or the root of any user hive. |
70 BASE_API bool AddCommandToAutoRun(HKEY root_key, const string16& name, | 70 BASE_EXPORT bool AddCommandToAutoRun(HKEY root_key, const string16& name, |
71 const string16& command); | 71 const string16& command); |
72 // Removes the command specified by |name| from the AutoRun key. |root_key| | 72 // Removes the command specified by |name| from the AutoRun key. |root_key| |
73 // could be HKCU or HKLM or the root of any user hive. | 73 // could be HKCU or HKLM or the root of any user hive. |
74 BASE_API bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name); | 74 BASE_EXPORT bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name); |
75 | 75 |
76 // Reads the command specified by |name| from the AutoRun key. |root_key| | 76 // Reads the command specified by |name| from the AutoRun key. |root_key| |
77 // could be HKCU or HKLM or the root of any user hive. Used for unit-tests. | 77 // could be HKCU or HKLM or the root of any user hive. Used for unit-tests. |
78 BASE_API bool ReadCommandFromAutoRun(HKEY root_key, | 78 BASE_EXPORT bool ReadCommandFromAutoRun(HKEY root_key, |
79 const string16& name, | 79 const string16& name, |
80 string16* command); | 80 string16* command); |
| 81 |
81 } // namespace win | 82 } // namespace win |
82 } // namespace base | 83 } // namespace base |
83 | 84 |
84 #endif // BASE_WIN_WIN_UTIL_H_ | 85 #endif // BASE_WIN_WIN_UTIL_H_ |
OLD | NEW |