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

Side by Side Diff: app/win_util.cc

Issue 3823002: Move windows version-related stuff out of base/win_util and into base/win/win... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2009 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 #include "app/win_util.h" 5 #include "app/win_util.h"
6 6
7 #include <commdlg.h> 7 #include <commdlg.h>
8 #include <dwmapi.h> 8 #include <dwmapi.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
11 11
12 #include <algorithm> 12 #include <algorithm>
13 13
14 #include "app/l10n_util.h" 14 #include "app/l10n_util.h"
15 #include "app/l10n_util_win.h" 15 #include "app/l10n_util_win.h"
16 #include "base/base_switches.h" 16 #include "base/base_switches.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/file_util.h" 18 #include "base/file_util.h"
19 #include "base/i18n/rtl.h" 19 #include "base/i18n/rtl.h"
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/native_library.h" 21 #include "base/native_library.h"
22 #include "base/scoped_comptr_win.h" 22 #include "base/scoped_comptr_win.h"
23 #include "base/scoped_handle.h" 23 #include "base/scoped_handle.h"
24 #include "base/scoped_handle_win.h" 24 #include "base/scoped_handle_win.h"
25 #include "base/string_util.h" 25 #include "base/string_util.h"
26 #include "base/win_util.h" 26 #include "base/win_util.h"
27 #include "base/win/windows_version.h"
27 #include "gfx/codec/png_codec.h" 28 #include "gfx/codec/png_codec.h"
28 #include "gfx/gdi_util.h" 29 #include "gfx/gdi_util.h"
29 30
30 // Ensure that we pick up this link library. 31 // Ensure that we pick up this link library.
31 #pragma comment(lib, "dwmapi.lib") 32 #pragma comment(lib, "dwmapi.lib")
32 33
33 namespace win_util { 34 namespace win_util {
34 35
35 const int kAutoHideTaskbarThicknessPx = 2; 36 const int kAutoHideTaskbarThicknessPx = 2;
36 37
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 93
93 bool IsDrag(const POINT& origin, const POINT& current) { 94 bool IsDrag(const POINT& origin, const POINT& current) {
94 // The CXDRAG and CYDRAG system metrics describe the width and height of a 95 // The CXDRAG and CYDRAG system metrics describe the width and height of a
95 // rectangle around the origin position, inside of which motion is not 96 // rectangle around the origin position, inside of which motion is not
96 // considered a drag. 97 // considered a drag.
97 return (abs(current.x - origin.x) > (GetSystemMetrics(SM_CXDRAG) / 2)) || 98 return (abs(current.x - origin.x) > (GetSystemMetrics(SM_CXDRAG) / 2)) ||
98 (abs(current.y - origin.y) > (GetSystemMetrics(SM_CYDRAG) / 2)); 99 (abs(current.y - origin.y) > (GetSystemMetrics(SM_CYDRAG) / 2));
99 } 100 }
100 101
101 bool ShouldUseVistaFrame() { 102 bool ShouldUseVistaFrame() {
102 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) 103 if (base::win::GetVersion() < base::win::VERSION_VISTA)
103 return false; 104 return false;
104 // If composition is not enabled, we behave like on XP. 105 // If composition is not enabled, we behave like on XP.
105 BOOL f; 106 BOOL f;
106 DwmIsCompositionEnabled(&f); 107 DwmIsCompositionEnabled(&f);
107 return !!f; 108 return !!f;
108 } 109 }
109 110
110 // Open an item via a shell execute command. Error code checking and casting 111 // Open an item via a shell execute command. Error code checking and casting
111 // explanation: http://msdn2.microsoft.com/en-us/library/ms647732.aspx 112 // explanation: http://msdn2.microsoft.com/en-us/library/ms647732.aspx
112 bool OpenItemViaShell(const FilePath& full_path) { 113 bool OpenItemViaShell(const FilePath& full_path) {
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 gfx::Font GetWindowTitleFont() { 539 gfx::Font GetWindowTitleFont() {
539 NONCLIENTMETRICS ncm; 540 NONCLIENTMETRICS ncm;
540 win_util::GetNonClientMetrics(&ncm); 541 win_util::GetNonClientMetrics(&ncm);
541 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); 542 l10n_util::AdjustUIFont(&(ncm.lfCaptionFont));
542 ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 543 ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
543 return gfx::Font(caption_font); 544 return gfx::Font(caption_font);
544 } 545 }
545 546
546 void SetAppIdForWindow(const std::wstring& app_id, HWND hwnd) { 547 void SetAppIdForWindow(const std::wstring& app_id, HWND hwnd) {
547 // This functionality is only available on Win7+. 548 // This functionality is only available on Win7+.
548 if (win_util::GetWinVersion() < win_util::WINVERSION_WIN7) 549 if (base::win::GetVersion() < base::win::VERSION_WIN7)
549 return; 550 return;
550 551
551 // Load Shell32.dll into memory. 552 // Load Shell32.dll into memory.
552 // TODO(brg): Remove this mechanism when the Win7 SDK is available in trunk. 553 // TODO(brg): Remove this mechanism when the Win7 SDK is available in trunk.
553 std::wstring shell32_filename(kShell32); 554 std::wstring shell32_filename(kShell32);
554 FilePath shell32_filepath(shell32_filename); 555 FilePath shell32_filepath(shell32_filename);
555 base::NativeLibrary shell32_library = base::LoadNativeLibrary( 556 base::NativeLibrary shell32_library = base::LoadNativeLibrary(
556 shell32_filepath); 557 shell32_filepath);
557 558
558 if (!shell32_library) 559 if (!shell32_library)
(...skipping 16 matching lines...) Expand all
575 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); 576 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive()));
576 if (S_OK == result) { 577 if (S_OK == result) {
577 SetAppIdForPropertyStore(pps, app_id.c_str()); 578 SetAppIdForPropertyStore(pps, app_id.c_str());
578 } 579 }
579 580
580 // Cleanup. 581 // Cleanup.
581 base::UnloadNativeLibrary(shell32_library); 582 base::UnloadNativeLibrary(shell32_library);
582 } 583 }
583 584
584 } // namespace win_util 585 } // namespace win_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698