diff options
-rw-r--r-- | chrome/browser/aeropeek_manager.cc | 4 | ||||
-rw-r--r-- | chrome/browser/themes/browser_theme_provider.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/constrained_window_win.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/views/first_run_bubble.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_frame_win.cc | 7 | ||||
-rw-r--r-- | ui/base/win/hwnd_util.cc | 14 | ||||
-rw-r--r-- | ui/base/win/hwnd_util.h | 4 | ||||
-rw-r--r-- | views/widget/default_theme_provider.cc | 6 | ||||
-rw-r--r-- | views/widget/widget_win.cc | 14 | ||||
-rw-r--r-- | views/widget/widget_win.h | 4 | ||||
-rw-r--r-- | views/window/window_win.cc | 4 |
12 files changed, 40 insertions, 38 deletions
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc index 54c35e5..7c32d290 100644 --- a/chrome/browser/aeropeek_manager.cc +++ b/chrome/browser/aeropeek_manager.cc @@ -35,8 +35,8 @@ #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "ui/base/win/hwnd_util.h" #include "ui/base/win/window_impl.h" +#include "views/widget/widget_win.h" namespace { @@ -1016,7 +1016,7 @@ bool AeroPeekManager::Enabled() { // flooding users with tab thumbnails. const CommandLine* command_line = CommandLine::ForCurrentProcess(); return base::win::GetVersion() >= base::win::VERSION_WIN7 && - ui::ShouldUseVistaFrame() && + views::WidgetWin::IsAeroGlassEnabled() && !command_line->HasSwitch(switches::kApp) && command_line->HasSwitch(switches::kEnableAeroPeekTabs); } diff --git a/chrome/browser/themes/browser_theme_provider.cc b/chrome/browser/themes/browser_theme_provider.cc index 3ebbd37..87a73aa 100644 --- a/chrome/browser/themes/browser_theme_provider.cc +++ b/chrome/browser/themes/browser_theme_provider.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -20,7 +20,7 @@ #include "ui/base/resource/resource_bundle.h" #if defined(OS_WIN) -#include "ui/base/win/hwnd_util.h" +#include "views/widget/widget_win.h" #endif // Strings used in alignment properties. @@ -255,7 +255,7 @@ bool BrowserThemeProvider::ShouldUseNativeFrame() const { if (HasCustomImage(IDR_THEME_FRAME)) return false; #if defined(OS_WIN) - return ui::ShouldUseVistaFrame(); + return views::WidgetWin::IsAeroGlassEnabled(); #else return false; #endif diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc index a78656ee..8656360 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -43,7 +43,7 @@ #include <objidl.h> #include "base/win/scoped_gdi_object.h" -#include "ui/base/win/hwnd_util.h" +#include "views/widget/widget_win.h" #endif #if defined(OS_LINUX) @@ -1104,7 +1104,7 @@ void AutocompletePopupContentsView::MakeContentsPath( void AutocompletePopupContentsView::UpdateBlurRegion() { #if defined(OS_WIN) // We only support background blurring on Vista with Aero-Glass enabled. - if (!ui::ShouldUseVistaFrame() || !GetWidget()) + if (!views::WidgetWin::IsAeroGlassEnabled() || !GetWidget()) return; // Provide a blurred background effect within the contents region of the diff --git a/chrome/browser/ui/views/constrained_window_win.cc b/chrome/browser/ui/views/constrained_window_win.cc index e669319..92dbcfa 100644 --- a/chrome/browser/ui/views/constrained_window_win.cc +++ b/chrome/browser/ui/views/constrained_window_win.cc @@ -26,9 +26,9 @@ #include "grit/theme_resources.h" #include "net/base/net_util.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/base/win/hwnd_util.h" #include "views/controls/button/image_button.h" #include "views/focus/focus_manager.h" +#include "views/widget/widget_win.h" #include "views/window/client_view.h" #include "views/window/non_client_view.h" #include "views/window/window_resources.h" @@ -198,7 +198,8 @@ class ConstrainedWindowFrameView SkColor GetTitleColor() const { return (container_->owner()->profile()->IsOffTheRecord() || - !ui::ShouldUseVistaFrame()) ? SK_ColorWHITE : SK_ColorBLACK; + !views::WidgetWin::IsAeroGlassEnabled()) ? SK_ColorWHITE + : SK_ColorBLACK; } // Loads the appropriate set of WindowResources for the frame view. @@ -535,7 +536,7 @@ gfx::Rect ConstrainedWindowFrameView::CalculateClientAreaBounds( } void ConstrainedWindowFrameView::InitWindowResources() { - resources_.reset(ui::ShouldUseVistaFrame() ? + resources_.reset(views::WidgetWin::IsAeroGlassEnabled() ? static_cast<views::WindowResources*>(new VistaWindowResources) : new XPWindowResources); } diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc index c34781c..4b01b9e 100644 --- a/chrome/browser/ui/views/first_run_bubble.cc +++ b/chrome/browser/ui/views/first_run_bubble.cc @@ -18,13 +18,13 @@ #include "ui/base/l10n/l10n_font_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/base/win/hwnd_util.h" #include "views/controls/button/native_button.h" #include "views/controls/button/image_button.h" #include "views/controls/label.h" #include "views/event.h" #include "views/focus/focus_manager.h" #include "views/layout/layout_constants.h" +#include "views/widget/widget_win.h" #include "views/window/window.h" namespace { @@ -358,7 +358,7 @@ gfx::Size FirstRunOEMBubbleView::GetPreferredSize() { // now, we force Vista to show a correctly-sized box by taking account of // the difference in font size calculation. The coefficient should not be // stored in a variable because it's a hack and should go away. - if (ui::ShouldUseVistaFrame()) { + if (views::WidgetWin::IsAeroGlassEnabled()) { size.set_width(static_cast<int>(size.width() * 0.85)); size.set_height(static_cast<int>(size.height() * 0.85)); } diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc index 50f9cc4..614d6da 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.cc +++ b/chrome/browser/ui/views/frame/browser_frame_win.cc @@ -20,8 +20,8 @@ #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" #include "gfx/font.h" #include "grit/theme_resources.h" -#include "ui/base/win/hwnd_util.h" #include "views/screen.h" +#include "views/widget/widget_win.h" #include "views/window/window_delegate.h" // static @@ -109,7 +109,8 @@ bool BrowserFrameWin::AlwaysUseNativeFrame() const { // We don't theme popup or app windows, so regardless of whether or not a // theme is active for normal browser windows, we don't want to use the custom // frame for popups/apps. - if (!browser_view_->IsBrowserTypeNormal() && ui::ShouldUseVistaFrame()) + if (!browser_view_->IsBrowserTypeNormal() && + views::WidgetWin::IsAeroGlassEnabled()) return true; // Otherwise, we use the native frame when we're told we should by the theme @@ -166,7 +167,7 @@ void BrowserFrameWin::OnEnterSizeMove() { } void BrowserFrameWin::OnExitSizeMove() { - WidgetWin::OnExitSizeMove(); + views::WidgetWin::OnExitSizeMove(); } void BrowserFrameWin::OnInitMenuPopup(HMENU menu, UINT position, diff --git a/ui/base/win/hwnd_util.cc b/ui/base/win/hwnd_util.cc index ba306ed..9ecff94 100644 --- a/ui/base/win/hwnd_util.cc +++ b/ui/base/win/hwnd_util.cc @@ -4,15 +4,10 @@ #include "ui/base/win/hwnd_util.h" -#include <dwmapi.h> - #include "base/string_util.h" -#include "base/win/windows_version.h" #include "gfx/rect.h" #include "gfx/size.h" -#pragma comment(lib, "dwmapi.lib") - namespace ui { namespace { @@ -169,13 +164,4 @@ void CenterAndSizeWindow(HWND parent, } } -bool ShouldUseVistaFrame() { - if (base::win::GetVersion() < base::win::VERSION_VISTA) - return false; - // If composition is not enabled, we behave like on XP. - BOOL f; - DwmIsCompositionEnabled(&f); - return !!f; -} - } // namespace ui diff --git a/ui/base/win/hwnd_util.h b/ui/base/win/hwnd_util.h index dd9a6a6..628ac5e 100644 --- a/ui/base/win/hwnd_util.h +++ b/ui/base/win/hwnd_util.h @@ -40,10 +40,6 @@ void CenterAndSizeWindow(HWND parent, const gfx::Size& pref, bool pref_is_client); -// Returns true if we are on Windows Vista or greater and composition is -// enabled. -bool ShouldUseVistaFrame(); - } // namespace ui #endif // UI_BASE_WIN_HWND_UTIL_H_ diff --git a/views/widget/default_theme_provider.cc b/views/widget/default_theme_provider.cc index 33c0eb0..8a03bab 100644 --- a/views/widget/default_theme_provider.cc +++ b/views/widget/default_theme_provider.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -7,7 +7,7 @@ #include "ui/base/resource/resource_bundle.h" #if defined(OS_WIN) -#include "ui/base/win/hwnd_util.h" +#include "views/widget/widget_win.h" #endif namespace views { @@ -18,7 +18,7 @@ SkBitmap* DefaultThemeProvider::GetBitmapNamed(int id) const { bool DefaultThemeProvider::ShouldUseNativeFrame() const { #if defined(OS_WIN) - return ui::ShouldUseVistaFrame(); + return WidgetWin::IsAeroGlassEnabled(); #else return false; #endif diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 1fd9dbd..2f7603a 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -4,8 +4,11 @@ #include "views/widget/widget_win.h" +#include <dwmapi.h> + #include "app/win/win_util.h" #include "base/string_util.h" +#include "base/win/windows_version.h" #include "gfx/canvas_skia.h" #include "gfx/native_theme_win.h" #include "gfx/path.h" @@ -28,6 +31,8 @@ #include "views/widget/widget_utils.h" #include "views/window/window_win.h" +#pragma comment(lib, "dwmapi.lib") + using ui::ViewProp; namespace views { @@ -107,6 +112,15 @@ WidgetWin* WidgetWin::GetRootWidget(HWND hwnd) { return widget; } +// static +bool WidgetWin::IsAeroGlassEnabled() { + if (base::win::GetVersion() < base::win::VERSION_VISTA) + return false; + // If composition is not enabled, we behave like on XP. + BOOL enabled = FALSE; + return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled; +} + void WidgetWin::SetUseLayeredBuffer(bool use_layered_buffer) { if (use_layered_buffer_ == use_layered_buffer) return; diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index d48169c..3b7bede 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -89,6 +89,10 @@ class WidgetWin : public ui::WindowImpl, // Returns the root Widget associated with the specified HWND (if any). static WidgetWin* GetRootWidget(HWND hwnd); + // Returns true if we are on Windows Vista or greater and composition is + // enabled. + static bool IsAeroGlassEnabled(); + void set_delete_on_destroy(bool delete_on_destroy) { delete_on_destroy_ = delete_on_destroy; } diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 2e3481b..dff4527 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -540,7 +540,7 @@ gfx::NativeWindow WindowWin::GetNativeWindow() const { bool WindowWin::ShouldUseNativeFrame() const { ui::ThemeProvider* tp = GetThemeProvider(); if (!tp) - return ui::ShouldUseVistaFrame(); + return WidgetWin::IsAeroGlassEnabled(); return tp->ShouldUseNativeFrame(); } |