summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 00:36:50 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 00:36:50 +0000
commitea4230158db5b8d5bb0f935023fa0d5ef972d67b (patch)
treecd4446d3f525fad8671052a84ddca716e80bbcd5 /chrome
parentf1341e1f2a19fb05463d1b83107ade8aa46d194a (diff)
downloadchromium_src-ea4230158db5b8d5bb0f935023fa0d5ef972d67b.zip
chromium_src-ea4230158db5b8d5bb0f935023fa0d5ef972d67b.tar.gz
chromium_src-ea4230158db5b8d5bb0f935023fa0d5ef972d67b.tar.bz2
Revert "Update panel title to match current mock. The corners become slightly rounded."
This reverts commit r55926. TBR=davemoore Review URL: http://codereview.chromium.org/3111004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55971 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/frame/panel_controller.cc92
1 files changed, 30 insertions, 62 deletions
diff --git a/chrome/browser/chromeos/frame/panel_controller.cc b/chrome/browser/chromeos/frame/panel_controller.cc
index 09d76e1..75aa6d7 100644
--- a/chrome/browser/chromeos/frame/panel_controller.cc
+++ b/chrome/browser/chromeos/frame/panel_controller.cc
@@ -15,18 +15,14 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/chromeos/wm_ipc.h"
#include "chrome/common/notification_service.h"
-#include "cros/chromeos_wm_ipc_enums.h"
#include "grit/app_resources.h"
-#include "gfx/canvas_skia.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
-#include "third_party/skia/include/effects/SkGradientShader.h"
-#include "third_party/skia/include/effects/SkBlurMaskFilter.h"
+#include "cros/chromeos_wm_ipc_enums.h"
#include "views/controls/button/image_button.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
#include "views/event.h"
-#include "views/painter.h"
#include "views/view.h"
#include "views/widget/widget_gtk.h"
#include "views/window/window.h"
@@ -41,47 +37,23 @@ static SkBitmap* close_button_h;
static SkBitmap* close_button_p;
static gfx::Font* active_font = NULL;
static gfx::Font* inactive_font = NULL;
-static views::Background* title_background;
namespace {
-const int kTitleHeight = 24;
+const int kTitleWidth = 200;
+const int kTitleHeight = 20;
const int kTitleIconSize = 16;
-const int kTitleWidthPad = 4;
-const int kTitleHeightPad = 4;
-const int kTitleCornerRadius = 4;
-const int kTitleCloseButtonPad = 6;
-const SkColor kTitleActiveGradientStart = SK_ColorWHITE;
-const SkColor kTitleActiveGradientEnd = 0xffe7edf1;
-const SkColor kTitleActiveColor = SK_ColorBLACK;
-const SkColor kTitleInactiveColor = SK_ColorBLACK;
-const SkColor kTitleCloseButtonColor = SK_ColorBLACK;
-
-// Used to draw the background of the panel title window.
-class TitleBackgroundPainter : public views::Painter {
- virtual void Paint(int w, int h, gfx::Canvas* canvas) {
- SkRect rect = {0, 0, w, h};
- SkPath path;
- SkScalar corners[] = {
- kTitleCornerRadius, kTitleCornerRadius,
- kTitleCornerRadius, kTitleCornerRadius,
- 0, 0,
- 0, 0
- };
- path.addRoundRect(rect, corners);
- SkPaint paint;
- paint.setStyle(SkPaint::kFill_Style);
- paint.setFlags(SkPaint::kAntiAlias_Flag);
- SkPoint p[2] = {{0, 0}, {0, h}};
- SkColor colors[2] = {kTitleActiveGradientStart, kTitleActiveGradientEnd};
- SkShader* s = SkGradientShader::CreateLinear(
- p, colors, NULL, 2, SkShader::kClamp_TileMode, NULL);
- paint.setShader(s);
- // Need to unref shader, otherwise never deleted.
- s->unref();
- canvas->AsCanvasSkia()->drawPath(path, paint);
- }
-};
+const int kTitleWidthPad = 2;
+const int kTitleHeightPad = 1;
+const int kButtonPad = 4;
+
+const SkColor kActiveGradientStart = 0xffebeff9;
+const SkColor kActiveGradientEnd = 0xffb3c4f6;
+const SkColor kInactiveGradientStart = 0xfff2f2f2;
+const SkColor kInactiveGradientEnd = 0xfff2f2f2;
+const SkColor kActiveColor = SK_ColorBLACK;
+const SkColor kInactiveColor = 0xff333333;
+const SkColor kCloseButtonColor = SK_ColorBLACK;
static bool resources_initialized;
static void InitializeResources() {
@@ -91,19 +63,14 @@ static void InitializeResources() {
resources_initialized = true;
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont);
- // Title fonts are the same for active and inactive.
- inactive_font = new gfx::Font(base_font.DeriveFont(0, gfx::Font::BOLD));
- active_font = inactive_font;
+ inactive_font = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont));
+ active_font = new gfx::Font(inactive_font->DeriveFont(0, gfx::Font::BOLD));
close_button_n = rb.GetBitmapNamed(IDR_TAB_CLOSE);
close_button_m = rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK);
close_button_h = rb.GetBitmapNamed(IDR_TAB_CLOSE_H);
close_button_p = rb.GetBitmapNamed(IDR_TAB_CLOSE_P);
close_button_width = close_button_n->width();
close_button_height = close_button_n->height();
-
- title_background = views::Background::CreateBackgroundPainter(
- true, new TitleBackgroundPainter());
}
} // namespace
@@ -126,10 +93,10 @@ void PanelController::Init(bool initial_focus,
const gfx::Rect& window_bounds,
XID creator_xid,
WmIpcPanelUserResizeType resize_type) {
- gfx::Rect title_bounds(0, 0, window_bounds.width(), kTitleHeight);
+ gfx::Rect title_bounds(
+ 0, 0, window_bounds.width(), kTitleHeight);
title_window_ = new views::WidgetGtk(views::WidgetGtk::TYPE_WINDOW);
- title_window_->MakeTransparent();
title_window_->Init(NULL, title_bounds);
gtk_widget_set_size_request(title_window_->GetNativeView(),
title_bounds.width(), title_bounds.height());
@@ -325,7 +292,7 @@ PanelController::TitleContentView::TitleContentView(
close_button_->SetImage(views::CustomButton::BS_HOT, close_button_h);
close_button_->SetImage(views::CustomButton::BS_PUSHED, close_button_p);
close_button_->SetBackground(
- kTitleCloseButtonColor, close_button_n, close_button_m);
+ kCloseButtonColor, close_button_n, close_button_m);
AddChildView(close_button_);
title_icon_ = new views::ImageView();
@@ -339,8 +306,7 @@ PanelController::TitleContentView::TitleContentView(
}
void PanelController::TitleContentView::Layout() {
- int close_button_x = bounds().width() -
- (close_button_width + kTitleCloseButtonPad);
+ int close_button_x = bounds().width() - (close_button_width + kButtonPad);
close_button_->SetBounds(
close_button_x,
(bounds().height() - close_button_height) / 2,
@@ -348,15 +314,15 @@ void PanelController::TitleContentView::Layout() {
close_button_height);
title_icon_->SetBounds(
kTitleWidthPad,
- kTitleHeightPad,
+ kTitleHeightPad * 2,
kTitleIconSize,
kTitleIconSize);
int title_x = kTitleWidthPad * 2 + kTitleIconSize;
title_label_->SetBounds(
title_x,
- 0,
- close_button_x - (title_x + kTitleCloseButtonPad),
- bounds().height());
+ kTitleHeightPad,
+ close_button_x - (title_x + kButtonPad),
+ bounds().height() - kTitleHeightPad);
}
bool PanelController::TitleContentView::OnMousePressed(
@@ -378,16 +344,18 @@ bool PanelController::TitleContentView::OnMouseDragged(
}
void PanelController::TitleContentView::OnFocusIn() {
- set_background(title_background);
- title_label_->SetColor(kTitleActiveColor);
+ set_background(views::Background::CreateVerticalGradientBackground(
+ kActiveGradientStart, kActiveGradientEnd));
+ title_label_->SetColor(kActiveColor);
title_label_->SetFont(*active_font);
Layout();
SchedulePaint();
}
void PanelController::TitleContentView::OnFocusOut() {
- set_background(title_background);
- title_label_->SetColor(kTitleInactiveColor);
+ set_background(views::Background::CreateVerticalGradientBackground(
+ kInactiveGradientStart, kInactiveGradientEnd));
+ title_label_->SetColor(kInactiveColor);
title_label_->SetFont(*inactive_font);
Layout();
SchedulePaint();