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

Unified Diff: base/win/metro.cc

Issue 10910311: If desktop chrome is launched via the New Window/the recently opened url shortcuts on the chrome sh… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/win/metro.h ('k') | chrome/browser/process_singleton_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/metro.cc
===================================================================
--- base/win/metro.cc (revision 156844)
+++ base/win/metro.cc (working copy)
@@ -41,40 +41,35 @@
kImmersiveTrue,
kImmersiveFalse
};
- typedef BOOL (WINAPI* IsImmersiveProcessFunc)(HANDLE process);
-
// The immersive state of a process can never change.
// Look it up once and cache it here.
static ImmersiveState state = kImmersiveUnknown;
if (state == kImmersiveUnknown) {
- // The lookup hasn't been done yet. Note that the code below here is
- // idempotent, so it doesn't matter if it races to assignment on multiple
- // threads.
- HMODULE user32 = ::GetModuleHandleA("user32.dll");
- DCHECK(user32 != NULL);
-
- IsImmersiveProcessFunc is_immersive_process =
- reinterpret_cast<IsImmersiveProcessFunc>(
- ::GetProcAddress(user32, "IsImmersiveProcess"));
-
- if (is_immersive_process != NULL) {
- if (is_immersive_process(::GetCurrentProcess())) {
- state = kImmersiveTrue;
- } else {
- state = kImmersiveFalse;
- }
+ if (IsProcessImmersive(::GetCurrentProcess())) {
+ state = kImmersiveTrue;
} else {
- // No "IsImmersiveProcess" export on user32.dll, so this is pre-Windows8
- // and therefore not immersive.
state = kImmersiveFalse;
}
}
DCHECK_NE(kImmersiveUnknown, state);
-
return state == kImmersiveTrue;
}
+bool IsProcessImmersive(HANDLE process) {
+ typedef BOOL (WINAPI* IsImmersiveProcessFunc)(HANDLE process);
+ HMODULE user32 = ::GetModuleHandleA("user32.dll");
+ DCHECK(user32 != NULL);
+
+ IsImmersiveProcessFunc is_immersive_process =
+ reinterpret_cast<IsImmersiveProcessFunc>(
+ ::GetProcAddress(user32, "IsImmersiveProcess"));
+
+ if (is_immersive_process)
+ return is_immersive_process(process) ? true: false;
+ return false;
+}
+
bool IsTsfAwareRequired() {
// Although this function is equal to IsMetroProcess at this moment,
// Chrome for Win7 and Vista may support TSF in the future.
« no previous file with comments | « base/win/metro.h ('k') | chrome/browser/process_singleton_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698