~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/chromium/src/base/win/win_util.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
3
 
// found in the LICENSE file.
4
 
 
5
 
// =============================================================================
6
 
// PLEASE READ
7
 
//
8
 
// In general, you should not be adding stuff to this file.
9
 
//
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
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
14
 
//   used in other places in the future unless you know of them now.
15
 
//
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
18
 
//   possible (avoiding the *_util files when practical).
19
 
//
20
 
// =============================================================================
21
 
 
22
 
#ifndef BASE_WIN_WIN_UTIL_H_
23
 
#define BASE_WIN_WIN_UTIL_H_
24
 
 
25
 
#include <windows.h>
26
 
 
27
 
#include <string>
28
 
 
29
 
#include "base/base_export.h"
30
 
#include "base/strings/string16.h"
31
 
 
32
 
struct IPropertyStore;
33
 
struct _tagpropertykey;
34
 
typedef _tagpropertykey PROPERTYKEY;
35
 
 
36
 
namespace base {
37
 
namespace win {
38
 
 
39
 
BASE_EXPORT void GetNonClientMetrics(NONCLIENTMETRICS* metrics);
40
 
 
41
 
// Returns the string representing the current user sid.
42
 
BASE_EXPORT bool GetUserSidString(std::wstring* user_sid);
43
 
 
44
 
// Returns true if the shift key is currently pressed.
45
 
BASE_EXPORT bool IsShiftPressed();
46
 
 
47
 
// Returns true if the ctrl key is currently pressed.
48
 
BASE_EXPORT bool IsCtrlPressed();
49
 
 
50
 
// Returns true if the alt key is currently pressed.
51
 
BASE_EXPORT bool IsAltPressed();
52
 
 
53
 
// Returns true if the altgr key is currently pressed.
54
 
// Windows does not have specific key code and modifier bit and Alt+Ctrl key is
55
 
// used as AltGr key in Windows.
56
 
BASE_EXPORT bool IsAltGrPressed();
57
 
 
58
 
// Returns false if user account control (UAC) has been disabled with the
59
 
// EnableLUA registry flag. Returns true if user account control is enabled.
60
 
// NOTE: The EnableLUA registry flag, which is ignored on Windows XP
61
 
// machines, might still exist and be set to 0 (UAC disabled), in which case
62
 
// this function will return false. You should therefore check this flag only
63
 
// if the OS is Vista or later.
64
 
BASE_EXPORT bool UserAccountControlIsEnabled();
65
 
 
66
 
// Sets the boolean value for a given key in given IPropertyStore.
67
 
BASE_EXPORT bool SetBooleanValueForPropertyStore(
68
 
    IPropertyStore* property_store,
69
 
    const PROPERTYKEY& property_key,
70
 
    bool property_bool_value);
71
 
 
72
 
// Sets the string value for a given key in given IPropertyStore.
73
 
BASE_EXPORT bool SetStringValueForPropertyStore(
74
 
    IPropertyStore* property_store,
75
 
    const PROPERTYKEY& property_key,
76
 
    const wchar_t* property_string_value);
77
 
 
78
 
// Sets the application id in given IPropertyStore. The function is intended
79
 
// for tagging application/chromium shortcut, browser window and jump list for
80
 
// Win7.
81
 
BASE_EXPORT bool SetAppIdForPropertyStore(IPropertyStore* property_store,
82
 
                                          const wchar_t* app_id);
83
 
 
84
 
// Adds the specified |command| using the specified |name| to the AutoRun key.
85
 
// |root_key| could be HKCU or HKLM or the root of any user hive.
86
 
BASE_EXPORT bool AddCommandToAutoRun(HKEY root_key, const string16& name,
87
 
                                     const string16& command);
88
 
// Removes the command specified by |name| from the AutoRun key. |root_key|
89
 
// could be HKCU or HKLM or the root of any user hive.
90
 
BASE_EXPORT bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name);
91
 
 
92
 
// Reads the command specified by |name| from the AutoRun key. |root_key|
93
 
// could be HKCU or HKLM or the root of any user hive. Used for unit-tests.
94
 
BASE_EXPORT bool ReadCommandFromAutoRun(HKEY root_key,
95
 
                                        const string16& name,
96
 
                                        string16* command);
97
 
 
98
 
// Sets whether to crash the process during exit. This is inspected by DLLMain
99
 
// and used to intercept unexpected terminations of the process (via calls to
100
 
// exit(), abort(), _exit(), ExitProcess()) and convert them into crashes.
101
 
// Note that not all mechanisms for terminating the process are covered by
102
 
// this. In particular, TerminateProcess() is not caught.
103
 
BASE_EXPORT void SetShouldCrashOnProcessDetach(bool crash);
104
 
BASE_EXPORT bool ShouldCrashOnProcessDetach();
105
 
 
106
 
// Adjusts the abort behavior so that crash reports can be generated when the
107
 
// process is aborted.
108
 
BASE_EXPORT void SetAbortBehaviorForCrashReporting();
109
 
 
110
 
// A touch enabled device by this definition is something that has
111
 
// integrated multi-touch ready to use and has Windows version > Windows7.
112
 
BASE_EXPORT bool IsTouchEnabledDevice();
113
 
 
114
 
// Get the size of a struct up to and including the specified member.
115
 
// This is necessary to set compatible struct sizes for different versions
116
 
// of certain Windows APIs (e.g. SystemParametersInfo).
117
 
#define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(struct_name, member) \
118
 
    offsetof(struct_name, member) + \
119
 
    (sizeof static_cast<struct_name*>(NULL)->member)
120
 
 
121
 
// Displays the on screen keyboard on Windows 8 and above. Returns true on
122
 
// success.
123
 
BASE_EXPORT bool DisplayVirtualKeyboard();
124
 
 
125
 
// Dismisses the on screen keyboard if it is being displayed on Windows 8 and.
126
 
// above. Returns true on success.
127
 
BASE_EXPORT bool DismissVirtualKeyboard();
128
 
 
129
 
// Returns true if the machine is enrolled to a domain.
130
 
BASE_EXPORT bool IsEnrolledToDomain();
131
 
 
132
 
// Used by tests to mock any wanted state. Call with |state| set to true to
133
 
// simulate being in a domain and false otherwise.
134
 
BASE_EXPORT void SetDomainStateForTesting(bool state);
135
 
 
136
 
}  // namespace win
137
 
}  // namespace base
138
 
 
139
 
#endif  // BASE_WIN_WIN_UTIL_H_