window_state_ = NULL;
}
// Overridden from ash::wm::WindowStateObserver:
- virtual void OnWindowShowTypeChanged(
+ virtual void OnPostWindowShowTypeChange(
ash::wm::WindowState* window_state,
ash::wm::WindowShowType old_type) OVERRIDE {
if (!window_state->IsFullscreen() &&
}
void CustomFrameViewAsh::OverlayView::Layout() {
+ // Layout |header_view_| because layout affects the result of
+ // GetPreferredOnScreenHeight().
+ header_view_->Layout();
+
int onscreen_height = header_view_->GetPreferredOnScreenHeight();
if (onscreen_height == 0) {
header_view_->SetVisible(false);
if (!window_state->HasDelegate()) {
window_state->SetDelegate(scoped_ptr<wm::WindowStateDelegate>(
new CustomFrameViewAshWindowStateDelegate(
- window_state, this)).Pass());
+ window_state, this)));
}
}
}
void CustomFrameViewAsh::SchedulePaintInRect(const gfx::Rect& r) {
- // The HeaderView is not a child of CustomFrameViewAsh. Redirect the paint to
- // HeaderView instead.
- gfx::RectF to_paint(r);
- views::View::ConvertRectToTarget(this, header_view_, &to_paint);
- header_view_->SchedulePaintInRect(gfx::ToEnclosingRect(to_paint));
+ // We may end up here before |header_view_| has been added to the Widget.
+ if (header_view_->GetWidget()) {
+ // The HeaderView is not a child of CustomFrameViewAsh. Redirect the paint
+ // to HeaderView instead.
+ gfx::RectF to_paint(r);
+ views::View::ConvertRectToTarget(this, header_view_, &to_paint);
+ header_view_->SchedulePaintInRect(gfx::ToEnclosingRect(to_paint));
+ } else {
+ views::NonClientFrameView::SchedulePaintInRect(r);
+ }
}
bool CustomFrameViewAsh::HitTestRect(const gfx::Rect& rect) const {