OLD | NEW |
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> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int GetPreferredHeight() const; | 146 int GetPreferredHeight() const; |
147 | 147 |
148 // Returns the view's minimum width. | 148 // Returns the view's minimum width. |
149 int GetMinimumWidth() const; | 149 int GetMinimumWidth() const; |
150 | 150 |
151 void UpdateAvatarIcon(); | 151 void UpdateAvatarIcon(); |
152 | 152 |
153 // views::View: | 153 // views::View: |
154 virtual void Layout() OVERRIDE; | 154 virtual void Layout() OVERRIDE; |
155 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 155 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 156 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
156 | 157 |
157 // ShellObserver: | 158 // ShellObserver: |
158 virtual void OnMaximizeModeStarted() OVERRIDE; | 159 virtual void OnMaximizeModeStarted() OVERRIDE; |
159 virtual void OnMaximizeModeEnded() OVERRIDE; | 160 virtual void OnMaximizeModeEnded() OVERRIDE; |
160 | 161 |
161 FrameCaptionButtonContainerView* caption_button_container() { | 162 FrameCaptionButtonContainerView* caption_button_container() { |
162 return caption_button_container_; | 163 return caption_button_container_; |
163 } | 164 } |
164 | 165 |
165 views::View* avatar_icon() const { | 166 views::View* avatar_icon() const { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { | 281 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { |
281 bool paint_as_active = | 282 bool paint_as_active = |
282 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); | 283 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); |
283 caption_button_container_->SetPaintAsActive(paint_as_active); | 284 caption_button_container_->SetPaintAsActive(paint_as_active); |
284 | 285 |
285 HeaderPainter::Mode header_mode = paint_as_active ? | 286 HeaderPainter::Mode header_mode = paint_as_active ? |
286 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE; | 287 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE; |
287 header_painter_->PaintHeader(canvas, header_mode); | 288 header_painter_->PaintHeader(canvas, header_mode); |
288 } | 289 } |
289 | 290 |
| 291 void CustomFrameViewAsh::HeaderView:: |
| 292 ChildPreferredSizeChanged(views::View* child) { |
| 293 // FrameCaptionButtonContainerView animates the visibility changes in |
| 294 // UpdateSizeButtonVisibility(false). Due to this a new size is not available |
| 295 // until the completion of the animation. Layout it response to the preferred |
| 296 // size changes. |
| 297 if (child != caption_button_container_) |
| 298 return; |
| 299 parent()->Layout(); |
| 300 } |
| 301 |
290 /////////////////////////////////////////////////////////////////////////////// | 302 /////////////////////////////////////////////////////////////////////////////// |
291 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: | 303 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: |
292 | 304 |
293 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { | 305 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { |
294 caption_button_container_->UpdateSizeButtonVisibility(); | 306 caption_button_container_->UpdateSizeButtonVisibility(); |
295 parent()->Layout(); | 307 parent()->Layout(); |
296 } | 308 } |
297 | 309 |
298 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { | 310 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { |
299 caption_button_container_->UpdateSizeButtonVisibility(); | 311 caption_button_container_->UpdateSizeButtonVisibility(); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 FrameCaptionButtonContainerView* CustomFrameViewAsh:: | 551 FrameCaptionButtonContainerView* CustomFrameViewAsh:: |
540 GetFrameCaptionButtonContainerViewForTest() { | 552 GetFrameCaptionButtonContainerViewForTest() { |
541 return header_view_->caption_button_container(); | 553 return header_view_->caption_button_container(); |
542 } | 554 } |
543 | 555 |
544 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 556 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
545 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 557 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
546 } | 558 } |
547 | 559 |
548 } // namespace ash | 560 } // namespace ash |
OLD | NEW |