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

Unified Diff: ash/wm/panel_frame_view.cc

Issue 12212207: Support panel titles and Icons for v1 apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment. Created 7 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 | « ash/wm/panel_frame_view.h ('k') | ash/wm/panel_window_event_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/panel_frame_view.cc
diff --git a/ash/wm/panel_frame_view.cc b/ash/wm/panel_frame_view.cc
index bb37e514daa55ad31dcec93585b0676846457f5e..261176be286ecbe8fa618a4062f5b3caff1a4e75 100644
--- a/ash/wm/panel_frame_view.cc
+++ b/ash/wm/panel_frame_view.cc
@@ -23,15 +23,20 @@
namespace ash {
-PanelFrameView::PanelFrameView(views::Widget* frame, FrameType frame_type) {
+PanelFrameView::PanelFrameView(views::Widget* frame, FrameType frame_type)
+ : frame_(frame),
+ close_button_(NULL),
+ minimize_button_(NULL),
+ window_icon_(NULL),
+ title_font_(gfx::Font(views::NativeWidgetAura::GetWindowTitleFont())) {
if (frame_type != FRAME_NONE)
- InitFramePainter(frame);
+ InitFramePainter();
}
PanelFrameView::~PanelFrameView() {
}
-void PanelFrameView::InitFramePainter(views::Widget* frame) {
+void PanelFrameView::InitFramePainter() {
frame_painter_.reset(new FramePainter);
close_button_ = new views::ImageButton(this);
@@ -44,7 +49,12 @@ void PanelFrameView::InitFramePainter(views::Widget* frame) {
l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MINIMIZE));
AddChildView(minimize_button_);
- frame_painter_->Init(frame, NULL, minimize_button_, close_button_,
+ if (frame_->widget_delegate()->ShouldShowWindowIcon()) {
+ window_icon_ = new views::ImageButton(this);
+ AddChildView(window_icon_);
+ }
+
+ frame_painter_->Init(frame_, window_icon_, minimize_button_, close_button_,
FramePainter::SIZE_BUTTON_MINIMIZES);
}
@@ -59,11 +69,20 @@ void PanelFrameView::ResetWindowControls() {
}
void PanelFrameView::UpdateWindowIcon() {
- // TODO(stevenjb): Support icons for panels?
+ if (!window_icon_)
+ return;
+ views::WidgetDelegate* delegate = frame_->widget_delegate();
+ if (delegate) {
+ gfx::ImageSkia image = delegate->GetWindowIcon();
+ window_icon_->SetImage(views::CustomButton::STATE_NORMAL, &image);
+ }
+ window_icon_->SchedulePaint();
}
void PanelFrameView::UpdateWindowTitle() {
- // TODO(stevenjb): Support titles for panels?
+ if (!frame_painter_.get())
+ return;
+ frame_painter_->SchedulePaintForTitle(this, title_font_);
}
void PanelFrameView::GetWindowMask(const gfx::Size&, gfx::Path*) {
@@ -88,6 +107,7 @@ void PanelFrameView::OnPaint(gfx::Canvas* canvas) {
paint_as_active ? FramePainter::ACTIVE : FramePainter::INACTIVE,
theme_image_id,
NULL);
+ frame_painter_->PaintTitleBar(this, canvas, title_font_);
frame_painter_->PaintHeaderContentSeparator(this, canvas);
}
« no previous file with comments | « ash/wm/panel_frame_view.h ('k') | ash/wm/panel_window_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698