diff options
author | Sadrul Habib Chowdhury <sadrul@chromium.org> | 2015-02-13 12:12:22 -0500 |
---|---|---|
committer | Sadrul Habib Chowdhury <sadrul@chromium.org> | 2015-02-13 17:13:38 +0000 |
commit | da8b9b72a31951a1a2b68a4e60c5719b52443404 (patch) | |
tree | 9eb818178903311d92c66e9c8ecf4d19bbd9af87 | |
parent | c25e09cb403ef31802ad6fdcacdbfbe123565980 (diff) | |
download | chromium_src-da8b9b72a31951a1a2b68a4e60c5719b52443404.zip chromium_src-da8b9b72a31951a1a2b68a4e60c5719b52443404.tar.gz chromium_src-da8b9b72a31951a1a2b68a4e60c5719b52443404.tar.bz2 |
win/aura: Remove some more non-aura code for Windows.
This removes all the uses of USE_AURA ifdefs from the _win.cc files (and some
additional removal of dead code).
BUG=none
R=mkwst@chromium.org, sky@chromium.org, thestig@chromium.org
Review URL: https://codereview.chromium.org/909183002
Cr-Commit-Position: refs/heads/master@{#316231}
-rw-r--r-- | chrome/browser/chrome_browser_main_win.cc | 2 | ||||
-rw-r--r-- | chrome/browser/lifetime/application_lifetime.h | 1 | ||||
-rw-r--r-- | chrome/browser/lifetime/application_lifetime_win.cc | 44 | ||||
-rw-r--r-- | chrome/browser/metro_utils/metro_chrome_win.cc | 7 | ||||
-rw-r--r-- | chrome/browser/metro_utils/metro_chrome_win.h | 2 | ||||
-rw-r--r-- | chrome/browser/password_manager/password_manager_util_win.cc | 9 | ||||
-rw-r--r-- | chrome/browser/platform_util_win.cc | 23 | ||||
-rw-r--r-- | chrome/browser/process_singleton_win.cc | 34 | ||||
-rw-r--r-- | chrome/browser/ui/pdf/pdf_unsupported_feature.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/webui/help/version_updater_win.cc | 6 | ||||
-rw-r--r-- | components/crash/app/hard_error_handler_win.cc | 4 | ||||
-rw-r--r-- | content/shell/browser/shell_web_contents_view_delegate_win.cc | 16 | ||||
-rw-r--r-- | printing/printing_context_win.cc | 9 | ||||
-rw-r--r-- | ui/gfx/path_win.cc | 30 |
14 files changed, 8 insertions, 181 deletions
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index 9fcf92d..822cd3c 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc @@ -197,9 +197,7 @@ void ChromeBrowserMainPartsWin::ToolkitInitialized() { ChromeBrowserMainParts::ToolkitInitialized(); gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont; gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize; -#if defined(USE_AURA) ui::CursorLoaderWin::SetCursorResourceModule(chrome::kBrowserResourcesDll); -#endif } void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { diff --git a/chrome/browser/lifetime/application_lifetime.h b/chrome/browser/lifetime/application_lifetime.h index bc28f52..9165754 100644 --- a/chrome/browser/lifetime/application_lifetime.h +++ b/chrome/browser/lifetime/application_lifetime.h @@ -44,7 +44,6 @@ 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 AttemptRestartWithModeSwitch(); void AttemptRestartToDesktopMode(); // Launches Chrome into Windows 8 metro mode on Windows 8. On Windows 7 it // launches Chrome into Windows ASH. diff --git a/chrome/browser/lifetime/application_lifetime_win.cc b/chrome/browser/lifetime/application_lifetime_win.cc index 02c0019..2d39984 100644 --- a/chrome/browser/lifetime/application_lifetime_win.cc +++ b/chrome/browser/lifetime/application_lifetime_win.cc @@ -5,35 +5,26 @@ #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/ui/browser_finder.h" -#include "chrome/common/pref_names.h" -#include "ui/views/widget/widget.h" - -#if defined(USE_AURA) -#include "base/environment.h" -#include "base/files/file_path.h" -#include "base/path_service.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" -#endif +#include "ui/views/widget/widget.h" namespace chrome { -#if !defined(USE_AURA) -void HandleAppExitingForPlatform() { - views::Widget::CloseAllSecondaryWidgets(); -} -#endif - // 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 @@ -41,28 +32,6 @@ void HandleAppExitingForPlatform() { // Here mode refers to Windows 8 modes such as Metro (also called immersive) // and desktop mode (Classic or traditional). -// Mode switch based on current mode which is devised from current process. -void AttemptRestartWithModeSwitch() { -#if defined(USE_AURA) - // This function should be called only from non aura code path. - // In aura/ash windows world browser process is always non metro. - NOTREACHED(); -#else - // The kRestartSwitchMode preference does not exists for Windows 7 and older - // operating systems so there is no need for OS version check. - PrefService* prefs = g_browser_process->local_state(); - if (base::win::IsMetroProcess()) { - prefs->SetString(prefs::kRelaunchMode, - upgrade_util::kRelaunchModeDesktop); - } else { - prefs->SetString(prefs::kRelaunchMode, - upgrade_util::kRelaunchModeMetro); - } - AttemptRestart(); -#endif -} - -#if defined(USE_AURA) void ActivateDesktopHelper(AshExecutionStatus ash_execution_status) { scoped_ptr<base::Environment> env(base::Environment::Create()); std::string version_str; @@ -91,7 +60,6 @@ void ActivateDesktopHelper(AshExecutionStatus ash_execution_status) { ChromeMetroViewerProcessHost::HandleActivateDesktop( path, ash_execution_status == ASH_TERMINATE); } -#endif void AttemptRestartToDesktopMode() { PrefService* prefs = g_browser_process->local_state(); diff --git a/chrome/browser/metro_utils/metro_chrome_win.cc b/chrome/browser/metro_utils/metro_chrome_win.cc index 96e84ac..2bab9e1 100644 --- a/chrome/browser/metro_utils/metro_chrome_win.cc +++ b/chrome/browser/metro_utils/metro_chrome_win.cc @@ -62,17 +62,10 @@ bool ActivateMetroChrome() { } Win8Environment GetWin8Environment(HostDesktopType desktop) { -#if defined(USE_AURA) && defined(USE_ASH) if (desktop == chrome::HOST_DESKTOP_TYPE_ASH) return WIN_8_ENVIRONMENT_METRO_AURA; else return WIN_8_ENVIRONMENT_DESKTOP_AURA; -#else - if (base::win::IsProcessImmersive(::GetCurrentProcess())) - return WIN_8_ENVIRONMENT_METRO; - else - return WIN_8_ENVIRONMENT_DESKTOP; -#endif } diff --git a/chrome/browser/metro_utils/metro_chrome_win.h b/chrome/browser/metro_utils/metro_chrome_win.h index dadbb8e..9f96a38 100644 --- a/chrome/browser/metro_utils/metro_chrome_win.h +++ b/chrome/browser/metro_utils/metro_chrome_win.h @@ -17,8 +17,6 @@ namespace chrome { bool ActivateMetroChrome(); enum Win8Environment { - WIN_8_ENVIRONMENT_METRO, - WIN_8_ENVIRONMENT_DESKTOP, WIN_8_ENVIRONMENT_METRO_AURA, WIN_8_ENVIRONMENT_DESKTOP_AURA, WIN_8_ENVIRONMENT_MAX diff --git a/chrome/browser/password_manager/password_manager_util_win.cc b/chrome/browser/password_manager/password_manager_util_win.cc index 98d91f3..c3ce79d 100644 --- a/chrome/browser/password_manager/password_manager_util_win.cc +++ b/chrome/browser/password_manager/password_manager_util_win.cc @@ -28,12 +28,9 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view.h" -#include "ui/base/l10n/l10n_util.h" - -#if defined(USE_AURA) #include "ui/aura/window.h" #include "ui/aura/window_tree_host.h" -#endif +#include "ui/base/l10n/l10n_util.h" namespace password_manager_util { namespace { @@ -248,11 +245,7 @@ bool AuthenticateUser(gfx::NativeWindow window) { cui.cbSize = sizeof(CREDUI_INFO); cui.hwndParent = NULL; -#if defined(USE_AURA) cui.hwndParent = window->GetHost()->GetAcceleratedWidget(); -#else - cui.hwndParent = window; -#endif cui.pszMessageText = password_prompt.c_str(); cui.pszCaptionText = product_name.c_str(); diff --git a/chrome/browser/platform_util_win.cc b/chrome/browser/platform_util_win.cc index b14602f..65aee57 100644 --- a/chrome/browser/platform_util_win.cc +++ b/chrome/browser/platform_util_win.cc @@ -211,27 +211,4 @@ void OpenExternal(Profile* profile, const GURL& url) { base::Bind(&OpenExternalOnFileThread, url)); } -#if !defined(USE_AURA) -gfx::NativeWindow GetTopLevel(gfx::NativeView view) { - return ::GetAncestor(view, GA_ROOT); -} - -gfx::NativeView GetParent(gfx::NativeView view) { - return ::GetParent(view); -} - -bool IsWindowActive(gfx::NativeWindow window) { - return ::GetForegroundWindow() == window; -} - -void ActivateWindow(gfx::NativeWindow window) { - ::SetForegroundWindow(window); -} - -bool IsVisible(gfx::NativeView view) { - // MSVC complains if we don't include != 0. - return ::IsWindowVisible(view) != 0; -} -#endif - } // namespace platform_util diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index c5f0f99..63a0c48 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -186,45 +186,11 @@ bool ProcessLaunchNotification( // Move this function to a common place as the Windows 8 delegate_execute // handler can possibly use this. bool ShouldLaunchInWindows8ImmersiveMode(const base::FilePath& user_data_dir) { -#if defined(USE_AURA) // Returning false from this function doesn't mean we don't launch immersive // mode in Aura. This function is specifically called in case when we need // to relaunch desktop launched chrome into immersive mode through 'relaunch' // menu. In case of Aura, we will use delegate_execute to do the relaunch. return false; -#else - if (base::win::GetVersion() < base::win::VERSION_WIN8) - return false; - - if (base::win::IsProcessImmersive(base::GetCurrentProcessHandle())) - return false; - - if (ShellIntegration::GetDefaultBrowser() != ShellIntegration::IS_DEFAULT) - return false; - - base::IntegrityLevel integrity_level = base::INTEGRITY_UNKNOWN; - base::GetProcessIntegrityLevel(base::GetCurrentProcessHandle(), - &integrity_level); - if (integrity_level == base::HIGH_INTEGRITY) - return false; - - base::FilePath default_user_data_dir; - if (!chrome::GetDefaultUserDataDirectory(&default_user_data_dir)) - return false; - - if (default_user_data_dir != user_data_dir) - return false; - - base::win::RegKey reg_key; - DWORD reg_value = 0; - if (reg_key.Create(HKEY_CURRENT_USER, chrome::kMetroRegistryPath, - KEY_READ) == ERROR_SUCCESS && - reg_key.ReadValueDW(chrome::kLaunchModeValue, - ®_value) == ERROR_SUCCESS) { - return reg_value == 1; - } - return false; -#endif } } // namespace diff --git a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc index 6b8e1e5..eca5db3 100644 --- a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc +++ b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc @@ -292,7 +292,7 @@ bool PDFUnsupportedFeaturePromptClient::ShouldExpire( void PDFUnsupportedFeaturePromptClient::Accept() { if (base::win::IsMetroProcess()) { - chrome::AttemptRestartWithModeSwitch(); + chrome::AttemptRestartToDesktopMode(); return; } diff --git a/chrome/browser/ui/webui/help/version_updater_win.cc b/chrome/browser/ui/webui/help/version_updater_win.cc index 46253f6..9825fe0 100644 --- a/chrome/browser/ui/webui/help/version_updater_win.cc +++ b/chrome/browser/ui/webui/help/version_updater_win.cc @@ -251,12 +251,6 @@ gfx::AcceleratedWidget VersionUpdaterWin::GetElevationParent() { EnumThreadWindows(GetCurrentThreadId(), WindowEnumeration, reinterpret_cast<LPARAM>(&window)); -#if !defined(USE_AURA) - // If using Aura, we might not have a Visible window in this process. In - // theory Google update can cope with that. - DCHECK(window != NULL) << "Failed to find a valid window handle on thread: " - << GetCurrentThreadId(); -#endif return window; } diff --git a/components/crash/app/hard_error_handler_win.cc b/components/crash/app/hard_error_handler_win.cc index a4050d2..71bd137 100644 --- a/components/crash/app/hard_error_handler_win.cc +++ b/components/crash/app/hard_error_handler_win.cc @@ -102,12 +102,8 @@ bool HardErrorHandler(EXCEPTION_POINTERS* ex_info) { EntryPointNotFoundHardError(ex_info->ExceptionRecord); return true; } else if (FacilityFromException(exception) == FACILITY_GRAPHICS_KERNEL) { -#if defined(USE_AURA) RaiseHardErrorMsg(exception, std::string(), std::string()); return true; -#else - return false; -#endif } return false; } diff --git a/content/shell/browser/shell_web_contents_view_delegate_win.cc b/content/shell/browser/shell_web_contents_view_delegate_win.cc index 757cb40..d5a16ba 100644 --- a/content/shell/browser/shell_web_contents_view_delegate_win.cc +++ b/content/shell/browser/shell_web_contents_view_delegate_win.cc @@ -170,23 +170,7 @@ void ShellWebContentsViewDelegate::ShowContextMenu( L"Inspect...", ShellContextMenuItemInspectId, true); -#if defined(USE_AURA) NOTIMPLEMENTED(); -#else - gfx::Point screen_point(params.x, params.y); - POINT point = screen_point.ToPOINT(); - ClientToScreen(web_contents_->GetNativeView(), &point); - - int selection = - TrackPopupMenu(sub_menu, - TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, - point.x, point.y, - 0, - web_contents_->GetContentNativeView(), - NULL); - - MenuItemSelected(selection); -#endif DestroyMenu(menu); } diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc index 678e7f2..7822429 100644 --- a/printing/printing_context_win.cc +++ b/printing/printing_context_win.cc @@ -17,11 +17,8 @@ #include "printing/printing_utils.h" #include "printing/units.h" #include "skia/ext/platform_device.h" - -#if defined(USE_AURA) #include "ui/aura/remote_window_tree_host_win.h" #include "ui/aura/window.h" -#endif namespace printing { @@ -362,14 +359,8 @@ PrintingContext::Result PrintingContextWin::InitializeSettings( HWND PrintingContextWin::GetRootWindow(gfx::NativeView view) { HWND window = NULL; -#if defined(USE_AURA) if (view) window = view->GetHost()->GetAcceleratedWidget(); -#else - if (view && IsWindow(view)) { - window = GetAncestor(view, GA_ROOTOWNER); - } -#endif if (!window) { // TODO(maruel): crbug.com/1214347 Get the right browser window instead. return GetDesktopWindow(); diff --git a/ui/gfx/path_win.cc b/ui/gfx/path_win.cc index 0f55253..e6a915b 100644 --- a/ui/gfx/path_win.cc +++ b/ui/gfx/path_win.cc @@ -32,34 +32,4 @@ HRGN CreateHRGNFromSkPath(const SkPath& path) { return CreateHRGNFromSkRegion(region); } -// See path_aura.cc for Aura definition of these methods: -#if !defined(USE_AURA) - -NativeRegion Path::CreateNativeRegion() const { - return CreateHRGNFromSkPath(*this); -} - -// static -NativeRegion Path::IntersectRegions(NativeRegion r1, NativeRegion r2) { - HRGN dest = CreateRectRgn(0, 0, 1, 1); - CombineRgn(dest, r1, r2, RGN_AND); - return dest; -} - -// static -NativeRegion Path::CombineRegions(NativeRegion r1, NativeRegion r2) { - HRGN dest = CreateRectRgn(0, 0, 1, 1); - CombineRgn(dest, r1, r2, RGN_OR); - return dest; -} - -// static -NativeRegion Path::SubtractRegion(NativeRegion r1, NativeRegion r2) { - HRGN dest = CreateRectRgn(0, 0, 1, 1); - CombineRgn(dest, r1, r2, RGN_DIFF); - return dest; -} - -#endif - } // namespace gfx |