Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(755)

Side by Side Diff: base/win/win_util.cc

Issue 681713002: Update from chromium https://crrev.com/301315 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/win/win_util.h ('k') | base/win/win_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/win/win_util.h" 5 #include "base/win/win_util.h"
6 6
7 #include <aclapi.h> 7 #include <aclapi.h>
8 #include <cfgmgr32.h> 8 #include <cfgmgr32.h>
9 #include <lm.h> 9 #include <lm.h>
10 #include <powrprof.h> 10 #include <powrprof.h>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return keyboard_count > 1; 112 return keyboard_count > 1;
113 } 113 }
114 114
115 } // namespace 115 } // namespace
116 116
117 namespace base { 117 namespace base {
118 namespace win { 118 namespace win {
119 119
120 static bool g_crash_on_process_detach = false; 120 static bool g_crash_on_process_detach = false;
121 121
122 #define NONCLIENTMETRICS_SIZE_PRE_VISTA \ 122 void GetNonClientMetrics(NONCLIENTMETRICS_XP* metrics) {
123 SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(NONCLIENTMETRICS, lfMessageFont)
124
125 void GetNonClientMetrics(NONCLIENTMETRICS* metrics) {
126 DCHECK(metrics); 123 DCHECK(metrics);
127 124 metrics->cbSize = sizeof(*metrics);
128 static const UINT SIZEOF_NONCLIENTMETRICS = 125 const bool success = !!SystemParametersInfo(
129 (base::win::GetVersion() >= base::win::VERSION_VISTA) ? 126 SPI_GETNONCLIENTMETRICS,
130 sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA; 127 metrics->cbSize,
131 metrics->cbSize = SIZEOF_NONCLIENTMETRICS; 128 reinterpret_cast<NONCLIENTMETRICS*>(metrics),
132 const bool success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 129 0);
133 SIZEOF_NONCLIENTMETRICS, metrics,
134 0);
135 DCHECK(success); 130 DCHECK(success);
136 } 131 }
137 132
138 bool GetUserSidString(std::wstring* user_sid) { 133 bool GetUserSidString(std::wstring* user_sid) {
139 // Get the current token. 134 // Get the current token.
140 HANDLE token = NULL; 135 HANDLE token = NULL;
141 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) 136 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
142 return false; 137 return false;
143 base::win::ScopedHandle token_scoped(token); 138 base::win::ScopedHandle token_scoped(token);
144 139
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 #if defined(_MSC_FULL_VER) 467 #if defined(_MSC_FULL_VER)
473 #pragma message(__PPOUT__(_MSC_FULL_VER)) 468 #pragma message(__PPOUT__(_MSC_FULL_VER))
474 #endif 469 #endif
475 470
476 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1") 471 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1")
477 #error Must install Update 1 to Visual Studio 2012. 472 #error Must install Update 1 to Visual Studio 2012.
478 #endif 473 #endif
479 474
480 #endif // _MSC_VER 475 #endif // _MSC_VER
481 476
OLDNEW
« no previous file with comments | « base/win/win_util.h ('k') | base/win/win_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698