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

Unified Diff: base/win/metro.cc

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 years, 1 month 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') | base/win/object_watcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/metro.cc
diff --git a/base/win/metro.cc b/base/win/metro.cc
deleted file mode 100644
index 794669803ca642939edfaf1cdbb874452f9c2808..0000000000000000000000000000000000000000
--- a/base/win/metro.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/win/metro.h"
-
-#include "base/strings/string_util.h"
-
-namespace base {
-namespace win {
-
-HMODULE GetMetroModule() {
- const HMODULE kUninitialized = reinterpret_cast<HMODULE>(1);
- static HMODULE metro_module = kUninitialized;
-
- if (metro_module == kUninitialized) {
- // Initialize the cache, note that the initialization is idempotent
- // under the assumption that metro_driver is never unloaded, so the
- // race to this assignment is safe.
- metro_module = GetModuleHandleA("metro_driver.dll");
- if (metro_module != NULL) {
- // This must be a metro process if the metro_driver is loaded.
- DCHECK(IsMetroProcess());
- }
- }
-
- DCHECK(metro_module != kUninitialized);
- return metro_module;
-}
-
-bool IsMetroProcess() {
- enum ImmersiveState {
- kImmersiveUnknown,
- kImmersiveTrue,
- kImmersiveFalse
- };
- // The immersive state of a process can never change.
- // Look it up once and cache it here.
- static ImmersiveState state = kImmersiveUnknown;
-
- if (state == kImmersiveUnknown) {
- if (IsProcessImmersive(::GetCurrentProcess())) {
- state = kImmersiveTrue;
- } else {
- 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;
-}
-
-wchar_t* LocalAllocAndCopyString(const string16& src) {
- size_t dest_size = (src.length() + 1) * sizeof(wchar_t);
- wchar_t* dest = reinterpret_cast<wchar_t*>(LocalAlloc(LPTR, dest_size));
- base::wcslcpy(dest, src.c_str(), dest_size);
- return dest;
-}
-
-// Metro driver exports for getting the launch type, initial url, initial
-// search term, etc.
-extern "C" {
-typedef const wchar_t* (*GetInitialUrl)();
-typedef const wchar_t* (*GetInitialSearchString)();
-typedef base::win::MetroLaunchType (*GetLaunchType)(
- base::win::MetroPreviousExecutionState* previous_state);
-}
-
-MetroLaunchType GetMetroLaunchParams(string16* params) {
- HMODULE metro = base::win::GetMetroModule();
- if (!metro)
- return base::win::METRO_LAUNCH_ERROR;
-
- GetLaunchType get_launch_type = reinterpret_cast<GetLaunchType>(
- ::GetProcAddress(metro, "GetLaunchType"));
- DCHECK(get_launch_type);
-
- base::win::MetroLaunchType launch_type = get_launch_type(NULL);
-
- if ((launch_type == base::win::METRO_PROTOCOL) ||
- (launch_type == base::win::METRO_LAUNCH)) {
- GetInitialUrl initial_metro_url = reinterpret_cast<GetInitialUrl>(
- ::GetProcAddress(metro, "GetInitialUrl"));
- DCHECK(initial_metro_url);
- *params = initial_metro_url();
- } else if (launch_type == base::win::METRO_SEARCH) {
- GetInitialSearchString initial_search_string =
- reinterpret_cast<GetInitialSearchString>(
- ::GetProcAddress(metro, "GetInitialSearchString"));
- DCHECK(initial_search_string);
- *params = initial_search_string();
- }
- return launch_type;
-}
-
-} // namespace win
-} // namespace base
« no previous file with comments | « base/win/metro.h ('k') | base/win/object_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698