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