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

Side by Side Diff: base/win_util.cc

Issue 28128: Fix all places where we used the GetWinVersion function... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_util.h" 5 #include "base/win_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <sddl.h> 8 #include <sddl.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/registry.h" 11 #include "base/registry.h"
12 #include "base/scoped_handle.h" 12 #include "base/scoped_handle.h"
13 #include "base/singleton.h" 13 #include "base/singleton.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/tracked.h" 15 #include "base/tracked.h"
16 16
17 namespace win_util { 17 namespace win_util {
18 18
19 #define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(struct_name, member) \ 19 #define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(struct_name, member) \
20 offsetof(struct_name, member) + \ 20 offsetof(struct_name, member) + \
21 (sizeof static_cast<struct_name*>(NULL)->member) 21 (sizeof static_cast<struct_name*>(NULL)->member)
22 #define NONCLIENTMETRICS_SIZE_PRE_VISTA \ 22 #define NONCLIENTMETRICS_SIZE_PRE_VISTA \
23 SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(NONCLIENTMETRICS, lfMessageFont) 23 SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(NONCLIENTMETRICS, lfMessageFont)
24 24
25 void GetNonClientMetrics(NONCLIENTMETRICS* metrics) { 25 void GetNonClientMetrics(NONCLIENTMETRICS* metrics) {
26 DCHECK(metrics); 26 DCHECK(metrics);
27 27
28 static const UINT SIZEOF_NONCLIENTMETRICS = 28 static const UINT SIZEOF_NONCLIENTMETRICS =
29 (GetWinVersion() == WINVERSION_VISTA) ? 29 (GetWinVersion() >= WINVERSION_VISTA) ?
30 sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA; 30 sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA;
31 metrics->cbSize = SIZEOF_NONCLIENTMETRICS; 31 metrics->cbSize = SIZEOF_NONCLIENTMETRICS;
32 const bool success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 32 const bool success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
33 SIZEOF_NONCLIENTMETRICS, metrics, 33 SIZEOF_NONCLIENTMETRICS, metrics,
34 0); 34 0);
35 DCHECK(success); 35 DCHECK(success);
36 } 36 }
37 37
38 WinVersion GetWinVersion() { 38 WinVersion GetWinVersion() {
39 static bool checked_version = false; 39 static bool checked_version = false;
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 #ifndef COPY_FILE_COPY_SYMLINK 452 #ifndef COPY_FILE_COPY_SYMLINK
453 #error You must install the Windows 2008 or Vista Software Development Kit and \ 453 #error You must install the Windows 2008 or Vista Software Development Kit and \
454 set it as your default include path to build this library. You can grab it by \ 454 set it as your default include path to build this library. You can grab it by \
455 searching for "download windows sdk 2008" in your favorite web search engine. \ 455 searching for "download windows sdk 2008" in your favorite web search engine. \
456 Also make sure you register the SDK with Visual Studio, by selecting \ 456 Also make sure you register the SDK with Visual Studio, by selecting \
457 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ 457 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \
458 menu (see Start - All Programs - Microsoft Windows SDK - \ 458 menu (see Start - All Programs - Microsoft Windows SDK - \
459 Visual Studio Registration). 459 Visual Studio Registration).
460 #endif 460 #endif
OLDNEW
« no previous file with comments | « no previous file | base/win_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698