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