diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-31 07:39:29 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-31 07:39:29 +0000 |
commit | 86681b9dccc5d4ea00d5f767f0e9bf417c618cc9 (patch) | |
tree | c1eada026dcccecd2163ce62d1e1472bce267610 /chrome/browser | |
parent | 878ae96bea0bb797e2a47b7a685c56cb6b5601d0 (diff) | |
download | chromium_src-86681b9dccc5d4ea00d5f767f0e9bf417c618cc9.zip chromium_src-86681b9dccc5d4ea00d5f767f0e9bf417c618cc9.tar.gz chromium_src-86681b9dccc5d4ea00d5f767f0e9bf417c618cc9.tar.bz2 |
Use the right frame type on startup, do proper swapping of frames when themes change. Leave the native frame decision up to the ThemeProvider.
BUG=12890
TEST=In Aero, unstall a theme, reset to default, install again, restart, reset theme to default. Make sure that the Aero frame changes to the themed frame and back again appropriately.
Review URL: http://codereview.chromium.org/118053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17301 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_theme_provider.cc | 14 | ||||
-rw-r--r-- | chrome/browser/browser_theme_provider.h | 1 | ||||
-rw-r--r-- | chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc | 6 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_frame_win.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 2 |
6 files changed, 21 insertions, 6 deletions
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index f881ae7..80fa7f2 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -22,6 +22,10 @@ #include "skia/ext/skia_utils.h" #include "third_party/skia/include/core/SkBitmap.h" +#if defined(OS_WIN) +#include "app/win_util.h" +#endif + // Strings used by themes to identify colors for different parts of our UI. static const char* kColorFrame = "frame"; static const char* kColorFrameInactive = "frame_inactive"; @@ -216,6 +220,16 @@ SkColor BrowserThemeProvider::GetColor(int id) { return 0xffff0000; } +bool BrowserThemeProvider::ShouldUseNativeFrame() { + if (images_.find(IDR_THEME_FRAME) != images_.end()) + return false; +#if defined(OS_WIN) + return win_util::ShouldUseVistaFrame(); +#else + return false; +#endif +} + void BrowserThemeProvider::SetTheme(Extension* extension) { // Clear our image cache. FreeImages(); diff --git a/chrome/browser/browser_theme_provider.h b/chrome/browser/browser_theme_provider.h index c4138db..9565ad4 100644 --- a/chrome/browser/browser_theme_provider.h +++ b/chrome/browser/browser_theme_provider.h @@ -56,6 +56,7 @@ class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>, // ThemeProvider implementation. virtual SkBitmap* GetBitmapNamed(int id); virtual SkColor GetColor(int id); + virtual bool ShouldUseNativeFrame(); #if defined(OS_LINUX) virtual GdkPixbuf* GetPixbufNamed(int id); #endif diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc index 9443639..7ba39cc 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc @@ -14,7 +14,7 @@ #include "app/gfx/path.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/win_util.h" +#include "app/theme_provider.h" #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/views/autocomplete/autocomplete_popup_win.h" @@ -840,7 +840,7 @@ void AutocompletePopupContentsView::MakeContentsPath( void AutocompletePopupContentsView::UpdateBlurRegion() { // We only support background blurring on Vista with Aero-Glass enabled. - if (!win_util::ShouldUseVistaFrame() || !GetWidget()) + if (!GetThemeProvider()->ShouldUseNativeFrame() || !GetWidget()) return; // Provide a blurred background effect within the contents region of the @@ -868,7 +868,7 @@ void AutocompletePopupContentsView::MakeCanvasTransparent( gfx::Canvas* canvas) { // Allow the window blur effect to show through the popup background. SkPaint paint; - SkColor transparency = win_util::ShouldUseVistaFrame() ? + SkColor transparency = GetThemeProvider()->ShouldUseNativeFrame() ? kGlassPopupTransparency : kOpaquePopupTransparency; paint.setColor(SkColorSetARGB(transparency, 255, 255, 255)); paint.setPorterDuffXfermode(SkPorterDuff::kDstIn_Mode); diff --git a/chrome/browser/views/frame/browser_frame_win.cc b/chrome/browser/views/frame/browser_frame_win.cc index 505f28b..3e9d8d7 100644 --- a/chrome/browser/views/frame/browser_frame_win.cc +++ b/chrome/browser/views/frame/browser_frame_win.cc @@ -235,7 +235,7 @@ int BrowserFrameWin::GetShowState() const { } views::NonClientFrameView* BrowserFrameWin::CreateFrameViewForWindow() { - if (GetNonClientView()->UseNativeFrame()) + if (GetThemeProvider()->ShouldUseNativeFrame()) browser_frame_view_ = new GlassBrowserFrameView(this, browser_view_); else browser_frame_view_ = new OpaqueBrowserFrameView(this, browser_view_); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index ac9201d..e7ffef4 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -880,7 +880,7 @@ void BrowserView::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, } void BrowserView::UserChangedTheme() { - frame_->GetWindow()->GetNonClientView()->SetUseNativeFrame(false); + frame_->GetWindow()->FrameTypeChanged(); GetRootView()->ThemeChanged(); GetRootView()->SchedulePaint(); } diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 47cc89d..1a2cf23 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -606,7 +606,7 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas) { } } - if (GetWindow()->GetNonClientView()->UseNativeFrame()) { + if (GetThemeProvider()->ShouldUseNativeFrame()) { // Make sure unselected tabs are somewhat transparent. SkPaint paint; paint.setColor(SkColorSetARGB(200, 255, 255, 255)); |