diff options
84 files changed, 59 insertions, 1913 deletions
diff --git a/base/BUILD.gn b/base/BUILD.gn index caa5fb2..946d17f 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -904,8 +904,6 @@ component("base") { "win/iunknown_impl.h", "win/message_window.cc", "win/message_window.h", - "win/metro.cc", - "win/metro.h", "win/object_watcher.cc", "win/object_watcher.h", "win/process_startup_helper.cc", diff --git a/base/base.gypi b/base/base.gypi index 0c70578..c93d8d3 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -732,8 +732,6 @@ 'win/iunknown_impl.h', 'win/message_window.cc', 'win/message_window.h', - 'win/metro.cc', - 'win/metro.h', 'win/object_watcher.cc', 'win/object_watcher.h', 'win/process_startup_helper.cc', diff --git a/base/win/metro.cc b/base/win/metro.cc deleted file mode 100644 index 72975cd..0000000 --- a/base/win/metro.cc +++ /dev/null @@ -1,118 +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 <stddef.h> - -#include "base/strings/string_util.h" -#include "base/win/windows_version.h" - -namespace base { -namespace win { - -bool IsChromeMetroSupported() { - const Version win_version = GetVersion(); - return win_version >= VERSION_WIN8 && win_version < VERSION_WIN10; -} - -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 diff --git a/base/win/metro.h b/base/win/metro.h deleted file mode 100644 index 15a89c2..0000000 --- a/base/win/metro.h +++ /dev/null @@ -1,128 +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. - -#ifndef BASE_WIN_METRO_H_ -#define BASE_WIN_METRO_H_ - -#include <windows.h> - -#include "base/base_export.h" -#include "base/callback.h" -#include "base/files/file_path.h" -#include "base/strings/string16.h" - -namespace base { -namespace win { - -// Identifies the type of the metro launch. -enum MetroLaunchType { - METRO_LAUNCH, - METRO_SEARCH, - METRO_SHARE, - METRO_FILE, - METRO_PROTOCOL, - METRO_LAUNCH_ERROR, - METRO_LASTLAUNCHTYPE, -}; - -// In metro mode, this enum identifies the last execution state, i.e. whether -// we crashed, terminated, etc. -enum MetroPreviousExecutionState { - NOTRUNNING, - RUNNING, - SUSPENDED, - TERMINATED, - CLOSEDBYUSER, - LASTEXECUTIONSTATE, -}; - -// Enum values for UMA histogram reporting of site-specific tile pinning. -// TODO(tapted): Move this to win8/util when ready (http://crbug.com/160288). -enum MetroSecondaryTilePinUmaResult { - METRO_PIN_STATE_NONE, - METRO_PIN_INITIATED, - METRO_PIN_LOGO_READY, - METRO_PIN_REQUEST_SHOW_ERROR, - METRO_PIN_RESULT_CANCEL, - METRO_PIN_RESULT_OK, - METRO_PIN_RESULT_OTHER, - METRO_PIN_RESULT_ERROR, - METRO_UNPIN_INITIATED, - METRO_UNPIN_REQUEST_SHOW_ERROR, - METRO_UNPIN_RESULT_CANCEL, - METRO_UNPIN_RESULT_OK, - METRO_UNPIN_RESULT_OTHER, - METRO_UNPIN_RESULT_ERROR, - METRO_PIN_STATE_LIMIT -}; - -// Contains information about the currently displayed tab in metro mode. -struct CurrentTabInfo { - wchar_t* title; - wchar_t* url; -}; - -// Returns true if Chrome supports Metro-mode on this Windows version. -BASE_EXPORT bool IsChromeMetroSupported(); - -// Returns the handle to the metro dll loaded in the process. A NULL return -// indicates that the metro dll was not loaded in the process. -BASE_EXPORT HMODULE GetMetroModule(); - -// Returns true if this process is running as an immersive program -// in Windows Metro mode. -BASE_EXPORT bool IsMetroProcess(); - -// Returns true if the process identified by the handle passed in is an -// immersive (Metro) process. -BASE_EXPORT bool IsProcessImmersive(HANDLE process); - -// Allocates and returns the destination string via the LocalAlloc API after -// copying the src to it. -BASE_EXPORT wchar_t* LocalAllocAndCopyString(const string16& src); - -// Returns the type of launch and the activation params. For example if the -// the launch is for METRO_PROTOCOL then the params is a url. -BASE_EXPORT MetroLaunchType GetMetroLaunchParams(string16* params); - -// Handler function for the buttons on a metro dialog box -typedef void (*MetroDialogButtonPressedHandler)(); - -// Handler function invoked when a metro style notification is clicked. -typedef void (*MetroNotificationClickedHandler)(const wchar_t* context); - -// Function to display metro style notifications. -typedef void (*MetroNotification)(const char* origin_url, - const char* icon_url, - const wchar_t* title, - const wchar_t* body, - const wchar_t* display_source, - const char* notification_id, - MetroNotificationClickedHandler handler, - const wchar_t* handler_context); - -// Function to cancel displayed notification. -typedef bool (*MetroCancelNotification)(const char* notification_id); - -// Callback for UMA invoked by Metro Pin and UnPin functions after user gesture. -typedef base::Callback<void(MetroSecondaryTilePinUmaResult)> - MetroPinUmaResultCallback; - -// Function to pin a site-specific tile (bookmark) to the start screen. -typedef void (*MetroPinToStartScreen)( - const string16& tile_id, - const string16& title, - const string16& url, - const FilePath& logo_path, - const MetroPinUmaResultCallback& callback); - -// Function to un-pin a site-specific tile (bookmark) from the start screen. -typedef void (*MetroUnPinFromStartScreen)( - const string16& title_id, - const MetroPinUmaResultCallback& callback); - -} // namespace win -} // namespace base - -#endif // BASE_WIN_METRO_H_ diff --git a/base/win/win_util.cc b/base/win/win_util.cc index a37e0f2..57bee8a 100644 --- a/base/win/win_util.cc +++ b/base/win/win_util.cc @@ -30,7 +30,6 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_restrictions.h" -#include "base/win/metro.h" #include "base/win/registry.h" #include "base/win/scoped_co_mem.h" #include "base/win/scoped_handle.h" @@ -532,8 +531,6 @@ bool DismissVirtualKeyboard() { return false; } -typedef HWND (*MetroRootWindow) (); - enum DomainEnrollementState {UNKNOWN = -1, NOT_ENROLLED, ENROLLED}; static volatile long int g_domain_state = UNKNOWN; diff --git a/chrome/app/main_dll_loader_win.cc b/chrome/app/main_dll_loader_win.cc index 8ef34fe..257b9fe 100644 --- a/chrome/app/main_dll_loader_win.cc +++ b/chrome/app/main_dll_loader_win.cc @@ -26,7 +26,6 @@ #include "base/strings/utf_string_conversions.h" #include "base/threading/platform_thread.h" #include "base/trace_event/trace_event.h" -#include "base/win/metro.h" #include "base/win/scoped_handle.h" #include "base/win/windows_version.h" #include "chrome/app/chrome_crash_reporter_client.h" @@ -61,7 +60,7 @@ typedef void (*RelaunchChromeBrowserWithNewCommandLineIfNeededFunc)(); // Loads |module| after setting the CWD to |module|'s directory. Returns a // reference to the loaded module on success, or null on error. -HMODULE LoadModuleWithDirectory(const base::FilePath& module, bool pre_read) { +HMODULE LoadModuleWithDirectory(const base::FilePath& module) { ::SetCurrentDirectoryW(module.DirName().value().c_str()); // Get pre-read options from the PreRead field trial. @@ -75,7 +74,7 @@ HMODULE LoadModuleWithDirectory(const base::FilePath& module, bool pre_read) { &trial_prefetch_virtual_memory); // Pre-read the binary to warm the memory caches (avoids a lot of random IO). - if (pre_read && !trial_no_pre_read) { + if (!trial_no_pre_read) { base::ThreadPriority previous_priority = base::ThreadPriority::NORMAL; if (trial_high_priority) { previous_priority = base::PlatformThread::GetCurrentThreadPriority(); @@ -166,7 +165,7 @@ std::wstring GetProfileType() { //============================================================================= MainDllLoader::MainDllLoader() - : dll_(nullptr), metro_mode_(base::win::IsMetroProcess()) { + : dll_(nullptr) { } MainDllLoader::~MainDllLoader() { @@ -180,9 +179,7 @@ MainDllLoader::~MainDllLoader() { // installed build. HMODULE MainDllLoader::Load(base::string16* version, base::FilePath* module) { const base::char16* dll_name = nullptr; - if (metro_mode_) { - dll_name = installer::kChromeMetroDll; - } else if (process_type_ == "service" || process_type_.empty()) { + if (process_type_ == "service" || process_type_.empty()) { dll_name = installer::kChromeDll; } else if (process_type_ == "watcher") { dll_name = kChromeWatcherDll; @@ -199,8 +196,7 @@ HMODULE MainDllLoader::Load(base::string16* version, base::FilePath* module) { PLOG(ERROR) << "Cannot find module " << dll_name; return nullptr; } - const bool pre_read = !metro_mode_; - HMODULE dll = LoadModuleWithDirectory(*module, pre_read); + HMODULE dll = LoadModuleWithDirectory(*module); if (!dll) { PLOG(ERROR) << "Failed to load Chrome DLL from " << module->value(); return nullptr; @@ -220,16 +216,6 @@ int MainDllLoader::Launch(HINSTANCE instance) { base::string16 version; base::FilePath file; - if (metro_mode_) { - HMODULE metro_dll = Load(&version, &file); - if (!metro_dll) - return chrome::RESULT_CODE_MISSING_DATA; - - InitMetro chrome_metro_main = - reinterpret_cast<InitMetro>(::GetProcAddress(metro_dll, "InitMetro")); - return chrome_metro_main(); - } - if (process_type_ == "watcher") { chrome::RegisterPathProvider(); diff --git a/chrome/app/main_dll_loader_win.h b/chrome/app/main_dll_loader_win.h index 99852ff..ac1ba45 100644 --- a/chrome/app/main_dll_loader_win.h +++ b/chrome/app/main_dll_loader_win.h @@ -55,7 +55,6 @@ class MainDllLoader { private: HMODULE dll_; std::string process_type_; - const bool metro_mode_; }; // Factory for the MainDllLoader. Caller owns the pointer and should call diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 1f0e03b..0eaff3a 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -1003,7 +1003,6 @@ if (is_win) { ] deps = [ "//base", - "//chrome/browser/metro_utils", "//chrome/common:constants", ] if (enable_configuration_policy) { diff --git a/chrome/browser/browser_process_platform_part_aurawin.cc b/chrome/browser/browser_process_platform_part_aurawin.cc index ecbe6f1..dd6635b 100644 --- a/chrome/browser/browser_process_platform_part_aurawin.cc +++ b/chrome/browser/browser_process_platform_part_aurawin.cc @@ -56,7 +56,6 @@ void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing( command_line.GetSwitchValueNative( switches::kViewerLaunchViaAppId))); } - } void BrowserProcessPlatformPart::Observe( @@ -68,17 +67,6 @@ void BrowserProcessPlatformPart::Observe( PrefService* pref_service = g_browser_process->local_state(); bool is_relaunch = pref_service->GetBoolean(prefs::kWasRestarted); if (is_relaunch) { - upgrade_util::RelaunchMode mode = - upgrade_util::RelaunchModeStringToEnum( - pref_service->GetString(prefs::kRelaunchMode)); - if (metro_viewer_process_host_.get()) { - if (mode == upgrade_util::RELAUNCH_MODE_DESKTOP) { - // Metro -> Desktop - chrome::ActivateDesktopHelper(chrome::ASH_TERMINATE); - } else { - // Metro -> Metro - ChromeMetroViewerProcessHost::HandleMetroExit(); - } - } + // TODO(scottmg): A lot of this can be removed http://crbug.com/558054. } } diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index 7561fba..fdf297b 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc @@ -25,7 +25,6 @@ #include "base/scoped_native_library.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" -#include "base/win/metro.h" #include "base/win/registry.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" @@ -279,21 +278,6 @@ int DoUninstallTasks(bool chrome_still_running) { ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( const content::MainFunctionParams& parameters) : ChromeBrowserMainParts(parameters) { - if (base::win::IsMetroProcess()) { - typedef const wchar_t* (*GetMetroSwitches)(void); - GetMetroSwitches metro_switches_proc = reinterpret_cast<GetMetroSwitches>( - GetProcAddress(base::win::GetMetroModule(), - "GetMetroCommandLineSwitches")); - if (metro_switches_proc) { - base::string16 metro_switches = (*metro_switches_proc)(); - if (!metro_switches.empty()) { - base::CommandLine extra_switches(base::CommandLine::NO_PROGRAM); - extra_switches.ParseFromString(metro_switches); - base::CommandLine::ForCurrentProcess()->AppendArguments(extra_switches, - false); - } - } - } } ChromeBrowserMainPartsWin::~ChromeBrowserMainPartsWin() { @@ -544,10 +528,6 @@ bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() { sei.nShow = SW_SHOWNORMAL; sei.lpFile = setup_exe.value().c_str(); sei.lpParameters = params.c_str(); - // On Windows 8 SEE_MASK_FLAG_LOG_USAGE is necessary to guarantee we - // flip to the Desktop when launching. - if (base::win::IsMetroProcess()) - sei.fMask |= SEE_MASK_FLAG_LOG_USAGE; if (!::ShellExecuteEx(&sei)) DPCHECK(false); diff --git a/chrome/browser/chrome_select_file_dialog_factory_win.cc b/chrome/browser/chrome_select_file_dialog_factory_win.cc index 78cc353..41a3b0a 100644 --- a/chrome/browser/chrome_select_file_dialog_factory_win.cc +++ b/chrome/browser/chrome_select_file_dialog_factory_win.cc @@ -16,7 +16,6 @@ #include "base/metrics/field_trial.h" #include "base/strings/string16.h" #include "base/synchronization/waitable_event.h" -#include "base/win/metro.h" #include "chrome/common/chrome_utility_messages.h" #include "chrome/grit/generated_resources.h" #include "content/public/browser/utility_process_host.h" @@ -28,24 +27,6 @@ namespace { -bool CallMetroOPENFILENAMEMethod(const char* method_name, OPENFILENAME* ofn) { - typedef BOOL (*MetroOPENFILENAMEMethod)(OPENFILENAME*); - MetroOPENFILENAMEMethod metro_method = NULL; - HMODULE metro_module = base::win::GetMetroModule(); - - if (metro_module != NULL) { - metro_method = reinterpret_cast<MetroOPENFILENAMEMethod>( - ::GetProcAddress(metro_module, method_name)); - } - - if (metro_method != NULL) - return metro_method(ofn) == TRUE; - - NOTREACHED(); - - return false; -} - bool ShouldIsolateShellOperations() { return base::FieldTrialList::FindFullName("IsolateShellOperations") == "Enabled"; @@ -172,14 +153,11 @@ bool GetOpenFileNameInUtilityProcess( return true; } -// Implements GetOpenFileName for CreateWinSelectFileDialog by delegating either -// to Metro or a utility process. +// Implements GetOpenFileName for CreateWinSelectFileDialog by delegating to a +// utility process. bool GetOpenFileNameImpl( const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, OPENFILENAME* ofn) { - if (base::win::IsMetroProcess()) - return CallMetroOPENFILENAMEMethod("MetroGetOpenFileName", ofn); - if (ShouldIsolateShellOperations()) return GetOpenFileNameInUtilityProcess(blocking_task_runner, ofn); @@ -311,14 +289,11 @@ bool GetSaveFileNameInUtilityProcess( return true; } -// Implements GetSaveFileName for CreateWinSelectFileDialog by delegating either -// to Metro or a utility process. +// Implements GetSaveFileName for CreateWinSelectFileDialog by delegating to a +// utility process. bool GetSaveFileNameImpl( const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, OPENFILENAME* ofn) { - if (base::win::IsMetroProcess()) - return CallMetroOPENFILENAMEMethod("MetroGetSaveFileName", ofn); - if (ShouldIsolateShellOperations()) return GetSaveFileNameInUtilityProcess(blocking_task_runner, ofn); diff --git a/chrome/browser/extensions/chrome_requirements_checker.cc b/chrome/browser/extensions/chrome_requirements_checker.cc index 5fcb2d0..64fbc3e 100644 --- a/chrome/browser/extensions/chrome_requirements_checker.cc +++ b/chrome/browser/extensions/chrome_requirements_checker.cc @@ -15,10 +15,6 @@ #include "gpu/config/gpu_feature_type.h" #include "ui/base/l10n/l10n_util.h" -#if defined(OS_WIN) -#include "base/win/metro.h" -#endif - namespace extensions { ChromeRequirementsChecker::ChromeRequirementsChecker() @@ -42,12 +38,6 @@ void ChromeRequirementsChecker::Check( errors_.push_back( l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); #endif -#if defined(OS_WIN) - if (base::win::IsMetroProcess()) { - errors_.push_back( - l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); - } -#endif } if (requirements.window_shape) { diff --git a/chrome/browser/first_run/first_run_internal_win.cc b/chrome/browser/first_run/first_run_internal_win.cc index 98dba61..1b1d33f 100644 --- a/chrome/browser/first_run/first_run_internal_win.cc +++ b/chrome/browser/first_run/first_run_internal_win.cc @@ -19,7 +19,6 @@ #include "base/process/process.h" #include "base/threading/sequenced_worker_pool.h" #include "base/time/time.h" -#include "base/win/metro.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -51,31 +50,17 @@ bool LaunchSetupForEula(const base::FilePath::StringType& value, base::CommandLine cl(base::CommandLine::NO_PROGRAM); cl.AppendSwitchNative(installer::switches::kShowEula, value); - if (base::win::IsMetroProcess()) { - cl.AppendSwitch(installer::switches::kShowEulaForMetro); - - // This obscure use of the 'log usage' mask for windows 8 is documented here - // http://go.microsoft.com/fwlink/?LinkID=243079. It causes the desktop - // process to receive focus. Pass SEE_MASK_FLAG_NO_UI to avoid hangs if an - // error occurs since the UI can't be shown from a metro process. - ui::win::OpenAnyViaShell(exe_path.value(), - exe_dir.value(), - cl.GetCommandLineString(), - SEE_MASK_FLAG_LOG_USAGE | SEE_MASK_FLAG_NO_UI); - return false; - } else { - base::CommandLine setup_path(exe_path); - setup_path.AppendArguments(cl, false); + base::CommandLine setup_path(exe_path); + setup_path.AppendArguments(cl, false); - base::Process process = - base::LaunchProcess(setup_path, base::LaunchOptions()); - int exit_code = 0; - if (!process.IsValid() || !process.WaitForExit(&exit_code)) - return false; + base::Process process = + base::LaunchProcess(setup_path, base::LaunchOptions()); + int exit_code = 0; + if (!process.IsValid() || !process.WaitForExit(&exit_code)) + return false; - *ret_code = exit_code; - return true; - } + *ret_code = exit_code; + return true; } // Returns true if the EULA is required but has not been accepted by this user. diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc index 5725ba2..688e665 100644 --- a/chrome/browser/first_run/upgrade_util_win.cc +++ b/chrome/browser/first_run/upgrade_util_win.cc @@ -25,7 +25,6 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "base/win/metro.h" #include "base/win/registry.h" #include "base/win/scoped_comptr.h" #include "base/win/windows_version.h" @@ -162,73 +161,8 @@ bool RelaunchChromeHelper(const base::CommandLine& command_line, chrome_exe_command_line.SetProgram( chrome_exe.DirName().Append(installer::kChromeExe)); - // Relaunch directly if Chrome doesn't support Metro-mode on this platform - // unless an explicit relaunch mode was specified (e.g. for the Ash shell on - // Win7). - if (!base::win::IsChromeMetroSupported() && - relaunch_mode != RELAUNCH_MODE_METRO && - relaunch_mode != RELAUNCH_MODE_DESKTOP) { - return base::LaunchProcess(chrome_exe_command_line, - base::LaunchOptions()).IsValid(); - } - - // On Windows 8 we always use the delegate_execute for re-launching chrome. - // On Windows 7 we use delegate_execute for re-launching chrome into Windows - // ASH. - // - // Pass this Chrome's Start Menu shortcut path to the relauncher so it can re- - // activate chrome via ShellExecute which will wait until we exit. Since - // ShellExecute does not support handle passing to the child process we create - // a uniquely named mutex that we aquire and never release. So when we exit, - // Windows marks our mutex as abandoned and the wait is satisfied. The format - // of the named mutex is important. See DelegateExecuteOperation for more - // details. - base::string16 mutex_name = - base::StringPrintf(L"chrome.relaunch.%d", ::GetCurrentProcessId()); - HANDLE mutex = ::CreateMutexW(NULL, TRUE, mutex_name.c_str()); - // The |mutex| handle needs to be leaked. See comment above. - if (!mutex) { - NOTREACHED(); - return false; - } - if (::GetLastError() == ERROR_ALREADY_EXISTS) { - NOTREACHED() << "Relaunch mutex already exists"; - return false; - } - - base::CommandLine relaunch_cmd(base::CommandLine::NO_PROGRAM); - relaunch_cmd.AppendSwitchPath(switches::kRelaunchShortcut, - ShellIntegration::GetStartMenuShortcut(chrome_exe)); - relaunch_cmd.AppendSwitchNative(switches::kWaitForMutex, mutex_name); - - if (relaunch_mode != RELAUNCH_MODE_DEFAULT) { - relaunch_cmd.AppendSwitch(relaunch_mode == RELAUNCH_MODE_METRO? - switches::kForceImmersive : switches::kForceDesktop); - } - - base::string16 params(relaunch_cmd.GetCommandLineString()); - base::string16 path(GetMetroRelauncherPath(chrome_exe, version_str).value()); - - SHELLEXECUTEINFO sei = { sizeof(sei) }; - sei.fMask = SEE_MASK_FLAG_LOG_USAGE | SEE_MASK_NOCLOSEPROCESS; - sei.nShow = SW_SHOWNORMAL; - sei.lpFile = path.c_str(); - sei.lpParameters = params.c_str(); - - if (!::ShellExecuteExW(&sei)) { - NOTREACHED() << "ShellExecute failed with " << GetLastError(); - return false; - } - DWORD pid = ::GetProcessId(sei.hProcess); - CloseHandle(sei.hProcess); - if (!pid) - return false; - // The next call appears to be needed if we are relaunching from desktop into - // metro mode. The observed effect if not done is that chrome starts in metro - // mode but it is not given focus and it gets killed by windows after a few - // seconds. - ::AllowSetForegroundWindow(pid); - return true; + return base::LaunchProcess(chrome_exe_command_line, base::LaunchOptions()) + .IsValid(); } bool RelaunchChromeBrowser(const base::CommandLine& command_line) { @@ -308,8 +242,6 @@ bool DoUpgradeTasks(const base::CommandLine& command_line) { // The DelegateExecute verb handler finalizes pending in-use updates for // metro mode launches, as Chrome cannot be gracefully relaunched when // running in this mode. - if (base::win::IsMetroProcess()) - return false; if (!SwapNewChromeExeIfPresent() && !IsRunningOldChrome()) return false; // At this point the chrome.exe has been swapped with the new one. diff --git a/chrome/browser/lifetime/application_lifetime.h b/chrome/browser/lifetime/application_lifetime.h index 488f22c..5d0989b 100644 --- a/chrome/browser/lifetime/application_lifetime.h +++ b/chrome/browser/lifetime/application_lifetime.h @@ -26,26 +26,6 @@ void AttemptUserExit(); // manager re-launch the browser with restore last session flag. void AttemptRestart(); -#if defined(OS_WIN) -enum AshExecutionStatus { - ASH_KEEP_RUNNING, - ASH_TERMINATE, -}; - -// Helper function to activate the desktop from Ash mode. The -// |ash_execution_status| parameter indicates if we should exit Ash after -// activating desktop. -void ActivateDesktopHelper(AshExecutionStatus ash_execution_status); - -// Windows 7/8 specific: Like AttemptRestart but if chrome is running -// in desktop mode it starts in metro mode and vice-versa. The switching like -// the restarting is controlled by a preference. -void AttemptRestartToDesktopMode(); -// Launches Chrome into Windows 8 metro mode on Windows 8. On Windows 7 it -// launches Chrome into Windows ASH. -void AttemptRestartToMetroMode(); -#endif - // Attempt to exit by closing all browsers. This is equivalent to // CloseAllBrowsers() on platforms where the application exits // when no more windows are remaining. On other platforms (the Mac), diff --git a/chrome/browser/lifetime/application_lifetime_win.cc b/chrome/browser/lifetime/application_lifetime_win.cc deleted file mode 100644 index 2d39984..0000000 --- a/chrome/browser/lifetime/application_lifetime_win.cc +++ /dev/null @@ -1,79 +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 "chrome/browser/lifetime/application_lifetime.h" - -#include "base/bind.h" -#include "base/environment.h" -#include "base/files/file_path.h" -#include "base/path_service.h" -#include "base/prefs/pref_service.h" -#include "base/win/metro.h" -#include "base/win/windows_version.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/first_run/upgrade_util.h" -#include "chrome/browser/metro_utils/metro_chrome_win.h" -#include "chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h" -#include "chrome/browser/shell_integration.h" -#include "chrome/browser/ui/browser_finder.h" -#include "chrome/common/chrome_constants.h" -#include "chrome/common/pref_names.h" -#include "chrome/installer/util/util_constants.h" -#include "content/public/browser/web_contents.h" -#include "ui/views/widget/widget.h" - -namespace chrome { - -// Following set of functions, which are used to switch chrome mode after -// restart are used for in places where either user explicitly wants to switch -// mode or some functionality is not available in either mode and we ask user -// to switch mode. -// Here mode refers to Windows 8 modes such as Metro (also called immersive) -// and desktop mode (Classic or traditional). - -void ActivateDesktopHelper(AshExecutionStatus ash_execution_status) { - scoped_ptr<base::Environment> env(base::Environment::Create()); - std::string version_str; - - // Get the version variable and remove it from the environment. - if (!env->GetVar(chrome::kChromeVersionEnvVar, &version_str)) - version_str.clear(); - - base::FilePath exe_path; - if (!PathService::Get(base::FILE_EXE, &exe_path)) - return; - - base::FilePath path(exe_path.DirName()); - - // The relauncher is ordinarily in the version directory. When running in a - // build tree however (where CHROME_VERSION is not set in the environment) - // look for it in Chrome's directory. - if (!version_str.empty()) - path = path.AppendASCII(version_str); - - path = path.Append(installer::kDelegateExecuteExe); - - // Actually launching the process needs to happen in the metro viewer, - // otherwise it won't automatically transition to desktop. So we have - // to send an IPC to the viewer to do the ShellExecute. - ChromeMetroViewerProcessHost::HandleActivateDesktop( - path, ash_execution_status == ASH_TERMINATE); -} - -void AttemptRestartToDesktopMode() { - PrefService* prefs = g_browser_process->local_state(); - prefs->SetString(prefs::kRelaunchMode, - upgrade_util::kRelaunchModeDesktop); - - AttemptRestart(); -} - -void AttemptRestartToMetroMode() { - PrefService* prefs = g_browser_process->local_state(); - prefs->SetString(prefs::kRelaunchMode, - upgrade_util::kRelaunchModeMetro); - AttemptRestart(); -} - -} // namespace chrome diff --git a/chrome/browser/metro_utils/BUILD.gn b/chrome/browser/metro_utils/BUILD.gn deleted file mode 100644 index c729113..0000000 --- a/chrome/browser/metro_utils/BUILD.gn +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2015 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. - -source_set("metro_utils") { - deps = [ - "//base", - - # We use a few functions from here but don't depend on the resource - # strings. This target is indirectly linked into chrome.exe, so - # specifically doesn't want those strings. - "//chrome/installer/util:with_no_strings", - ] - sources = [ - "metro_chrome_win.cc", - "metro_chrome_win.h", - ] -} diff --git a/chrome/browser/metro_utils/DEPS b/chrome/browser/metro_utils/DEPS deleted file mode 100644 index b3c0d6c..0000000 --- a/chrome/browser/metro_utils/DEPS +++ /dev/null @@ -1,4 +0,0 @@ -include_rules = [ - "+base", - "+chrome/installer/util", -] diff --git a/chrome/browser/metro_utils/OWNERS b/chrome/browser/metro_utils/OWNERS deleted file mode 100644 index 58a1c23..0000000 --- a/chrome/browser/metro_utils/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -cpu@chromium.org -ananta@chromium.org diff --git a/chrome/browser/metro_utils/metro_chrome_win.cc b/chrome/browser/metro_utils/metro_chrome_win.cc deleted file mode 100644 index 2bab9e1..0000000 --- a/chrome/browser/metro_utils/metro_chrome_win.cc +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2013 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 "chrome/browser/metro_utils/metro_chrome_win.h" - -#include <windows.h> -#include <shobjidl.h> - -#include "base/files/file_path.h" -#include "base/path_service.h" -#include "base/win/metro.h" -#include "base/win/scoped_com_initializer.h" -#include "base/win/scoped_comptr.h" -#include "base/win/windows_version.h" -#include "chrome/installer/util/browser_distribution.h" -#include "chrome/installer/util/install_util.h" -#include "chrome/installer/util/shell_util.h" - -namespace chrome { - -bool ActivateMetroChrome() { - // TODO(cpu): For Win7 we need to activate differently. - if (base::win::GetVersion() < base::win::VERSION_WIN8) - return true; - - base::FilePath chrome_exe; - if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { - NOTREACHED() << "Failed to get chrome exe path"; - return false; - } - - base::string16 app_id = - ShellUtil::GetBrowserModelId(BrowserDistribution::GetDistribution(), - InstallUtil::IsPerUserInstall(chrome_exe)); - if (app_id.empty()) { - NOTREACHED() << "Failed to get chrome app user model id."; - return false; - } - - base::win::ScopedComPtr<IApplicationActivationManager> activation_manager; - HRESULT hr = activation_manager.CreateInstance( - CLSID_ApplicationActivationManager); - if (!activation_manager.get()) { - NOTREACHED() << "Failed to cocreate activation manager. Error: " - << std::showbase << std::hex << hr; - return false; - } - - unsigned long pid = 0; - hr = activation_manager->ActivateApplication(app_id.c_str(), - L"open", - AO_NONE, - &pid); - if (FAILED(hr)) { - NOTREACHED() << "Failed to activate metro chrome. Error: " - << std::showbase << std::hex << hr; - return false; - } - - return true; -} - -Win8Environment GetWin8Environment(HostDesktopType desktop) { - if (desktop == chrome::HOST_DESKTOP_TYPE_ASH) - return WIN_8_ENVIRONMENT_METRO_AURA; - else - return WIN_8_ENVIRONMENT_DESKTOP_AURA; -} - - -} // namespace chrome diff --git a/chrome/browser/metro_utils/metro_chrome_win.h b/chrome/browser/metro_utils/metro_chrome_win.h deleted file mode 100644 index 9f96a38..0000000 --- a/chrome/browser/metro_utils/metro_chrome_win.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2013 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. - -#ifndef CHROME_BROWSER_METRO_UTILS_METRO_CHROME_WIN_H_ -#define CHROME_BROWSER_METRO_UTILS_METRO_CHROME_WIN_H_ - -#include "chrome/browser/ui/host_desktop.h" - -namespace chrome { - -// Using IApplicationActivationManager::ActivateApplication, activate the -// Chrome window running in Metro mode. Returns true if the activation was -// successful. Note that this can not be called nested in another COM -// SendMessage (results in error RPC_E_CANTCALLOUT_ININPUTSYNCCALL), so use -// PostTask to handle that case. -bool ActivateMetroChrome(); - -enum Win8Environment { - WIN_8_ENVIRONMENT_METRO_AURA, - WIN_8_ENVIRONMENT_DESKTOP_AURA, - WIN_8_ENVIRONMENT_MAX -}; - -Win8Environment GetWin8Environment(HostDesktopType desktop); - -} // namespace chrome - -#endif // CHROME_BROWSER_METRO_UTILS_METRO_CHROME_WIN_H_ diff --git a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc index 571c16c..1c993f8 100644 --- a/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc +++ b/chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.cc @@ -122,11 +122,6 @@ void ChromeMetroViewerProcessHost::OnChannelConnected(int32_t /*peer_pid*/) { // Set environment variable to let breakpad know that metro process was // connected. ::SetEnvironmentVariableA(env_vars::kMetroConnected, "1"); - - if (!content::GpuDataManager::GetInstance()->GpuAccessAllowed(NULL)) { - DVLOG(1) << "No GPU access, attempting to restart in Desktop\n"; - chrome::AttemptRestartToDesktopMode(); - } } void ChromeMetroViewerProcessHost::OnSetTargetSurface( diff --git a/chrome/browser/platform_util_win.cc b/chrome/browser/platform_util_win.cc index 967ad9f..0aad227 100644 --- a/chrome/browser/platform_util_win.cc +++ b/chrome/browser/platform_util_win.cc @@ -188,16 +188,9 @@ void OpenItemViaShellInUtilityProcess(const base::FilePath& full_path, } } -void ActivateDesktopIfNecessary() { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) - chrome::ActivateDesktopHelper(chrome::ASH_KEEP_RUNNING); -} - } // namespace void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { - ActivateDesktopIfNecessary(); BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&ShowItemInFolderOnFileThread, full_path)); } @@ -205,9 +198,6 @@ void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { namespace internal { void PlatformOpenVerifiedItem(const base::FilePath& path, OpenItemType type) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&ActivateDesktopIfNecessary)); - if (base::FieldTrialList::FindFullName("IsolateShellOperations") == "Enabled") { BrowserThread::PostTask( @@ -231,10 +221,6 @@ void PlatformOpenVerifiedItem(const base::FilePath& path, OpenItemType type) { void OpenExternal(Profile* profile, const GURL& url) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH && - !url.SchemeIsHTTPOrHTTPS()) - chrome::ActivateDesktopHelper(chrome::ASH_KEEP_RUNNING); - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&OpenExternalOnFileThread, url)); } diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc index b34922a..52dd221 100644 --- a/chrome/browser/plugins/plugin_info_message_filter.cc +++ b/chrome/browser/plugins/plugin_info_message_filter.cc @@ -46,10 +46,6 @@ #include "extensions/common/manifest_handlers/webview_info.h" #endif -#if defined(OS_WIN) -#include "base/win/metro.h" -#endif - #if !defined(DISABLE_NACL) #include "components/nacl/common/nacl_constants.h" #endif @@ -347,13 +343,6 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus( const WebPluginInfo& plugin, const PluginMetadata* plugin_metadata, ChromeViewHostMsg_GetPluginInfo_Status* status) const { -#if defined(OS_WIN) - if (plugin.type == WebPluginInfo::PLUGIN_TYPE_NPAPI && - base::win::IsMetroProcess()) { - *status = ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported; - return; - } -#endif if (plugin.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) { CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); // NPAPI plugins are not supported inside <webview> guests. diff --git a/chrome/browser/plugins/plugin_infobar_delegates.cc b/chrome/browser/plugins/plugin_infobar_delegates.cc index 35fb5ff..2c457c0 100644 --- a/chrome/browser/plugins/plugin_infobar_delegates.cc +++ b/chrome/browser/plugins/plugin_infobar_delegates.cc @@ -30,9 +30,6 @@ #include "ui/base/l10n/l10n_util.h" #if defined(ENABLE_PLUGIN_INSTALLATION) -#if defined(OS_WIN) -#include "base/win/metro.h" -#endif #include "chrome/browser/plugins/plugin_installer.h" #endif @@ -277,7 +274,7 @@ void LaunchDesktopInstanceHelper(const base::string16& url) { } bool PluginMetroModeInfoBarDelegate::Accept() { - chrome::AttemptRestartToDesktopMode(); + // TODO(scottmg): Remove this entire class http://crbug.com/558054. return true; } diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc index 4285ab6..8385774 100644 --- a/chrome/browser/plugins/plugin_observer.cc +++ b/chrome/browser/plugins/plugin_observer.cc @@ -39,9 +39,6 @@ #include "ui/gfx/vector_icons_public.h" #if defined(ENABLE_PLUGIN_INSTALLATION) -#if defined(OS_WIN) -#include "base/win/metro.h" -#endif #include "chrome/browser/plugins/plugin_installer.h" #include "chrome/browser/plugins/plugin_installer_observer.h" #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" @@ -438,10 +435,6 @@ void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { void PluginObserver::OnNPAPINotSupported(const std::string& identifier) { #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) -#if !defined(USE_AURA) - DCHECK(base::win::IsMetroProcess()); -#endif - scoped_ptr<PluginMetadata> plugin; bool ret = PluginFinder::GetInstance()->FindPluginWithIdentifier( identifier, NULL, &plugin); diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index 4aea500..68906af 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -18,14 +18,12 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" -#include "base/win/metro.h" #include "base/win/registry.h" #include "base/win/scoped_handle.h" #include "base/win/windows_version.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/chrome_process_finder_win.h" -#include "chrome/browser/metro_utils/metro_chrome_win.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/ui/simple_message_box.h" #include "chrome/common/chrome_constants.h" @@ -43,8 +41,6 @@ namespace { const char kLockfile[] = "lockfile"; -const int kMetroChromeActivationTimeoutMs = 3000; - // A helper class that acquires the given |mutex| while the AutoLockMutex is in // scope. class AutoLockMutex { @@ -318,8 +314,6 @@ ProcessSingleton::NotifyOtherProcessOrCreate() { // directory path. bool ProcessSingleton::Create() { static const wchar_t kMutexName[] = L"Local\\ChromeProcessSingletonStartup!"; - static const wchar_t kMetroActivationEventName[] = - L"Local\\ChromeProcessSingletonStartupMetroActivation!"; remote_window_ = chrome::FindRunningChromeWindow(user_data_dir_); if (!remote_window_ && !EscapeVirtualization(user_data_dir_)) { @@ -342,57 +336,6 @@ bool ProcessSingleton::Create() { // was given to us. remote_window_ = chrome::FindRunningChromeWindow(user_data_dir_); - - // In Win8+, a new Chrome process launched in Desktop mode may need to be - // transmuted into Metro Chrome (see ShouldLaunchInWindows8ImmersiveMode for - // heuristics). To accomplish this, the current Chrome activates Metro - // Chrome, releases the startup mutex, and waits for metro Chrome to take - // the singleton. From that point onward, the command line for this Chrome - // process will be sent to Metro Chrome by the usual channels. - if (!remote_window_ && base::win::GetVersion() >= base::win::VERSION_WIN8 && - !base::win::IsMetroProcess()) { - // |metro_activation_event| is created right before activating a Metro - // Chrome (note that there can only be one Metro Chrome process; by OS - // design); all following Desktop processes will then wait for this event - // to be signaled by Metro Chrome which will do so as soon as it grabs - // this singleton (should any of the waiting processes timeout waiting for - // the signal they will try to grab the singleton for themselves which - // will result in a forced Desktop Chrome launch in the worst case). - base::win::ScopedHandle metro_activation_event( - ::OpenEvent(SYNCHRONIZE, FALSE, kMetroActivationEventName)); - if (!metro_activation_event.IsValid() && - ShouldLaunchInWindows8ImmersiveMode(user_data_dir_)) { - // No Metro activation is under way, but the desire is to launch in - // Metro mode: activate and rendez-vous with the activated process. - metro_activation_event.Set( - ::CreateEvent(NULL, TRUE, FALSE, kMetroActivationEventName)); - if (!chrome::ActivateMetroChrome()) { - // Failed to launch immersive Chrome, default to launching on Desktop. - LOG(ERROR) << "Failed to launch immersive chrome"; - metro_activation_event.Close(); - } - } - - if (metro_activation_event.IsValid()) { - // Release |only_me| (to let Metro Chrome grab this singleton) and wait - // until the event is signaled (i.e. Metro Chrome was successfully - // activated). Ignore timeout waiting for |metro_activation_event|. - { - AutoUnlockMutex auto_unlock_only_me(only_me.Get()); - - DWORD result = ::WaitForSingleObject(metro_activation_event.Get(), - kMetroChromeActivationTimeoutMs); - DPCHECK(result == WAIT_OBJECT_0 || result == WAIT_TIMEOUT) - << "Result = " << result; - } - - // Check if this singleton was successfully grabbed by another process - // (hopefully Metro Chrome). Failing to do so, this process will grab - // the singleton and launch in Desktop mode. - remote_window_ = chrome::FindRunningChromeWindow(user_data_dir_); - } - } - if (!remote_window_) { // We have to make sure there is no Chrome instance running on another // machine that uses the same profile. @@ -419,15 +362,6 @@ bool ProcessSingleton::Create() { user_data_dir_.value()); CHECK(result && window_.hwnd()); } - - if (base::win::GetVersion() >= base::win::VERSION_WIN8) { - // Make sure no one is still waiting on Metro activation whether it - // succeeded (i.e., this is the Metro process) or failed. - base::win::ScopedHandle metro_activation_event( - ::OpenEvent(EVENT_MODIFY_STATE, FALSE, kMetroActivationEventName)); - if (metro_activation_event.IsValid()) - ::SetEvent(metro_activation_event.Get()); - } } } diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 4a86e19..5617427 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -110,7 +110,6 @@ #endif // !defined (OS_IOS) #if defined(OS_WIN) -#include "base/win/metro.h" #include "chrome/installer/util/browser_distribution.h" #endif diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index f53f0f1..50af02d 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -603,8 +603,8 @@ int ShellIntegration::MigrateShortcutsInPathInternal( base::string16 default_chromium_model_id( ShellUtil::GetBrowserModelId(dist, is_per_user_install)); if (check_dual_mode && expected_app_id == default_chromium_model_id) { - const bool dual_mode_desired = - InstallUtil::ShouldInstallMetroProperties(); + // TODO(scottmg): Simplify with no Metro: http://crbug.com/558054. + const bool dual_mode_desired = false; propvariant.Reset(); if (property_store->GetValue(PKEY_AppUserModel_IsDualMode, propvariant.Receive()) != S_OK) { diff --git a/chrome/browser/shell_integration_win_unittest.cc b/chrome/browser/shell_integration_win_unittest.cc index e6ec360..f3125be 100644 --- a/chrome/browser/shell_integration_win_unittest.cc +++ b/chrome/browser/shell_integration_win_unittest.cc @@ -36,9 +36,7 @@ struct ShortcutTestObject { class ShellIntegrationWinMigrateShortcutTest : public testing::Test { protected: - ShellIntegrationWinMigrateShortcutTest() - : desired_dual_mode_for_os_version( - InstallUtil::ShouldInstallMetroProperties()) {} + ShellIntegrationWinMigrateShortcutTest() {} void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); @@ -264,10 +262,6 @@ class ShellIntegrationWinMigrateShortcutTest : public testing::Test { // The app id of the example app for the non-default profile. base::string16 non_default_profile_extension_app_id_; - // True if the dual mode property should be set for the default chrome - // shortcut on the current OS version. - const bool desired_dual_mode_for_os_version; - private: DISALLOW_COPY_AND_ASSIGN(ShellIntegrationWinMigrateShortcutTest); }; @@ -322,13 +316,10 @@ TEST_F(ShellIntegrationWinMigrateShortcutTest, CheckDualMode) { // 9 shortcuts should have their app id updated below. - // If |desired_dual_mode_for_os_version| is true: shortcut 2 and 13 should - // also be migrated to dual_mode for a total of 11 shortcuts migrated. - // If |desired_dual_mode_for_os_version| is false: shortcut 11 should - // be migrate away from dual_mode for a total of 10 shortcuts migrated. - EXPECT_EQ(desired_dual_mode_for_os_version ? 11 : 10, - ShellIntegration::MigrateShortcutsInPathInternal( - chrome_exe_, temp_dir_.path(), true)); + // shortcut 11 should be migrate away from dual_mode for a total of 10 + // shortcuts migrated. + EXPECT_EQ(10, ShellIntegration::MigrateShortcutsInPathInternal( + chrome_exe_, temp_dir_.path(), true)); // Shortcut 1, 3, 4, 5, 6, 7, 8, 9, and 10 should have had both their app_id // fixed and shortcut 1, 2, 3, 4, and 5 should also have had their dual_mode @@ -347,16 +338,7 @@ TEST_F(ShellIntegrationWinMigrateShortcutTest, CheckDualMode) { // Explicitly flag the expected dual_mode properties. shortcuts_[0].properties.set_dual_mode(false); - if (desired_dual_mode_for_os_version) { - shortcuts_[1].properties.set_dual_mode(true); - shortcuts_[2].properties.set_dual_mode(true); - shortcuts_[3].properties.set_dual_mode(true); - shortcuts_[4].properties.set_dual_mode(true); - shortcuts_[5].properties.set_dual_mode(true); - shortcuts_[12].properties.set_dual_mode(true); - } else { - shortcuts_[11].properties.set_dual_mode(false); - } + shortcuts_[11].properties.set_dual_mode(false); shortcuts_[6].properties.set_dual_mode(false); shortcuts_[7].properties.set_dual_mode(false); shortcuts_[8].properties.set_dual_mode(false); diff --git a/chrome/browser/tab_contents/navigation_metrics_recorder.cc b/chrome/browser/tab_contents/navigation_metrics_recorder.cc index 81fac73..8ee3fdd 100644 --- a/chrome/browser/tab_contents/navigation_metrics_recorder.cc +++ b/chrome/browser/tab_contents/navigation_metrics_recorder.cc @@ -20,7 +20,6 @@ #if defined(OS_WIN) #include "base/win/windows_version.h" -#include "chrome/browser/metro_utils/metro_chrome_win.h" #endif DEFINE_WEB_CONTENTS_USER_DATA_KEY(NavigationMetricsRecorder); @@ -49,23 +48,3 @@ void NavigationMetricsRecorder::DidNavigateMainFrame( details.previous_url); } } - -void NavigationMetricsRecorder::DidStartLoading() { -#if defined(OS_WIN) && defined(USE_ASH) - content::RenderViewHost* rvh = web_contents()->GetRenderViewHost(); - - if (rvh && base::win::GetVersion() >= base::win::VERSION_WIN8) { - content::RenderWidgetHostView* rwhv = rvh->GetWidget()->GetView(); - if (rwhv) { - gfx::NativeView native_view = rwhv->GetNativeView(); - if (native_view) { - chrome::HostDesktopType desktop = - chrome::GetHostDesktopTypeForNativeView(native_view); - UMA_HISTOGRAM_ENUMERATION("Win8.PageLoad", - chrome::GetWin8Environment(desktop), - chrome::WIN_8_ENVIRONMENT_MAX); - } - } - } -#endif -} diff --git a/chrome/browser/tab_contents/navigation_metrics_recorder.h b/chrome/browser/tab_contents/navigation_metrics_recorder.h index c5c8890..80d0ac0 100644 --- a/chrome/browser/tab_contents/navigation_metrics_recorder.h +++ b/chrome/browser/tab_contents/navigation_metrics_recorder.h @@ -24,8 +24,6 @@ class NavigationMetricsRecorder const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) override; - void DidStartLoading() override; - DISALLOW_COPY_AND_ASSIGN(NavigationMetricsRecorder); }; diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index b623e2e..4ac1c60 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -390,7 +390,6 @@ source_set("ui") { "//ui/views/controls/webview", ] deps += [ - "//chrome/browser/metro_utils", "//chrome/installer/util:strings", "//components/search_engines", "//google_update", diff --git a/chrome/browser/ui/apps/apps_metro_handler_win.cc b/chrome/browser/ui/apps/apps_metro_handler_win.cc deleted file mode 100644 index fa371ad..0000000 --- a/chrome/browser/ui/apps/apps_metro_handler_win.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2013 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 "chrome/browser/ui/apps/apps_metro_handler_win.h" - -#include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/apps/app_window_registry_util.h" -#include "chrome/browser/ui/simple_message_box.h" -#include "chrome/grit/chromium_strings.h" -#include "chrome/grit/generated_resources.h" -#include "extensions/browser/app_window/app_window.h" -#include "ui/base/l10n/l10n_util.h" - -bool VerifyASHSwitchForApps(gfx::NativeWindow parent_window, - int win_restart_command_id) { - DCHECK(win_restart_command_id == IDC_WIN_DESKTOP_RESTART || - win_restart_command_id == IDC_WIN8_METRO_RESTART || - win_restart_command_id == IDC_WIN_CHROMEOS_RESTART); - if (!AppWindowRegistryUtil::IsAppWindowVisibleInAnyProfile( - extensions::AppWindow::WINDOW_TYPE_DEFAULT)) { - return true; - } - - int string_id = 0; - switch (win_restart_command_id) { - case IDC_WIN8_METRO_RESTART: - string_id = IDS_WIN8_PROMPT_TO_CLOSE_APPS_FOR_METRO; - break; - case IDC_WIN_CHROMEOS_RESTART: - string_id = IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_CHROMEOS; - break; - default: - string_id = IDS_WIN_PROMPT_TO_CLOSE_APPS_FOR_DESKTOP; - break; - } - chrome::MessageBoxResult result = chrome::ShowMessageBox( - parent_window, - l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), - l10n_util::GetStringUTF16(string_id), - chrome::MESSAGE_BOX_TYPE_OK_CANCEL); - - return result == chrome::MESSAGE_BOX_RESULT_YES; -} diff --git a/chrome/browser/ui/apps/apps_metro_handler_win.h b/chrome/browser/ui/apps/apps_metro_handler_win.h deleted file mode 100644 index 19a0600..0000000 --- a/chrome/browser/ui/apps/apps_metro_handler_win.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 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. - -#ifndef CHROME_BROWSER_UI_APPS_APPS_METRO_HANDLER_WIN_H_ -#define CHROME_BROWSER_UI_APPS_APPS_METRO_HANDLER_WIN_H_ - -#include "ui/gfx/native_widget_types.h" - -// Check if there are apps running and if not, return true. Otherwise, Show a -// modal dialog on |parent| asking whether the user is OK with their packaged -// apps closing, in order to relaunch to or from Windows ASH mode. Returns true -// if the user clicks OK. -bool VerifyASHSwitchForApps(gfx::NativeWindow parent, - int win_restart_command_id); - -#endif // CHROME_BROWSER_UI_APPS_APPS_METRO_HANDLER_WIN_H_ diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 491252d..717381d 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -214,7 +214,6 @@ #if defined(OS_WIN) #include <windows.h> #include <shellapi.h> -#include "base/win/metro.h" #include "chrome/browser/task_manager/task_manager.h" #include "chrome/browser/ui/view_ids.h" #include "components/autofill/core/browser/autofill_ie_toolbar_import_win.h" @@ -383,8 +382,7 @@ Browser::Browser(const CreateParams& params) override_bounds_(params.initial_bounds), initial_show_state_(params.initial_show_state), is_session_restore_(params.is_session_restore), - host_desktop_type_( - BrowserWindow::AdjustHostDesktopType(params.host_desktop_type)), + host_desktop_type_(params.host_desktop_type), content_setting_bubble_model_delegate_( new BrowserContentSettingBubbleModelDelegate(this)), toolbar_model_delegate_(new BrowserToolbarModelDelegate(this)), diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index 4cf104e..2594407 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -58,9 +58,7 @@ #endif #if defined(OS_WIN) -#include "base/win/metro.h" #include "base/win/windows_version.h" -#include "chrome/browser/ui/apps/apps_metro_handler_win.h" #include "content/public/browser/gpu_data_manager.h" #endif @@ -118,73 +116,6 @@ bool HasInternalURL(const NavigationEntry* entry) { return false; } -#if defined(OS_WIN) -// Windows 8 specific helper class to manage DefaultBrowserWorker. It does the -// following asynchronous actions in order: -// 1- Check that chrome is the default browser -// 2- If we are the default, restart chrome in metro and exit -// 3- If not the default browser show the 'select default browser' system dialog -// 4- When dialog dismisses check again who got made the default -// 5- If we are the default then restart chrome in metro and exit -// 6- If we are not the default exit. -// -// Note: this class deletes itself. -class SwitchToMetroUIHandler - : public ShellIntegration::DefaultWebClientObserver { - public: - SwitchToMetroUIHandler() - : default_browser_worker_( - new ShellIntegration::DefaultBrowserWorker(this)), - first_check_(true) { - default_browser_worker_->StartCheckIsDefault(); - } - - ~SwitchToMetroUIHandler() override { - default_browser_worker_->ObserverDestroyed(); - } - - private: - void SetDefaultWebClientUIState( - ShellIntegration::DefaultWebClientUIState state) override { - switch (state) { - case ShellIntegration::STATE_PROCESSING: - return; - case ShellIntegration::STATE_UNKNOWN : - break; - case ShellIntegration::STATE_IS_DEFAULT: - chrome::AttemptRestartToMetroMode(); - break; - case ShellIntegration::STATE_NOT_DEFAULT: - if (first_check_) { - default_browser_worker_->StartSetAsDefault(); - return; - } - break; - default: - NOTREACHED(); - } - delete this; - } - - void OnSetAsDefaultConcluded(bool success) override { - if (!success) { - delete this; - return; - } - first_check_ = false; - } - - bool IsInteractiveSetDefaultPermitted() override { - return true; - } - - scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; - bool first_check_; - - DISALLOW_COPY_AND_ASSIGN(SwitchToMetroUIHandler); -}; -#endif // defined(OS_WIN) - } // namespace namespace chrome { @@ -499,32 +430,12 @@ void BrowserCommandController::ExecuteCommandWithDisposition( case IDC_METRO_SNAP_DISABLE: browser_->SetMetroSnapMode(false); break; + // TODO(scottmg): Remove entirely http://crbug.com/558054. case IDC_WIN_DESKTOP_RESTART: - if (!VerifyASHSwitchForApps(window()->GetNativeWindow(), id)) - break; - - chrome::AttemptRestartToDesktopMode(); - if (base::win::GetVersion() >= base::win::VERSION_WIN8) { - content::RecordAction(base::UserMetricsAction("Win8DesktopRestart")); - } else { - content::RecordAction(base::UserMetricsAction("Win7DesktopRestart")); - } break; + // TODO(scottmg): Remove entirely http://crbug.com/558054. case IDC_WIN8_METRO_RESTART: case IDC_WIN_CHROMEOS_RESTART: - if (!VerifyASHSwitchForApps(window()->GetNativeWindow(), id)) - break; - if (base::win::GetVersion() >= base::win::VERSION_WIN8) { - // SwitchToMetroUIHandler deletes itself. - new SwitchToMetroUIHandler; - content::RecordAction(base::UserMetricsAction("Win8MetroRestart")); - } else { - content::RecordAction(base::UserMetricsAction("Win7ASHRestart")); - chrome::AttemptRestartToMetroMode(); - } - break; - case IDC_PIN_TO_START_SCREEN: - TogglePagePinnedToStartScreen(browser_); break; #endif diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc index c6b7bb9..00d121a5 100644 --- a/chrome/browser/ui/browser_commands.cc +++ b/chrome/browser/ui/browser_commands.cc @@ -85,10 +85,6 @@ #include "net/base/escape.h" #include "ui/events/keycodes/keyboard_codes.h" -#if defined(OS_WIN) -#include "chrome/browser/ui/metro_pin_tab_helper_win.h" -#endif - #if defined(ENABLE_EXTENSIONS) #include "chrome/browser/extensions/api/commands/command_service.h" #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" @@ -848,14 +844,6 @@ void ManagePasswordsForPage(Browser* browser) { !controller->IsAutomaticallyOpeningBubble()); } -#if defined(OS_WIN) -void TogglePagePinnedToStartScreen(Browser* browser) { - MetroPinTabHelper::FromWebContents( - browser->tab_strip_model()->GetActiveWebContents())-> - TogglePinnedToStartScreen(); -} -#endif - void SavePage(Browser* browser) { content::RecordAction(UserMetricsAction("SavePage")); WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents(); diff --git a/chrome/browser/ui/browser_commands.h b/chrome/browser/ui/browser_commands.h index 81f30e5..e668084 100644 --- a/chrome/browser/ui/browser_commands.h +++ b/chrome/browser/ui/browser_commands.h @@ -103,9 +103,6 @@ bool CanBookmarkAllTabs(const Browser* browser); void SaveCreditCard(Browser* browser); void Translate(Browser* browser); void ManagePasswordsForPage(Browser* browser); -#if defined(OS_WIN) -void TogglePagePinnedToStartScreen(Browser* browser); -#endif void SavePage(Browser* browser); bool CanSavePage(const Browser* browser); void ShowFindBar(Browser* browser); diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 9b91bc2..8190853 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h @@ -361,12 +361,6 @@ class BrowserWindow : public ui::BaseWindow { // Construct a BrowserWindow implementation for the specified |browser|. static BrowserWindow* CreateBrowserWindow(Browser* browser); - // Returns a HostDesktopType that is compatible with the current Chrome window - // configuration. On Windows with Ash, this is always HOST_DESKTOP_TYPE_ASH - // while Chrome is running in Metro mode. Otherwise returns |desktop_type|. - static chrome::HostDesktopType AdjustHostDesktopType( - chrome::HostDesktopType desktop_type); - // Shows the avatar bubble on the window frame off of the avatar button with // the given mode. The Service Type specified by GAIA is provided as well. // |access_point| indicates the access point used to open the Gaia sign in diff --git a/chrome/browser/ui/cocoa/browser_window_factory_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_factory_cocoa.mm index 808cc18..5ba5199 100644 --- a/chrome/browser/ui/cocoa/browser_window_factory_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_factory_cocoa.mm @@ -14,9 +14,3 @@ BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { [[BrowserWindowController alloc] initWithBrowser:browser]; return [controller browserWindow]; } - -// static -chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( - chrome::HostDesktopType desktop_type) { - return desktop_type; -} diff --git a/chrome/browser/ui/metro_pin_tab_helper_win.cc b/chrome/browser/ui/metro_pin_tab_helper_win.cc deleted file mode 100644 index 2506a004..0000000 --- a/chrome/browser/ui/metro_pin_tab_helper_win.cc +++ /dev/null @@ -1,463 +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 "chrome/browser/ui/metro_pin_tab_helper_win.h" - -#include <stdint.h> - -#include <set> - -#include "base/base_paths.h" -#include "base/bind.h" -#include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/logging.h" -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/memory/ref_counted_memory.h" -#include "base/metrics/histogram.h" -#include "base/path_service.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/utf_string_conversions.h" -#include "base/win/metro.h" -#include "chrome/common/chrome_paths.h" -#include "components/favicon/content/content_favicon_driver.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/web_contents.h" -#include "crypto/sha2.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "third_party/skia/include/core/SkColor.h" -#include "ui/gfx/canvas.h" -#include "ui/gfx/codec/png_codec.h" -#include "ui/gfx/color_analysis.h" -#include "ui/gfx/color_utils.h" -#include "ui/gfx/geometry/rect.h" -#include "ui/gfx/geometry/size.h" -#include "ui/gfx/image/image.h" - -DEFINE_WEB_CONTENTS_USER_DATA_KEY(MetroPinTabHelper); - -namespace { - -// Histogram name for site-specific tile pinning metrics. -const char kMetroPinMetric[] = "Metro.SecondaryTilePin"; - -// Generate an ID for the tile based on |url_str|. The ID is simply a hash of -// the URL. -base::string16 GenerateTileId(const base::string16& url_str) { - uint8_t hash[crypto::kSHA256Length]; - crypto::SHA256HashString(base::UTF16ToUTF8(url_str), hash, sizeof(hash)); - std::string hash_str = base::HexEncode(hash, sizeof(hash)); - return base::UTF8ToUTF16(hash_str); -} - -// Get the path of the directory to store the tile logos in. -base::FilePath GetTileImagesDir() { - base::FilePath tile_images_dir; - if (!PathService::Get(chrome::DIR_USER_DATA, &tile_images_dir)) - return base::FilePath(); - - tile_images_dir = tile_images_dir.Append(L"TileImages"); - if (!base::DirectoryExists(tile_images_dir) && - !base::CreateDirectory(tile_images_dir)) - return base::FilePath(); - - return tile_images_dir; -} - -// For the given |image| and |tile_id|, try to create a site specific logo in -// |logo_dir|. The path of any created logo is returned in |logo_path|. Return -// value indicates whether a site specific logo was created. -bool CreateSiteSpecificLogo(const SkBitmap& bitmap, - const base::string16& tile_id, - const base::FilePath& logo_dir, - base::FilePath* logo_path) { - const int kLogoWidth = 120; - const int kLogoHeight = 120; - const int kBoxWidth = 40; - const int kBoxHeight = 40; - const int kCaptionHeight = 20; - const double kBoxFade = 0.75; - - if (bitmap.isNull()) - return false; - - // Fill the tile logo with the dominant color of the favicon bitmap. - SkColor dominant_color = color_utils::CalculateKMeanColorOfBitmap(bitmap); - SkPaint paint; - paint.setColor(dominant_color); - gfx::Canvas canvas(gfx::Size(kLogoWidth, kLogoHeight), 1.0f, - true); - canvas.DrawRect(gfx::Rect(0, 0, kLogoWidth, kLogoHeight), paint); - - // Now paint a faded square for the favicon to go in. - color_utils::HSL shift = {-1, -1, kBoxFade}; - paint.setColor(color_utils::HSLShift(dominant_color, shift)); - int box_left = (kLogoWidth - kBoxWidth) / 2; - int box_top = (kLogoHeight - kCaptionHeight - kBoxHeight) / 2; - canvas.DrawRect(gfx::Rect(box_left, box_top, kBoxWidth, kBoxHeight), paint); - - // Now paint the favicon into the tile, leaving some room at the bottom for - // the caption. - int left = (kLogoWidth - bitmap.width()) / 2; - int top = (kLogoHeight - kCaptionHeight - bitmap.height()) / 2; - canvas.DrawImageInt(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), left, top); - - SkBitmap logo_bitmap = canvas.ExtractImageRep().sk_bitmap(); - std::vector<unsigned char> logo_png; - if (!gfx::PNGCodec::EncodeBGRASkBitmap(logo_bitmap, true, &logo_png)) - return false; - - *logo_path = logo_dir.Append(tile_id).ReplaceExtension(L".png"); - return base::WriteFile(*logo_path, - reinterpret_cast<char*>(&logo_png[0]), - logo_png.size()) > 0; -} - -// Get the path to the backup logo. If the backup logo already exists in -// |logo_dir|, it will be used, otherwise it will be copied out of the install -// folder. (The version in the install folder is not used as it may disappear -// after an upgrade, causing tiles to lose their images if Windows rebuilds -// its tile image cache.) -// The path to the logo is returned in |logo_path|, with the return value -// indicating success. -bool GetPathToBackupLogo(const base::FilePath& logo_dir, - base::FilePath* logo_path) { - const wchar_t kDefaultLogoFileName[] = L"SecondaryTile.png"; - *logo_path = logo_dir.Append(kDefaultLogoFileName); - if (base::PathExists(*logo_path)) - return true; - - base::FilePath default_logo_path; - if (!PathService::Get(base::DIR_MODULE, &default_logo_path)) - return false; - - default_logo_path = default_logo_path.Append(kDefaultLogoFileName); - return base::CopyFile(default_logo_path, *logo_path); -} - -// UMA reporting callback for site-specific secondary tile creation. -void PinPageReportUmaCallback( - base::win::MetroSecondaryTilePinUmaResult result) { - UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric, - result, - base::win::METRO_PIN_STATE_LIMIT); -} - -// The PinPageTaskRunner class performs the necessary FILE thread actions to -// pin a page, such as generating or copying the tile image file. When it -// has performed these actions it will send the tile creation request to the -// metro driver. -class PinPageTaskRunner : public base::RefCountedThreadSafe<PinPageTaskRunner> { - public: - // Creates a task runner for the pinning operation with the given details. - // |favicon| can be a null image (i.e. favicon.isNull() can be true), in - // which case the backup tile image will be used. - PinPageTaskRunner(const base::string16& title, - const base::string16& url, - const SkBitmap& favicon); - - void Run(); - void RunOnFileThread(); - - private: - ~PinPageTaskRunner() {} - - // Details of the page being pinned. - const base::string16 title_; - const base::string16 url_; - SkBitmap favicon_; - - friend class base::RefCountedThreadSafe<PinPageTaskRunner>; - DISALLOW_COPY_AND_ASSIGN(PinPageTaskRunner); -}; - -PinPageTaskRunner::PinPageTaskRunner(const base::string16& title, - const base::string16& url, - const SkBitmap& favicon) - : title_(title), - url_(url), - favicon_(favicon) {} - -void PinPageTaskRunner::Run() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - content::BrowserThread::PostTask( - content::BrowserThread::FILE, - FROM_HERE, - base::Bind(&PinPageTaskRunner::RunOnFileThread, this)); -} - -void PinPageTaskRunner::RunOnFileThread() { - DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); - - base::string16 tile_id = GenerateTileId(url_); - base::FilePath logo_dir = GetTileImagesDir(); - if (logo_dir.empty()) { - LOG(ERROR) << "Could not create directory to store tile image."; - return; - } - - base::FilePath logo_path; - if (!CreateSiteSpecificLogo(favicon_, tile_id, logo_dir, &logo_path) && - !GetPathToBackupLogo(logo_dir, &logo_path)) { - LOG(ERROR) << "Count not get path to logo tile."; - return; - } - - UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric, - base::win::METRO_PIN_LOGO_READY, - base::win::METRO_PIN_STATE_LIMIT); - - HMODULE metro_module = base::win::GetMetroModule(); - if (!metro_module) - return; - - base::win::MetroPinToStartScreen metro_pin_to_start_screen = - reinterpret_cast<base::win::MetroPinToStartScreen>( - ::GetProcAddress(metro_module, "MetroPinToStartScreen")); - if (!metro_pin_to_start_screen) { - NOTREACHED(); - return; - } - - metro_pin_to_start_screen(tile_id, - title_, - url_, - logo_path, - base::Bind(&PinPageReportUmaCallback)); -} - -} // namespace - -class MetroPinTabHelper::FaviconChooser { - public: - FaviconChooser(MetroPinTabHelper* helper, - const base::string16& title, - const base::string16& url, - const SkBitmap& history_bitmap); - - ~FaviconChooser() {} - - // Pin the page on the FILE thread using the current |best_candidate_| and - // delete the FaviconChooser. - void UseChosenCandidate(); - - // Update the |best_candidate_| with the newly downloaded favicons provided. - void UpdateCandidate(int id, - const GURL& image_url, - const std::vector<SkBitmap>& bitmaps); - - void AddPendingRequest(int request_id); - - private: - // The tab helper that this chooser is operating for. - MetroPinTabHelper* helper_; - - // Title and URL of the page being pinned. - const base::string16 title_; - const base::string16 url_; - - // The best candidate we have so far for the current pin operation. - SkBitmap best_candidate_; - - // Outstanding favicon download requests. - std::set<int> in_progress_requests_; - - DISALLOW_COPY_AND_ASSIGN(FaviconChooser); -}; - -MetroPinTabHelper::FaviconChooser::FaviconChooser( - MetroPinTabHelper* helper, - const base::string16& title, - const base::string16& url, - const SkBitmap& history_bitmap) - : helper_(helper), - title_(title), - url_(url), - best_candidate_(history_bitmap) {} - -void MetroPinTabHelper::FaviconChooser::UseChosenCandidate() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - scoped_refptr<PinPageTaskRunner> runner( - new PinPageTaskRunner(title_, url_, best_candidate_)); - runner->Run(); - helper_->FaviconDownloaderFinished(); -} - -void MetroPinTabHelper::FaviconChooser::UpdateCandidate( - int id, - const GURL& image_url, - const std::vector<SkBitmap>& bitmaps) { - const int kMaxIconSize = 32; - - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - std::set<int>::iterator iter = in_progress_requests_.find(id); - // Check that this request is one of ours. - if (iter == in_progress_requests_.end()) - return; - - in_progress_requests_.erase(iter); - - // Process the bitmaps, keeping the one that is best so far. - for (std::vector<SkBitmap>::const_iterator iter = bitmaps.begin(); - iter != bitmaps.end(); - ++iter) { - - // If the new bitmap is too big, ignore it. - if (iter->height() > kMaxIconSize || iter->width() > kMaxIconSize) - continue; - - // If we don't have a best candidate yet, this is better so just grab it. - if (best_candidate_.isNull()) { - best_candidate_ = *iter; - continue; - } - - // If it is smaller than our best one so far, ignore it. - if (iter->height() <= best_candidate_.height() || - iter->width() <= best_candidate_.width()) { - continue; - } - - // Othewise it is our new best candidate. - best_candidate_ = *iter; - } - - // If there are no more outstanding requests, pin the page on the FILE thread. - // Once this happens this downloader has done its job, so delete it. - if (in_progress_requests_.empty()) - UseChosenCandidate(); -} - -void MetroPinTabHelper::FaviconChooser::AddPendingRequest(int request_id) { - in_progress_requests_.insert(request_id); -} - -MetroPinTabHelper::MetroPinTabHelper(content::WebContents* web_contents) - : content::WebContentsObserver(web_contents) { -} - -MetroPinTabHelper::~MetroPinTabHelper() {} - -bool MetroPinTabHelper::IsPinned() const { - HMODULE metro_module = base::win::GetMetroModule(); - if (!metro_module) - return false; - - typedef BOOL (*MetroIsPinnedToStartScreen)(const base::string16&); - MetroIsPinnedToStartScreen metro_is_pinned_to_start_screen = - reinterpret_cast<MetroIsPinnedToStartScreen>( - ::GetProcAddress(metro_module, "MetroIsPinnedToStartScreen")); - if (!metro_is_pinned_to_start_screen) { - NOTREACHED(); - return false; - } - - GURL url = web_contents()->GetURL(); - base::string16 tile_id = GenerateTileId(base::UTF8ToUTF16(url.spec())); - return metro_is_pinned_to_start_screen(tile_id) != 0; -} - -void MetroPinTabHelper::TogglePinnedToStartScreen() { - if (IsPinned()) { - UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric, - base::win::METRO_UNPIN_INITIATED, - base::win::METRO_PIN_STATE_LIMIT); - UnPinPageFromStartScreen(); - return; - } - - UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric, - base::win::METRO_PIN_INITIATED, - base::win::METRO_PIN_STATE_LIMIT); - GURL url = web_contents()->GetURL(); - base::string16 url_str = base::UTF8ToUTF16(url.spec()); - base::string16 title = web_contents()->GetTitle(); - // TODO(oshima): Use scoped_ptr::Pass to pass it to other thread. - SkBitmap favicon; - favicon::FaviconDriver* favicon_driver = - favicon::ContentFaviconDriver::FromWebContents(web_contents()); - if (favicon_driver->FaviconIsValid()) { - // Only the 1x bitmap data is needed. - favicon = favicon_driver->GetFavicon() - .AsImageSkia() - .GetRepresentation(1.0f) - .sk_bitmap(); - } - - favicon_chooser_.reset(new FaviconChooser(this, title, url_str, favicon)); - - if (favicon_url_candidates_.empty()) { - favicon_chooser_->UseChosenCandidate(); - return; - } - - // Request all the candidates. - int max_image_size = 0; // Do not resize images. - for (std::vector<content::FaviconURL>::const_iterator iter = - favicon_url_candidates_.begin(); - iter != favicon_url_candidates_.end(); - ++iter) { - favicon_chooser_->AddPendingRequest( - web_contents()->DownloadImage(iter->icon_url, - true, - max_image_size, - false, - base::Bind(&MetroPinTabHelper::DidDownloadFavicon, - base::Unretained(this)))); - } - -} - -void MetroPinTabHelper::DidNavigateMainFrame( - const content::LoadCommittedDetails& /*details*/, - const content::FrameNavigateParams& /*params*/) { - // Cancel any outstanding pin operations once the user navigates away from - // the page. - if (favicon_chooser_.get()) - favicon_chooser_.reset(); - // Any candidate favicons we have are now out of date so clear them. - favicon_url_candidates_.clear(); -} - -void MetroPinTabHelper::DidUpdateFaviconURL( - const std::vector<content::FaviconURL>& candidates) { - favicon_url_candidates_ = candidates; -} - -void MetroPinTabHelper::DidDownloadFavicon( - int id, - int http_status_code, - const GURL& image_url, - const std::vector<SkBitmap>& bitmaps, - const std::vector<gfx::Size>& original_bitmap_sizes) { - if (favicon_chooser_.get()) { - favicon_chooser_->UpdateCandidate(id, image_url, bitmaps); - } -} - -void MetroPinTabHelper::UnPinPageFromStartScreen() { - HMODULE metro_module = base::win::GetMetroModule(); - if (!metro_module) - return; - - base::win::MetroUnPinFromStartScreen metro_un_pin_from_start_screen = - reinterpret_cast<base::win::MetroUnPinFromStartScreen>( - ::GetProcAddress(metro_module, "MetroUnPinFromStartScreen")); - if (!metro_un_pin_from_start_screen) { - NOTREACHED(); - return; - } - - GURL url = web_contents()->GetURL(); - base::string16 tile_id = GenerateTileId(base::UTF8ToUTF16(url.spec())); - metro_un_pin_from_start_screen(tile_id, - base::Bind(&PinPageReportUmaCallback)); -} - -void MetroPinTabHelper::FaviconDownloaderFinished() { - favicon_chooser_.reset(); -} diff --git a/chrome/browser/ui/metro_pin_tab_helper_win.h b/chrome/browser/ui/metro_pin_tab_helper_win.h deleted file mode 100644 index 6018f59..0000000 --- a/chrome/browser/ui/metro_pin_tab_helper_win.h +++ /dev/null @@ -1,70 +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. - -#ifndef CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_ -#define CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_ - -#include <vector> - -#include "base/macros.h" -#include "content/public/browser/web_contents_observer.h" -#include "content/public/browser/web_contents_user_data.h" -#include "content/public/common/favicon_url.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "ui/gfx/image/image_skia.h" - -namespace gfx { -class Size; -} - -// Per-tab class to help manage metro pinning. -class MetroPinTabHelper - : public content::WebContentsObserver, - public content::WebContentsUserData<MetroPinTabHelper> { - public: - ~MetroPinTabHelper() override; - - bool IsPinned() const; - - void TogglePinnedToStartScreen(); - - // content::WebContentsObserver overrides: - void DidNavigateMainFrame( - const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) override; - void DidUpdateFaviconURL( - const std::vector<content::FaviconURL>& candidates) override; - - private: - // The FaviconDownloader class handles downloading the favicons when a page - // is being pinned. After it has downloaded any available favicons it will - // continue on with the page pinning action. - class FaviconChooser; - - explicit MetroPinTabHelper(content::WebContents* web_contents); - friend class content::WebContentsUserData<MetroPinTabHelper>; - - // Favicon download callback. - void DidDownloadFavicon(int id, - int http_status_code, - const GURL& image_url, - const std::vector<SkBitmap>& bitmaps, - const std::vector<gfx::Size>& original_bitmap_sizes); - - void UnPinPageFromStartScreen(); - - // Called by the |favicon_chooser_| when it has finished. - void FaviconDownloaderFinished(); - - // Candidate Favicon URLs for the current page. - std::vector<content::FaviconURL> favicon_url_candidates_; - - // The currently active FaviconChooser, if there is one. - scoped_ptr<FaviconChooser> favicon_chooser_; - - - DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); -}; - -#endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_ diff --git a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc index 0906e09..796a51f 100644 --- a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc +++ b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc @@ -38,7 +38,6 @@ #include "ui/base/webui/jstemplate_builder.h" #if defined(OS_WIN) -#include "base/win/metro.h" #include "chrome/browser/ui/pdf/adobe_reader_info_win.h" #endif @@ -275,9 +274,6 @@ base::string16 PDFUnsupportedFeaturePromptClient::GetMessageText() const { } base::string16 PDFUnsupportedFeaturePromptClient::GetAcceptButtonText() const { - if (base::win::IsMetroProcess()) - return l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_METRO_MODE_LINK); - return l10n_util::GetStringUTF16( reader_info_.is_installed ? IDS_PDF_BUBBLE_OPEN_IN_READER_LINK : IDS_PDF_BUBBLE_INSTALL_READER_LINK); @@ -293,11 +289,6 @@ bool PDFUnsupportedFeaturePromptClient::ShouldExpire( } void PDFUnsupportedFeaturePromptClient::Accept() { - if (base::win::IsMetroProcess()) { - chrome::AttemptRestartToDesktopMode(); - return; - } - if (!reader_info_.is_installed) { content::RecordAction(UserMetricsAction("PDF_InstallReaderInfoBarOK")); OpenReaderUpdateURL(web_contents_); diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc index 69964d2..97a1586 100644 --- a/chrome/browser/ui/tab_helpers.cc +++ b/chrome/browser/ui/tab_helpers.cc @@ -73,10 +73,6 @@ #include "components/web_modal/web_contents_modal_dialog_manager.h" #endif // BUILDFLAG(ANDROID_JAVA_UI) -#if defined(OS_WIN) -#include "chrome/browser/ui/metro_pin_tab_helper_win.h" -#endif - #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" #endif @@ -212,10 +208,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { } #endif -#if defined(OS_WIN) - MetroPinTabHelper::CreateForWebContents(web_contents); -#endif - // --- Feature tab helpers behind flags --- #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) diff --git a/chrome/browser/ui/toolbar/app_menu_model.cc b/chrome/browser/ui/toolbar/app_menu_model.cc index ddfc0f9..77bb332 100644 --- a/chrome/browser/ui/toolbar/app_menu_model.cc +++ b/chrome/browser/ui/toolbar/app_menu_model.cc @@ -74,11 +74,9 @@ #endif #if defined(OS_WIN) -#include "base/win/metro.h" #include "base/win/shortcut.h" #include "base/win/windows_version.h" #include "chrome/browser/enumerate_modules_model_win.h" -#include "chrome/browser/ui/metro_pin_tab_helper_win.h" #include "content/public/browser/gpu_data_manager.h" #endif @@ -384,13 +382,7 @@ base::string16 AppMenuModel::GetLabelForCommandId(int command_id) const { #elif defined(OS_WIN) case IDC_PIN_TO_START_SCREEN: { int string_id = IDS_PIN_TO_START_SCREEN; - WebContents* web_contents = - browser_->tab_strip_model()->GetActiveWebContents(); - MetroPinTabHelper* tab_helper = - web_contents ? MetroPinTabHelper::FromWebContents(web_contents) - : NULL; - if (tab_helper && tab_helper->IsPinned()) - string_id = IDS_UNPIN_FROM_START_SCREEN; + // TODO(scottmg): Remove http://crbug.com/558054. return l10n_util::GetStringUTF16(string_id); } #endif @@ -770,7 +762,7 @@ bool AppMenuModel::IsCommandIdVisible(int command_id) const { return true; } case IDC_PIN_TO_START_SCREEN: - return base::win::IsMetroProcess(); + return false; #else case IDC_VIEW_INCOMPATIBILITIES: case IDC_PIN_TO_START_SCREEN: diff --git a/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc b/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc index 743c4d1..b2ff1d4 100644 --- a/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc +++ b/chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/app_list/win/app_list_controller_delegate_win.h" -#include "chrome/browser/metro_utils/metro_chrome_win.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_icon_win.h" #include "chrome/browser/ui/extensions/application_launch.h" @@ -31,14 +30,4 @@ gfx::ImageSkia AppListControllerDelegateWin::GetWindowIcon() { void AppListControllerDelegateWin::FillLaunchParams(AppLaunchParams* params) { params->desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; - extensions::AppWindow* any_existing_window = - extensions::AppWindowRegistry::Get(params->profile) - ->GetCurrentAppWindowForApp(params->extension_id); - if (any_existing_window && - chrome::GetHostDesktopTypeForNativeWindow( - any_existing_window->GetNativeWindow()) - != chrome::HOST_DESKTOP_TYPE_NATIVE) { - params->desktop_type = chrome::HOST_DESKTOP_TYPE_ASH; - chrome::ActivateMetroChrome(); - } } diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc index eaa1ec6..ce273c0 100644 --- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc +++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc @@ -12,7 +12,6 @@ #include "base/threading/sequenced_worker_pool.h" #include "chrome/browser/apps/per_app_settings_service.h" #include "chrome/browser/apps/per_app_settings_service_factory.h" -#include "chrome/browser/metro_utils/metro_chrome_win.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/ui/views/apps/app_window_desktop_native_widget_aura_win.h" @@ -39,16 +38,6 @@ ChromeNativeAppWindowViewsWin::ChromeNativeAppWindowViewsWin() ChromeNativeAppWindowViewsWin::~ChromeNativeAppWindowViewsWin() { } -void ChromeNativeAppWindowViewsWin::ActivateParentDesktopIfNecessary() { - // Only switching into Ash from Native is supported. Tearing the user out of - // Metro mode can only be done by launching a process from Metro mode itself. - // This is done for launching apps, but not regular activations. - if (IsRunningInAsh() && - chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_NATIVE) { - chrome::ActivateMetroChrome(); - } -} - HWND ChromeNativeAppWindowViewsWin::GetNativeAppWindowHWND() const { return views::HWNDForWidget(widget()->GetTopLevelWidget()); } @@ -149,16 +138,6 @@ ChromeNativeAppWindowViewsWin::CreateStandardDesktopAppFrame() { return ChromeNativeAppWindowViewsAura::CreateStandardDesktopAppFrame(); } -void ChromeNativeAppWindowViewsWin::Show() { - ActivateParentDesktopIfNecessary(); - ChromeNativeAppWindowViewsAura::Show(); -} - -void ChromeNativeAppWindowViewsWin::Activate() { - ActivateParentDesktopIfNecessary(); - ChromeNativeAppWindowViewsAura::Activate(); -} - bool ChromeNativeAppWindowViewsWin::CanMinimize() const { // Resizing on Windows breaks translucency if the window also has shape. // See http://crbug.com/417947. diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h index 4c14562..bf093ee 100644 --- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h +++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h @@ -26,8 +26,6 @@ class ChromeNativeAppWindowViewsWin : public ChromeNativeAppWindowViewsAura { } private: - void ActivateParentDesktopIfNecessary(); - void OnShortcutInfoLoaded( const web_app::ShortcutInfo& shortcut_info); @@ -44,10 +42,6 @@ class ChromeNativeAppWindowViewsWin : public ChromeNativeAppWindowViewsAura { const extensions::AppWindow::CreateParams& create_params) override; views::NonClientFrameView* CreateStandardDesktopAppFrame() override; - // Overridden from ui::BaseWindow: - void Show() override; - void Activate() override; - // Overridden from views::WidgetDelegate: bool CanMinimize() const override; diff --git a/chrome/browser/ui/views/frame/browser_frame_ashwin.cc b/chrome/browser/ui/views/frame/browser_frame_ashwin.cc deleted file mode 100644 index fb009a2..0000000 --- a/chrome/browser/ui/views/frame/browser_frame_ashwin.cc +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2013 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 "chrome/browser/ui/views/frame/browser_frame_ashwin.h" - -#include "base/bind.h" -#include "base/message_loop/message_loop.h" -#include "chrome/browser/browser_shutdown.h" -#include "chrome/browser/metro_utils/metro_chrome_win.h" -#include "ui/aura/remote_window_tree_host_win.h" - -BrowserFrameAshWin::BrowserFrameAshWin(BrowserFrame* browser_frame, - BrowserView* browser_view) - : BrowserFrameAsh(browser_frame, browser_view) { -} - -BrowserFrameAshWin::~BrowserFrameAshWin() { -} - -void BrowserFrameAshWin::OnWindowFocused(aura::Window* gained_focus, - aura::Window* lost_focus) { - BrowserFrameAsh::OnWindowFocused(gained_focus, lost_focus); - if (GetNativeWindow() != gained_focus) - return; - - // TODO(shrikant): We need better way to handle chrome activation. - // There may be cases where focus events do not follow a user - // action to create or focus a window - - // If the activated window is in Metro mode, and the viewer process window is - // not in the foreground, activate Metro Chrome. - if (aura::RemoteWindowTreeHostWin::IsValid() && - !aura::RemoteWindowTreeHostWin::Instance()->IsForegroundWindow() && - !browser_shutdown::IsTryingToQuit()) { - // PostTask because ActivateMetroChrome can not be called nested in another - // ::SendMessage(). - base::MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome))); - } -} diff --git a/chrome/browser/ui/views/frame/browser_frame_ashwin.h b/chrome/browser/ui/views/frame/browser_frame_ashwin.h deleted file mode 100644 index 9411852..0000000 --- a/chrome/browser/ui/views/frame/browser_frame_ashwin.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 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. - -#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_ASHWIN_H_ -#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_ASHWIN_H_ - -#include "base/macros.h" -#include "chrome/browser/ui/views/frame/browser_frame_ash.h" - -// A NativeWidgetAura subclass that provides Windows-specific behavior on the -// Ash desktop for Metro mode. -class BrowserFrameAshWin : public BrowserFrameAsh { - public: - BrowserFrameAshWin(BrowserFrame* browser_frame, BrowserView* browser_view); - - protected: - ~BrowserFrameAshWin() override; - - // Overridden from aura::client::ActivationChangeObserver: - void OnWindowFocused(aura::Window* gained_focus, - aura::Window* lost_focus) override; - - private: - DISALLOW_COPY_AND_ASSIGN(BrowserFrameAshWin); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_ASHWIN_H_ diff --git a/chrome/browser/ui/views/frame/browser_window_factory.cc b/chrome/browser/ui/views/frame/browser_window_factory.cc index 7db63a8..1f66083 100644 --- a/chrome/browser/ui/views/frame/browser_window_factory.cc +++ b/chrome/browser/ui/views/frame/browser_window_factory.cc @@ -20,9 +20,3 @@ BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); return view; } - -// static -chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( - chrome::HostDesktopType desktop_type) { - return NativeBrowserFrameFactory::AdjustHostDesktopType(desktop_type); -} diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory.cc b/chrome/browser/ui/views/frame/native_browser_frame_factory.cc index 45b1c75..234e390 100644 --- a/chrome/browser/ui/views/frame/native_browser_frame_factory.cc +++ b/chrome/browser/ui/views/frame/native_browser_frame_factory.cc @@ -27,20 +27,3 @@ void NativeBrowserFrameFactory::Set(NativeBrowserFrameFactory* new_factory) { delete factory; factory = new_factory; } - -#if !defined(OS_WIN) -// static -chrome::HostDesktopType NativeBrowserFrameFactory::AdjustHostDesktopType( - chrome::HostDesktopType desktop_type) { - return desktop_type; -} -#endif // !defined(OS_WIN) - -#if !defined(USE_ASH) || defined(OS_CHROMEOS) -// static -bool NativeBrowserFrameFactory::ShouldCreateForAshDesktop( - BrowserView* browser_view) { - NOTREACHED(); - return false; -} -#endif // !defined(OS_WIN) || !defined(USE_ASH) diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory.h b/chrome/browser/ui/views/frame/native_browser_frame_factory.h index 77ac886..7706a1d 100644 --- a/chrome/browser/ui/views/frame/native_browser_frame_factory.h +++ b/chrome/browser/ui/views/frame/native_browser_frame_factory.h @@ -24,11 +24,6 @@ class NativeBrowserFrameFactory { // factory. Use null to go back to default factory. static void Set(NativeBrowserFrameFactory* new_factory); - // Returns HOST_DESKTOP_TYPE_ASH on Windows when configured to allow browser - // windows only in Metro mode, otherwise |desktop_type|. - static chrome::HostDesktopType AdjustHostDesktopType( - chrome::HostDesktopType desktop_type); - virtual NativeBrowserFrame* Create(BrowserFrame* browser_frame, BrowserView* browser_view); @@ -37,10 +32,6 @@ class NativeBrowserFrameFactory { virtual ~NativeBrowserFrameFactory() {} private: - // For Chrome running on desktop platforms, returns true if the factory should - // create an ash browser frame for the provided |browser_view|. - static bool ShouldCreateForAshDesktop(BrowserView* browser_view); - DISALLOW_COPY_AND_ASSIGN(NativeBrowserFrameFactory); }; diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory_auralinux.cc b/chrome/browser/ui/views/frame/native_browser_frame_factory_auralinux.cc index 16e4cd1..f45b2a2 100644 --- a/chrome/browser/ui/views/frame/native_browser_frame_factory_auralinux.cc +++ b/chrome/browser/ui/views/frame/native_browser_frame_factory_auralinux.cc @@ -6,10 +6,6 @@ #include "chrome/browser/ui/views/frame/desktop_browser_frame_auralinux.h" -#if defined(USE_ASH) -#include "chrome/browser/ui/views/frame/browser_frame_ash.h" -#endif - #if defined(MOJO_SHELL_CLIENT) #include "chrome/browser/ui/views/frame/browser_frame_mus.h" #include "content/public/common/mojo_shell_connection.h" @@ -23,10 +19,5 @@ NativeBrowserFrame* NativeBrowserFrameFactory::Create( return new BrowserFrameMus(browser_frame, browser_view); #endif -#if defined(USE_ASH) - if (ShouldCreateForAshDesktop(browser_view)) - return new BrowserFrameAsh(browser_frame, browser_view); -#endif - return new DesktopBrowserFrameAuraLinux(browser_frame, browser_view); } diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory_aurawin.cc b/chrome/browser/ui/views/frame/native_browser_frame_factory_aurawin.cc index 0b01bf0..0ec29e4 100644 --- a/chrome/browser/ui/views/frame/native_browser_frame_factory_aurawin.cc +++ b/chrome/browser/ui/views/frame/native_browser_frame_factory_aurawin.cc @@ -5,7 +5,6 @@ #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" #include "ash/shell.h" -#include "chrome/browser/ui/views/frame/browser_frame_ashwin.h" #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" #if defined(MOJO_SHELL_CLIENT) @@ -21,17 +20,5 @@ NativeBrowserFrame* NativeBrowserFrameFactory::Create( return new BrowserFrameMus(browser_frame, browser_view); #endif - if (ShouldCreateForAshDesktop(browser_view)) - return new BrowserFrameAshWin(browser_frame, browser_view); - return new DesktopBrowserFrameAura(browser_frame, browser_view); } - -// static -chrome::HostDesktopType NativeBrowserFrameFactory::AdjustHostDesktopType( - chrome::HostDesktopType desktop_type) { - if (ash::Shell::HasInstance()) - return chrome::HOST_DESKTOP_TYPE_ASH; - - return desktop_type; -} diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory_desktop_ash.cc b/chrome/browser/ui/views/frame/native_browser_frame_factory_desktop_ash.cc deleted file mode 100644 index de9a5e7..0000000 --- a/chrome/browser/ui/views/frame/native_browser_frame_factory_desktop_ash.cc +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 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 "chrome/browser/ui/views/frame/native_browser_frame_factory.h" - -#include "chrome/browser/ui/ash/ash_util.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/views/frame/browser_view.h" - -bool NativeBrowserFrameFactory::ShouldCreateForAshDesktop( - BrowserView* browser_view) { - return chrome::ShouldOpenAshOnStartup() || - browser_view->browser()->host_desktop_type() == - chrome::HOST_DESKTOP_TYPE_ASH; -} diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 0816301..d043e41 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -1586,21 +1586,6 @@ void BrowserOptionsHandler::HandleDefaultZoomFactor( } void BrowserOptionsHandler::HandleRestartBrowser(const base::ListValue* args) { -#if defined(OS_WIN) && defined(USE_ASH) - // If hardware acceleration is disabled then we need to force restart - // browser in desktop mode. - // TODO(shrikant): Remove this once we fix start mode logic for browser. - // Currently there are issues with determining correct browser mode - // at startup. - if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { - PrefService* pref_service = g_browser_process->local_state(); - if (!pref_service->GetBoolean(prefs::kHardwareAccelerationModeEnabled)) { - chrome::AttemptRestartToDesktopMode(); - return; - } - } -#endif - #if defined(OS_WIN) // On Windows Breakpad will upload crash reports if the breakpad pipe name // environment variable is defined. So we undefine this environment variable diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 7354112..69d800b 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -462,7 +462,6 @@ 'includes': [ 'chrome_watcher/chrome_watcher.gypi', 'chrome_process_finder.gypi', - 'metro_utils.gypi', ], }], # OS=="win" ['OS=="win" and target_arch=="ia32"', diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index deaff86..774c1da 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -326,7 +326,6 @@ 'browser/lifetime/application_lifetime.cc', 'browser/lifetime/application_lifetime.h', 'browser/lifetime/application_lifetime_mac.mm', - 'browser/lifetime/application_lifetime_win.cc', 'browser/mac/bluetooth_utility.h', 'browser/mac/bluetooth_utility.mm', 'browser/mac/dock.h', diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 749022b..5c4082d 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -96,8 +96,6 @@ 'browser/ui/login/login_prompt.h', 'browser/ui/media_utils.cc', 'browser/ui/media_utils.h', - 'browser/ui/metro_pin_tab_helper_win.cc', - 'browser/ui/metro_pin_tab_helper_win.h', 'browser/ui/navigation_correction_tab_observer.cc', 'browser/ui/navigation_correction_tab_observer.h', 'browser/ui/passwords/account_avatar_fetcher.cc', @@ -1343,7 +1341,6 @@ 'browser/ui/views/frame/global_menu_bar_x11.cc', 'browser/ui/views/frame/global_menu_bar_x11.h', 'browser/ui/views/frame/native_browser_frame_factory_auralinux.cc', - 'browser/ui/views/frame/native_browser_frame_factory_desktop_ash.cc', 'browser/ui/views/javascript_app_modal_dialog_views_x11.cc', 'browser/ui/views/javascript_app_modal_dialog_views_x11.h', 'browser/ui/views/status_icons/status_icon_linux_wrapper.cc', @@ -1496,8 +1493,6 @@ ], 'chrome_browser_ui_non_mobile_sources': [ 'browser/ui/apps/app_info_dialog.h', - 'browser/ui/apps/apps_metro_handler_win.cc', - 'browser/ui/apps/apps_metro_handler_win.h', 'browser/ui/apps/chrome_app_delegate.cc', 'browser/ui/apps/chrome_app_delegate.h', 'browser/ui/apps/chrome_app_window_client.cc', @@ -2529,12 +2524,9 @@ 'browser/ui/views/frame/browser_desktop_window_tree_host.h', 'browser/ui/views/frame/browser_desktop_window_tree_host_win.cc', 'browser/ui/views/frame/browser_desktop_window_tree_host_win.h', - 'browser/ui/views/frame/browser_frame_ashwin.cc', - 'browser/ui/views/frame/browser_frame_ashwin.h', 'browser/ui/views/frame/glass_browser_frame_view.cc', 'browser/ui/views/frame/glass_browser_frame_view.h', 'browser/ui/views/frame/native_browser_frame_factory_aurawin.cc', - 'browser/ui/views/frame/native_browser_frame_factory_desktop_ash.cc', 'browser/ui/views/network_profile_bubble_view.cc', 'browser/ui/views/network_profile_bubble_view.h', 'browser/ui/views/uninstall_view.cc', @@ -3166,7 +3158,6 @@ ], 'dependencies': [ 'installer_util_strings', - 'metro_utils', '../components/components.gyp:browser_watcher', '../components/components.gyp:search_engines', '../google_update/google_update.gyp:google_update', diff --git a/chrome/chrome_process_finder.gypi b/chrome/chrome_process_finder.gypi index f500058..26b4080 100644 --- a/chrome/chrome_process_finder.gypi +++ b/chrome/chrome_process_finder.gypi @@ -12,7 +12,6 @@ ], 'dependencies': [ '../base/base.gyp:base', - '../chrome/chrome.gyp:metro_utils', '../chrome/common_constants.gyp:common_constants', ], 'conditions': [ diff --git a/chrome/common/chrome_paths_win.cc b/chrome/common/chrome_paths_win.cc index 18073ca..78d3573 100644 --- a/chrome/common/chrome_paths_win.cc +++ b/chrome/common/chrome_paths_win.cc @@ -12,7 +12,6 @@ #include "base/files/file_path.h" #include "base/path_service.h" -#include "base/win/metro.h" #include "base/win/scoped_co_mem.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/common/extensions/api/plugins/plugins_handler.cc b/chrome/common/extensions/api/plugins/plugins_handler.cc index ec2b73e..4c38db8 100644 --- a/chrome/common/extensions/api/plugins/plugins_handler.cc +++ b/chrome/common/extensions/api/plugins/plugins_handler.cc @@ -20,10 +20,6 @@ #include "extensions/common/permissions/api_permission_set.h" #include "ui/base/l10n/l10n_util.h" -#if defined(OS_WIN) -#include "base/win/metro.h" -#endif - namespace extensions { namespace keys = manifest_keys; @@ -102,17 +98,13 @@ bool PluginsHandler::Parse(Extension* extension, base::string16* error) { } } - // We don't allow extensions to load NPAPI plugins on Chrome OS, or under - // Windows 8 Metro mode, but still parse the entries to display consistent - // error messages. If the extension actually requires the plugins then - // LoadRequirements will prevent it loading. + // We don't allow extensions to load NPAPI plugins on Chrome OS, but still + // parse the entries to display consistent error messages. If the extension + // actually requires the plugins then LoadRequirements will prevent it + // loading. #if defined(OS_CHROMEOS) continue; -#elif defined(OS_WIN) - if (base::win::IsMetroProcess()) { - continue; - } -#endif // defined(OS_WIN). +#endif // defined(OS_CHROMEOS). plugins_data->plugins.push_back(PluginInfo( extension->path().Append(base::FilePath::FromUTF8Unsafe(path_str)), is_public)); diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 3e41d6e..c6da5d1 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -397,8 +397,6 @@ void CreateOrUpdateShortcuts( // IMPORTANT: Only the default (no arguments and default browserappid) browser // shortcut in the Start menu (Start screen on Win8+) should be made dual // mode and that prior to Windows 10 only. - if (InstallUtil::ShouldInstallMetroProperties()) - start_menu_properties.set_dual_mode(true); if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS || shortcut_operation == ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL) { diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index d64219f..3f2a75d 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc @@ -90,8 +90,7 @@ class InstallShortcutTest : public testing::Test { expected_properties_.set_description(chrome_properties.description); expected_properties_.set_dual_mode(false); expected_start_menu_properties_ = expected_properties_; - expected_start_menu_properties_.set_dual_mode( - InstallUtil::ShouldInstallMetroProperties()); + expected_start_menu_properties_.set_dual_mode(false); prefs_.reset(GetFakeMasterPrefs(false, false)); diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 66a01ec..1305c56 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -976,8 +976,6 @@ installer::InstallStatus RegisterDevChrome( // Create the Start menu shortcut and pin it to the Win7+ taskbar. ShellUtil::ShortcutProperties shortcut_properties(ShellUtil::CURRENT_USER); chrome.AddDefaultShortcutProperties(chrome_exe, &shortcut_properties); - if (InstallUtil::ShouldInstallMetroProperties()) - shortcut_properties.set_dual_mode(true); shortcut_properties.set_pin_to_taskbar(true); ShellUtil::CreateOrUpdateShortcut( ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, chrome_dist, diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index 4163881..bfb888c 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -27,7 +27,6 @@ #include "base/sys_info.h" #include "base/values.h" #include "base/version.h" -#include "base/win/metro.h" #include "base/win/registry.h" #include "base/win/windows_version.h" #include "chrome/common/chrome_constants.h" @@ -130,13 +129,6 @@ HWND CreateUACForegroundWindow() { } // namespace -bool InstallUtil::ShouldInstallMetroProperties() { - // Install Metro properties on Windows versions that Chrome supports as well - // as on any version prior to Win8 to ease in-place upgrades to Win8. - return base::win::IsChromeMetroSupported() || - base::win::GetVersion() < base::win::VERSION_WIN8; -} - base::string16 InstallUtil::GetActiveSetupPath(BrowserDistribution* dist) { static const wchar_t kInstalledComponentsPath[] = L"Software\\Microsoft\\Active Setup\\Installed Components\\"; @@ -163,8 +155,6 @@ void InstallUtil::TriggerActiveSetupCommand() { cmd.AppendSwitch(installer::switches::kForceConfigureUserSettings); base::LaunchOptions launch_options; - if (base::win::IsMetroProcess()) - launch_options.force_breakaway_from_job_ = true; base::Process process = base::LaunchProcess(cmd.GetCommandLineString(), launch_options); if (!process.IsValid()) diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h index 6371711..672f0ff 100644 --- a/chrome/installer/util/install_util.h +++ b/chrome/installer/util/install_util.h @@ -32,10 +32,6 @@ class Version; // independently. class InstallUtil { public: - // Returns true if properties that enable Metro mode on Win8+ should be - // installed. - static bool ShouldInstallMetroProperties(); - // Get the path to this distribution's Active Setup registry entries. // e.g. Software\Microsoft\Active Setup\Installed Components\<dist_guid> static base::string16 GetActiveSetupPath(BrowserDistribution* dist); diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 6051eba..324ed4f 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -36,7 +36,6 @@ #include "base/strings/utf_string_conversions.h" #include "base/synchronization/cancellation_flag.h" #include "base/values.h" -#include "base/win/metro.h" #include "base/win/registry.h" #include "base/win/scoped_co_mem.h" #include "base/win/scoped_comptr.h" @@ -300,10 +299,7 @@ void GetProgIdEntries(const ApplicationInfo& app_info, entries->push_back(new RegistryEntry( prog_id_path + ShellUtil::kRegShellOpen, ShellUtil::kRegDelegateExecute, app_info.delegate_clsid)); - // If Metro is not supported, remove the DelegateExecute entry instead of - // adding it. - if (!base::win::IsChromeMetroSupported()) - entries->back()->set_removal_flag(RegistryEntry::RemovalFlag::VALUE); + entries->back()->set_removal_flag(RegistryEntry::RemovalFlag::VALUE); } // The following entries are required as of Windows 8, but do not @@ -381,12 +377,10 @@ void GetChromeProgIdEntries(BrowserDistribution* dist, if (!app_info.delegate_clsid.empty()) { ScopedVector<RegistryEntry> delegate_execute_entries = GetChromeDelegateExecuteEntries(chrome_exe, app_info); - if (!base::win::IsChromeMetroSupported()) { - // Remove the keys (not only their values) so that Windows will continue - // to launch Chrome without a pesky association error. - for (RegistryEntry* entry : delegate_execute_entries) - entry->set_removal_flag(RegistryEntry::RemovalFlag::KEY); - } + // Remove the keys (not only their values) so that Windows will continue + // to launch Chrome without a pesky association error. + for (RegistryEntry* entry : delegate_execute_entries) + entry->set_removal_flag(RegistryEntry::RemovalFlag::KEY); // Move |delegate_execute_entries| to |entries|. entries->insert(entries->end(), delegate_execute_entries.begin(), delegate_execute_entries.end()); diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index c15913c..eb8ce66 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -214,7 +214,6 @@ const wchar_t kChromeFrameHelperDll[] = L"chrome_frame_helper.dll"; const wchar_t kChromeFrameHelperExe[] = L"chrome_frame_helper.exe"; const wchar_t kChromeFrameHelperWndClass[] = L"ChromeFrameHelperWindowClass"; const wchar_t kChromeLauncherExe[] = L"chrome_launcher.exe"; -const wchar_t kChromeMetroDll[] = L"metro_driver.dll"; const wchar_t kChromeNewExe[] = L"new_chrome.exe"; const wchar_t kChromeOldExe[] = L"old_chrome.exe"; const wchar_t kCmdOnOsUpgrade[] = L"on-os-upgrade"; diff --git a/chrome/metro_utils.gypi b/chrome/metro_utils.gypi deleted file mode 100644 index 000ac25..0000000 --- a/chrome/metro_utils.gypi +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2013 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. - -{ - 'targets': [ - { - 'target_name': 'metro_utils', - 'type': 'static_library', - 'dependencies': [ - 'installer_util', - '../base/base.gyp:base', - ], - 'include_dirs': [ - '..', - ], - 'sources': [ - 'browser/metro_utils/metro_chrome_win.cc', - 'browser/metro_utils/metro_chrome_win.h', - ], - }, - ], -} diff --git a/components/crash/content/app/breakpad_win.cc b/components/crash/content/app/breakpad_win.cc index 424a007..9cb1c3b 100644 --- a/components/crash/content/app/breakpad_win.cc +++ b/components/crash/content/app/breakpad_win.cc @@ -20,6 +20,7 @@ #include "base/debug/crash_logging.h" #include "base/debug/dump_without_crashing.h" #include "base/environment.h" +#include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/numerics/safe_conversions.h" @@ -29,7 +30,6 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/synchronization/lock.h" -#include "base/win/metro.h" #include "base/win/pe_image.h" #include "base/win/registry.h" #include "base/win/win_util.h" @@ -354,10 +354,6 @@ static bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption, // spawned and basically just shows the 'chrome has crashed' dialog if // the CHROME_CRASHED environment variable is present. bool ShowRestartDialogIfCrashed(bool* exit_now) { - // If we are being launched in metro mode don't try to show the dialog. - if (base::win::IsMetroProcess()) - return false; - base::string16 message; base::string16 title; bool is_rtl_locale; diff --git a/components/metrics/metrics_log.cc b/components/metrics/metrics_log.cc index 3f2d008..728068f 100644 --- a/components/metrics/metrics_log.cc +++ b/components/metrics/metrics_log.cc @@ -40,8 +40,6 @@ #endif #if defined(OS_WIN) -#include "base/win/metro.h" - // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx extern "C" IMAGE_DOS_HEADER __ImageBase; #endif @@ -329,15 +327,6 @@ void MetricsLog::RecordEnvironment( SystemProfileProto::OS* os = system_profile->mutable_os(); std::string os_name = base::SysInfo::OperatingSystemName(); -#if defined(OS_WIN) - // TODO(mad): This only checks whether the main process is a Metro process at - // upload time; not whether the collected metrics were all gathered from - // Metro. This is ok as an approximation for now, since users will rarely be - // switching from Metro to Desktop mode; but we should re-evaluate whether we - // can distinguish metrics more cleanly in the future: http://crbug.com/140568 - if (base::win::IsMetroProcess()) - os_name += " (Metro)"; -#endif os->set_name(os_name); os->set_version(base::SysInfo::OperatingSystemVersion()); #if defined(OS_ANDROID) diff --git a/media/capture/video/win/video_capture_device_factory_win.cc b/media/capture/video/win/video_capture_device_factory_win.cc index 85f68a4..ef75a81 100644 --- a/media/capture/video/win/video_capture_device_factory_win.cc +++ b/media/capture/video/win/video_capture_device_factory_win.cc @@ -13,7 +13,6 @@ #include "base/metrics/histogram.h" #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" -#include "base/win/metro.h" #include "base/win/scoped_co_mem.h" #include "base/win/scoped_variant.h" #include "base/win/windows_version.h" @@ -378,10 +377,8 @@ VideoCaptureDeviceFactoryWin::VideoCaptureDeviceFactoryWin() { // 8 in non-Metro mode. const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); use_media_foundation_ = - (base::win::IsMetroProcess() && - !cmd_line->HasSwitch(switches::kForceDirectShowVideoCapture)) || - (base::win::GetVersion() >= base::win::VERSION_WIN7 && - cmd_line->HasSwitch(switches::kForceMediaFoundationVideoCapture)); + base::win::GetVersion() >= base::win::VERSION_WIN7 && + cmd_line->HasSwitch(switches::kForceMediaFoundationVideoCapture); } scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryWin::Create( diff --git a/ui/base/ime/input_method_factory.cc b/ui/base/ime/input_method_factory.cc index d20f5f4..dd9d31a 100644 --- a/ui/base/ime/input_method_factory.cc +++ b/ui/base/ime/input_method_factory.cc @@ -10,7 +10,6 @@ #if defined(OS_CHROMEOS) #include "ui/base/ime/input_method_chromeos.h" #elif defined(OS_WIN) -#include "base/win/metro.h" #include "ui/base/ime/input_method_win.h" #include "ui/base/ime/remote_input_method_win.h" #elif defined(OS_MACOSX) diff --git a/ui/base/ime/remote_input_method_win.cc b/ui/base/ime/remote_input_method_win.cc index 53f2612..27d242a 100644 --- a/ui/base/ime/remote_input_method_win.cc +++ b/ui/base/ime/remote_input_method_win.cc @@ -11,7 +11,6 @@ #include "base/macros.h" #include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" -#include "base/win/metro.h" #include "base/win/scoped_handle.h" #include "ui/base/ime/input_method.h" #include "ui/base/ime/input_method_delegate.h" @@ -366,9 +365,8 @@ bool IsRemoteInputMethodWinRequired(gfx::AcceleratedWidget widget) { PROCESS_QUERY_LIMITED_INFORMATION, FALSE, process_id)); if (!process_handle.IsValid()) return false; - return base::win::IsProcessImmersive(process_handle.Get()) || - base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kViewerConnect); + return base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kViewerConnect); } RemoteInputMethodPrivateWin::RemoteInputMethodPrivateWin() {} diff --git a/ui/base/layout.cc b/ui/base/layout.cc index d8bc719..ea3b7ee 100644 --- a/ui/base/layout.cc +++ b/ui/base/layout.cc @@ -21,7 +21,6 @@ #include "ui/gfx/screen.h" #if defined(OS_WIN) -#include "base/win/metro.h" #include "ui/gfx/win/dpi.h" #include <Windows.h> #endif // defined(OS_WIN) diff --git a/ui/base/win/shell.cc b/ui/base/win/shell.cc index 4a48018..8dacd14 100644 --- a/ui/base/win/shell.cc +++ b/ui/base/win/shell.cc @@ -16,7 +16,6 @@ #include "base/native_library.h" #include "base/strings/string_util.h" #include "base/threading/thread_restrictions.h" -#include "base/win/metro.h" #include "base/win/scoped_comptr.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" @@ -99,10 +98,8 @@ bool OpenFolderViaShell(const base::FilePath& full_path) { bool PreventWindowFromPinning(HWND hwnd) { DCHECK(hwnd); - // This functionality is only available on Win7+. It also doesn't make sense - // to do this for Chrome Metro. - if (base::win::GetVersion() < base::win::VERSION_WIN7 || - base::win::IsMetroProcess()) + // This functionality is only available on Win7+. + if (base::win::GetVersion() < base::win::VERSION_WIN7) return false; base::win::ScopedComPtr<IPropertyStore> pps; @@ -123,10 +120,8 @@ void SetAppDetailsForWindow(const base::string16& app_id, HWND hwnd) { DCHECK(hwnd); - // This functionality is only available on Win7+. It also doesn't make sense - // to do this for Chrome Metro. - if (base::win::GetVersion() < base::win::VERSION_WIN7 || - base::win::IsMetroProcess()) + // This functionality is only available on Win7+. + if (base::win::GetVersion() < base::win::VERSION_WIN7) return; base::win::ScopedComPtr<IPropertyStore> pps; @@ -181,10 +176,8 @@ void SetRelaunchDetailsForWindow(const base::string16& relaunch_command, void ClearWindowPropertyStore(HWND hwnd) { DCHECK(hwnd); - // This functionality is only available on Win7+. It also doesn't make sense - // to do this for Chrome Metro. - if (base::win::GetVersion() < base::win::VERSION_WIN7 || - base::win::IsMetroProcess()) + // This functionality is only available on Win7+. + if (base::win::GetVersion() < base::win::VERSION_WIN7) return; base::win::ScopedComPtr<IPropertyStore> pps; diff --git a/ui/gfx/win/hwnd_util.cc b/ui/gfx/win/hwnd_util.cc index f02a312..32ee201 100644 --- a/ui/gfx/win/hwnd_util.cc +++ b/ui/gfx/win/hwnd_util.cc @@ -6,7 +6,6 @@ #include "base/i18n/rtl.h" #include "base/strings/string_util.h" -#include "base/win/metro.h" #include "base/win/win_util.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" @@ -215,9 +214,6 @@ void ShowSystemMenu(HWND window) { } void ShowSystemMenuAtPoint(HWND window, const Point& point) { - // In the Metro process, we never want to show the system menu. - if (base::win::IsMetroProcess()) - return; UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; if (base::i18n::IsRTL()) flags |= TPM_RIGHTALIGN; @@ -235,13 +231,7 @@ extern "C" { } HWND GetWindowToParentTo(bool get_real_hwnd) { - HMODULE metro = base::win::GetMetroModule(); - if (!metro) - return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; - // In windows 8 metro-mode the root window is not the desktop. - RootWindow root_window = - reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); - return root_window(); + return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; } } // namespace gfx diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index b42c558..3ae19e5 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -4,7 +4,6 @@ #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" -#include "base/win/metro.h" #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkRegion.h" #include "ui/aura/client/aura_constants.h" diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc index 73f66cf..236f862 100644 --- a/win8/delegate_execute/command_execute_impl.cc +++ b/win8/delegate_execute/command_execute_impl.cc @@ -14,7 +14,6 @@ #include "base/path_service.h" #include "base/process/launch.h" #include "base/strings/utf_string_conversions.h" -#include "base/win/metro.h" #include "base/win/registry.h" #include "base/win/scoped_co_mem.h" #include "base/win/scoped_handle.h" @@ -487,26 +486,7 @@ EC_HOST_UI_MODE CommandExecuteImpl::GetLaunchMode() { return launch_mode; } - if (!base::win::IsChromeMetroSupported()) { - launch_mode = ECHUIM_DESKTOP; - launch_mode_determined = true; - return launch_mode; - } - - // Use the previous mode if available. Else launch in desktop mode. - DWORD reg_value; - if (reg_key.ReadValueDW(chrome::kLaunchModeValue, - ®_value) != ERROR_SUCCESS) { - launch_mode = ECHUIM_DESKTOP; - AtlTrace("Can't read registry, defaulting to %s\n", modes[launch_mode]); - } else if (reg_value >= ECHUIM_SYSTEM_LAUNCHER) { - AtlTrace("Invalid registry launch mode value %u\n", reg_value); - launch_mode = ECHUIM_DESKTOP; - } else { - launch_mode = static_cast<EC_HOST_UI_MODE>(reg_value); - AtlTrace("Launch mode forced by registry to %s\n", modes[launch_mode]); - } - + launch_mode = ECHUIM_DESKTOP; launch_mode_determined = true; return launch_mode; } diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index 2615ba6..01f9ba2 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -17,7 +17,6 @@ #include "base/message_loop/message_loop.h" #include "base/path_service.h" #include "base/single_thread_task_runner.h" -#include "base/win/metro.h" #include "base/win/windows_version.h" #include "chrome/common/chrome_switches.h" #include "ipc/ipc_channel.h" diff --git a/win8/metro_driver/file_picker_ash.cc b/win8/metro_driver/file_picker_ash.cc index 8cafb73..31e699d 100644 --- a/win8/metro_driver/file_picker_ash.cc +++ b/win8/metro_driver/file_picker_ash.cc @@ -14,7 +14,6 @@ #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/synchronization/waitable_event.h" -#include "base/win/metro.h" #include "base/win/scoped_comptr.h" #include "ui/metro_viewer/metro_viewer_messages.h" #include "win8/metro_driver/chrome_app_view_ash.h" |