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

Unified Diff: chrome/browser/views/tabs/tab_renderer.cc

Issue 27317: Support DWM switching.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/tabs/tab_renderer.h ('k') | chrome/browser/views/tabs/tab_strip.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/tabs/tab_renderer.cc
===================================================================
--- chrome/browser/views/tabs/tab_renderer.cc (revision 10688)
+++ chrome/browser/views/tabs/tab_renderer.cc (working copy)
@@ -15,6 +15,7 @@
#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
+#include "chrome/views/window.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "skia/ext/image_operations.h"
@@ -78,6 +79,31 @@
namespace {
+// Loads the images to be used for the tab background. Uses the images for
+// Vista if |use_vista_images| is true.
+void LoadTabImages(bool use_vista_images) {
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ if (use_vista_images) {
+ tab_inactive_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_V);
+ tab_inactive_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_V);
+ tab_inactive_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_V);
+
+ // Our Vista frame doesn't change background color to show OTR,
+ // so we continue to use the existing background tabs.
+ tab_inactive_otr_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_V);
+ tab_inactive_otr_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_V);
+ tab_inactive_otr_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_V);
+ } else {
+ tab_inactive_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT);
+ tab_inactive_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER);
+ tab_inactive_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT);
+
+ tab_inactive_otr_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_OTR);
+ tab_inactive_otr_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_OTR);
+ tab_inactive_otr_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_OTR);
+ }
+}
+
void InitResources() {
static bool initialized = false;
if (!initialized) {
@@ -97,26 +123,8 @@
tab_active_l_width = tab_active_l->width();
tab_active_r_width = tab_active_r->width();
- if (win_util::ShouldUseVistaFrame()) {
- tab_inactive_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_V);
- tab_inactive_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_V);
- tab_inactive_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_V);
+ LoadTabImages(win_util::ShouldUseVistaFrame());
- // Our Vista frame doesn't change background color to show OTR,
- // so we continue to use the existing background tabs.
- tab_inactive_otr_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_V);
- tab_inactive_otr_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_V);
- tab_inactive_otr_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_V);
- } else {
- tab_inactive_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT);
- tab_inactive_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER);
- tab_inactive_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT);
-
- tab_inactive_otr_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT_OTR);
- tab_inactive_otr_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER_OTR);
- tab_inactive_otr_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT_OTR);
- }
-
tab_hover_l = rb.GetBitmapNamed(IDR_TAB_HOVER_LEFT);
tab_hover_c = rb.GetBitmapNamed(IDR_TAB_HOVER_CENTER);
tab_hover_r = rb.GetBitmapNamed(IDR_TAB_HOVER_RIGHT);
@@ -535,6 +543,12 @@
hover_animation_->Hide();
}
+void TabRenderer::ThemeChanged() {
+ if (GetWidget() && GetWidget()->AsWindow())
+ LoadTabImages(GetWidget()->AsWindow()->UseNativeFrame());
+ View::ThemeChanged();
+}
+
///////////////////////////////////////////////////////////////////////////////
// TabRenderer, AnimationDelegate implementation:
@@ -566,7 +580,7 @@
animation = pulse_animation_.get();
if (animation->GetCurrentValue() > 0) {
PaintHoverTabBackground(canvas, animation->GetCurrentValue() *
- (win_util::ShouldUseVistaFrame() ?
+ (GetWidget()->AsWindow()->UseNativeFrame() ?
kHoverOpacityVista : kHoverOpacity));
} else {
PaintInactiveTabBackground(canvas);
« no previous file with comments | « chrome/browser/views/tabs/tab_renderer.h ('k') | chrome/browser/views/tabs/tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698