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

Unified Diff: ash/wm/frame_painter.cc

Issue 10993087: Handle titlebar text updates properly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Odd - build machine failed to update patch (which I updated successfully) Re-uploading Created 8 years, 3 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/frame_painter.h ('k') | ash/wm/panel_frame_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/frame_painter.cc
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index fc950aec6b6ce1e6e22263560167bf6424969366..e86bc3b26c86b174d0fd309474350d0e93495c1e 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -451,16 +451,7 @@ void FramePainter::PaintTitleBar(views::NonClientFrameView* view,
// The window icon is painted by its own views::View.
views::WidgetDelegate* delegate = frame_->widget_delegate();
if (delegate && delegate->ShouldShowWindowTitle()) {
- int title_x = GetTitleOffsetX();
- // Center the text in the middle of the caption - this way it adapts
- // automatically to the caption height (which is given by the owner).
- int title_y =
- (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2;
- gfx::Rect title_bounds(
- title_x,
- std::max(0, title_y),
- std::max(0, size_button_->x() - kTitleLogoSpacing - title_x),
- title_font.GetHeight());
+ gfx::Rect title_bounds = GetTitleBounds(view, title_font);
canvas->DrawStringInt(delegate->GetWindowTitle(),
title_font,
kTitleTextColor,
@@ -533,6 +524,12 @@ void FramePainter::LayoutHeader(views::NonClientFrameView* view,
gfx::Rect(kIconOffsetX, kIconOffsetY, kIconSize, kIconSize));
}
+void FramePainter::SchedulePaintForTitle(views::NonClientFrameView* view,
+ const gfx::Font& title_font) {
+ frame_->non_client_view()->SchedulePaintInRect(
+ GetTitleBounds(view, title_font));
+}
+
///////////////////////////////////////////////////////////////////////////////
// aura::WindowObserver overrides:
@@ -736,4 +733,18 @@ void FramePainter::SchedulePaintForHeader() {
std::max(top_left_height, top_right_height)));
}
+gfx::Rect FramePainter::GetTitleBounds(views::NonClientFrameView* view,
+ const gfx::Font& title_font) {
+ int title_x = GetTitleOffsetX();
+ // Center the text in the middle of the caption - this way it adapts
+ // automatically to the caption height (which is given by the owner).
+ int title_y =
+ (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2;
+ return gfx::Rect(
+ title_x,
+ std::max(0, title_y),
+ std::max(0, size_button_->x() - kTitleLogoSpacing - title_x),
+ title_font.GetHeight());
+}
+
} // namespace ash
« no previous file with comments | « ash/wm/frame_painter.h ('k') | ash/wm/panel_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698