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

Side by Side Diff: chrome/common/win_util.cc

Issue 42027: Make Chromium windows not hide auto-hide taskbars, take 2.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 | « chrome/common/win_util.h ('k') | chrome/views/window.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 "chrome/common/win_util.h" 5 #include "chrome/common/win_util.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlapp.h> 8 #include <atlapp.h>
9 #include <commdlg.h> 9 #include <commdlg.h>
10 #include <dwmapi.h> 10 #include <dwmapi.h>
(...skipping 10 matching lines...) Expand all
21 #include "base/win_util.h" 21 #include "base/win_util.h"
22 #include "chrome/common/l10n_util.h" 22 #include "chrome/common/l10n_util.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "net/base/mime_util.h" 24 #include "net/base/mime_util.h"
25 25
26 // Ensure that we pick up this link library. 26 // Ensure that we pick up this link library.
27 #pragma comment(lib, "dwmapi.lib") 27 #pragma comment(lib, "dwmapi.lib")
28 28
29 namespace win_util { 29 namespace win_util {
30 30
31 const int kAutoHideTaskbarThicknessPx = 2;
32
31 namespace { 33 namespace {
32 34
33 // Enforce visible dialog box. 35 // Enforce visible dialog box.
34 UINT_PTR CALLBACK SaveAsDialogHook(HWND dialog, UINT message, 36 UINT_PTR CALLBACK SaveAsDialogHook(HWND dialog, UINT message,
35 WPARAM wparam, LPARAM lparam) { 37 WPARAM wparam, LPARAM lparam) {
36 static const UINT kPrivateMessage = 0x2F3F; 38 static const UINT kPrivateMessage = 0x2F3F;
37 switch (message) { 39 switch (message) {
38 case WM_INITDIALOG: { 40 case WM_INITDIALOG: {
39 // Do nothing here. Just post a message to defer actual processing. 41 // Do nothing here. Just post a message to defer actual processing.
40 PostMessage(dialog, kPrivateMessage, 0, 0); 42 PostMessage(dialog, kPrivateMessage, 0, 0);
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 SetWindowPos(window, 0, window_bounds.left, window_bounds.top, 619 SetWindowPos(window, 0, window_bounds.left, window_bounds.top,
618 window_bounds.right - window_bounds.left, 620 window_bounds.right - window_bounds.left,
619 window_bounds.bottom - window_bounds.top, 621 window_bounds.bottom - window_bounds.top,
620 SWP_NOACTIVATE | SWP_NOZORDER); 622 SWP_NOACTIVATE | SWP_NOZORDER);
621 } // else case, AdjustWindowToFit set the bounds for us. 623 } // else case, AdjustWindowToFit set the bounds for us.
622 } else { 624 } else {
623 NOTREACHED() << "Unable to adjust window to fit"; 625 NOTREACHED() << "Unable to adjust window to fit";
624 } 626 }
625 } 627 }
626 628
629 bool EdgeHasAutoHideTaskbar(UINT edge, HMONITOR monitor) {
630 APPBARDATA taskbar_data = { 0 };
631 taskbar_data.cbSize = sizeof APPBARDATA;
632 taskbar_data.uEdge = edge;
633 HWND taskbar = reinterpret_cast<HWND>(SHAppBarMessage(ABM_GETAUTOHIDEBAR,
634 &taskbar_data));
635 return ::IsWindow(taskbar) &&
636 (MonitorFromWindow(taskbar, MONITOR_DEFAULTTONEAREST) == monitor);
637 }
638
627 HANDLE GetSectionFromProcess(HANDLE section, HANDLE process, bool read_only) { 639 HANDLE GetSectionFromProcess(HANDLE section, HANDLE process, bool read_only) {
628 HANDLE valid_section = NULL; 640 HANDLE valid_section = NULL;
629 DWORD access = STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ; 641 DWORD access = STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ;
630 if (!read_only) 642 if (!read_only)
631 access |= FILE_MAP_WRITE; 643 access |= FILE_MAP_WRITE;
632 DuplicateHandle(process, section, GetCurrentProcess(), &valid_section, access, 644 DuplicateHandle(process, section, GetCurrentProcess(), &valid_section, access,
633 FALSE, 0); 645 FALSE, 0);
634 return valid_section; 646 return valid_section;
635 } 647 }
636 648
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 } 909 }
898 910
899 ChromeFont GetWindowTitleFont() { 911 ChromeFont GetWindowTitleFont() {
900 NONCLIENTMETRICS ncm; 912 NONCLIENTMETRICS ncm;
901 win_util::GetNonClientMetrics(&ncm); 913 win_util::GetNonClientMetrics(&ncm);
902 ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); 914 ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont)));
903 return ChromeFont::CreateFont(caption_font); 915 return ChromeFont::CreateFont(caption_font);
904 } 916 }
905 917
906 } // namespace win_util 918 } // namespace win_util
OLDNEW
« no previous file with comments | « chrome/common/win_util.h ('k') | chrome/views/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698