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

Side by Side Diff: ash/frame/custom_frame_view_ash.cc

Issue 271913002: Animate window control changes in TouchView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change layout to be agnostic of which button is animating Created 6 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/frame/custom_frame_view_ash.h" 5 #include "ash/frame/custom_frame_view_ash.h"
6 6
7 #include <algorithm>
8 #include <vector>
9
7 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 11 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
9 #include "ash/frame/caption_buttons/frame_maximize_button.h" 12 #include "ash/frame/caption_buttons/frame_maximize_button.h"
10 #include "ash/frame/caption_buttons/frame_maximize_button_observer.h" 13 #include "ash/frame/caption_buttons/frame_maximize_button_observer.h"
11 #include "ash/frame/default_header_painter.h" 14 #include "ash/frame/default_header_painter.h"
12 #include "ash/frame/frame_border_hit_test_controller.h" 15 #include "ash/frame/frame_border_hit_test_controller.h"
13 #include "ash/frame/frame_util.h" 16 #include "ash/frame/frame_util.h"
14 #include "ash/frame/header_painter.h" 17 #include "ash/frame/header_painter.h"
15 #include "ash/session/session_state_delegate.h" 18 #include "ash/session/session_state_delegate.h"
16 #include "ash/shell.h" 19 #include "ash/shell.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 int GetPreferredHeight() const; 150 int GetPreferredHeight() const;
148 151
149 // Returns the view's minimum width. 152 // Returns the view's minimum width.
150 int GetMinimumWidth() const; 153 int GetMinimumWidth() const;
151 154
152 void UpdateAvatarIcon(); 155 void UpdateAvatarIcon();
153 156
154 // views::View: 157 // views::View:
155 virtual void Layout() OVERRIDE; 158 virtual void Layout() OVERRIDE;
156 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 159 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
160 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
157 161
158 // ShellObserver: 162 // ShellObserver:
159 virtual void OnMaximizeModeStarted() OVERRIDE; 163 virtual void OnMaximizeModeStarted() OVERRIDE;
160 virtual void OnMaximizeModeEnded() OVERRIDE; 164 virtual void OnMaximizeModeEnded() OVERRIDE;
161 165
162 FrameCaptionButtonContainerView* caption_button_container() { 166 FrameCaptionButtonContainerView* caption_button_container() {
163 return caption_button_container_; 167 return caption_button_container_;
164 } 168 }
165 169
166 views::View* avatar_icon() const { 170 views::View* avatar_icon() const {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { 305 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) {
302 bool paint_as_active = 306 bool paint_as_active =
303 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); 307 frame_->non_client_view()->frame_view()->ShouldPaintAsActive();
304 caption_button_container_->SetPaintAsActive(paint_as_active); 308 caption_button_container_->SetPaintAsActive(paint_as_active);
305 309
306 HeaderPainter::Mode header_mode = paint_as_active ? 310 HeaderPainter::Mode header_mode = paint_as_active ?
307 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE; 311 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE;
308 header_painter_->PaintHeader(canvas, header_mode); 312 header_painter_->PaintHeader(canvas, header_mode);
309 } 313 }
310 314
315 void CustomFrameViewAsh::HeaderView::
316 ChildPreferredSizeChanged(views::View* child) {
317 // FrameCaptionButtonContainerView animates the visibility changes in
318 // UpdateSizeButtonVisibility(false). Due to this a new size is not available
319 // until the completion of the animation. Layout it response to the preferred
320 // size changes.
321 if (child != caption_button_container_)
322 return;
323 parent()->Layout();
324 }
325
311 /////////////////////////////////////////////////////////////////////////////// 326 ///////////////////////////////////////////////////////////////////////////////
312 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: 327 // CustomFrameViewAsh::HeaderView, ShellObserver overrides:
313 328
314 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { 329 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() {
315 caption_button_container_->UpdateSizeButtonVisibility(true); 330 caption_button_container_->UpdateSizeButtonVisibility(true);
316 parent()->Layout(); 331 parent()->Layout();
317 } 332 }
318 333
319 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { 334 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() {
320 caption_button_container_->UpdateSizeButtonVisibility(false); 335 caption_button_container_->UpdateSizeButtonVisibility(false);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 FrameCaptionButtonContainerView* CustomFrameViewAsh:: 589 FrameCaptionButtonContainerView* CustomFrameViewAsh::
575 GetFrameCaptionButtonContainerViewForTest() { 590 GetFrameCaptionButtonContainerViewForTest() {
576 return header_view_->caption_button_container(); 591 return header_view_->caption_button_container();
577 } 592 }
578 593
579 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 594 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
580 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 595 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
581 } 596 }
582 597
583 } // namespace ash 598 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698