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

Side by Side Diff: chrome/browser/fullscreen_win.cc

Issue 6344015: Delay load SHQueryUserNotificationState for platform dependent full-screen... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/fullscreen.h" 5 #include "chrome/browser/fullscreen.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/logging.h"
11 #include "base/sys_info.h"
12
10 static bool IsPlatformFullScreenMode() { 13 static bool IsPlatformFullScreenMode() {
14 // SHQueryUserNotificationState is only available for Vista and above.
15 #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_VISTA)
16 int32 major_version, minor_version, fix_version;
17 base::SysInfo::OperatingSystemVersionNumbers(&major_version,
18 &minor_version,
19 &fix_version);
20 if (major_version < 6)
21 return false;
22
23 typedef HRESULT(WINAPI *SHQueryUserNotificationStatePtr)(
24 QUERY_USER_NOTIFICATION_STATE* state);
25
26 HMODULE shell32_base = ::GetModuleHandle(L"shell32.dll");
27 if (!shell32_base) {
28 NOTREACHED();
29 return false;
30 }
31 SHQueryUserNotificationStatePtr query_user_notification_state_ptr =
32 reinterpret_cast<SHQueryUserNotificationStatePtr>
33 (::GetProcAddress(shell32_base, "SHQueryUserNotificationState"));
34 if (!query_user_notification_state_ptr) {
35 NOTREACHED();
36 return false;
37 }
38
39 QUERY_USER_NOTIFICATION_STATE state;
40 if (FAILED((*query_user_notification_state_ptr)(&state)))
41 return false;
42 return state == QUNS_RUNNING_D3D_FULL_SCREEN ||
43 state == QUNS_PRESENTATION_MODE;
44 #else
11 return false; 45 return false;
46 #endif
12 } 47 }
13 48
14 static bool IsFullScreenWindowMode() { 49 static bool IsFullScreenWindowMode() {
15 // Get the foreground window which the user is currently working on. 50 // Get the foreground window which the user is currently working on.
16 HWND wnd = ::GetForegroundWindow(); 51 HWND wnd = ::GetForegroundWindow();
17 if (!wnd) 52 if (!wnd)
18 return false; 53 return false;
19 54
20 // Get the monitor where the window is located. 55 // Get the monitor where the window is located.
21 RECT wnd_rect; 56 RECT wnd_rect;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 ::FreeConsole(); 97 ::FreeConsole();
63 98
64 return (modes & (CONSOLE_FULLSCREEN | CONSOLE_FULLSCREEN_HARDWARE)) != 0; 99 return (modes & (CONSOLE_FULLSCREEN | CONSOLE_FULLSCREEN_HARDWARE)) != 0;
65 } 100 }
66 101
67 bool IsFullScreenMode() { 102 bool IsFullScreenMode() {
68 return IsPlatformFullScreenMode() || 103 return IsPlatformFullScreenMode() ||
69 IsFullScreenWindowMode() || 104 IsFullScreenWindowMode() ||
70 IsFullScreenConsoleMode(); 105 IsFullScreenConsoleMode();
71 } 106 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698