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; | |
157 | 156 |
158 // ShellObserver: | 157 // ShellObserver: |
159 virtual void OnMaximizeModeStarted() OVERRIDE; | 158 virtual void OnMaximizeModeStarted() OVERRIDE; |
160 virtual void OnMaximizeModeEnded() OVERRIDE; | 159 virtual void OnMaximizeModeEnded() OVERRIDE; |
161 | 160 |
162 FrameCaptionButtonContainerView* caption_button_container() { | 161 FrameCaptionButtonContainerView* caption_button_container() { |
163 return caption_button_container_; | 162 return caption_button_container_; |
164 } | 163 } |
165 | 164 |
166 views::View* avatar_icon() const { | 165 views::View* avatar_icon() const { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { | 280 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { |
282 bool paint_as_active = | 281 bool paint_as_active = |
283 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); | 282 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); |
284 caption_button_container_->SetPaintAsActive(paint_as_active); | 283 caption_button_container_->SetPaintAsActive(paint_as_active); |
285 | 284 |
286 HeaderPainter::Mode header_mode = paint_as_active ? | 285 HeaderPainter::Mode header_mode = paint_as_active ? |
287 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE; | 286 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE; |
288 header_painter_->PaintHeader(canvas, header_mode); | 287 header_painter_->PaintHeader(canvas, header_mode); |
289 } | 288 } |
290 | 289 |
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 | |
302 /////////////////////////////////////////////////////////////////////////////// | 290 /////////////////////////////////////////////////////////////////////////////// |
303 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: | 291 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: |
304 | 292 |
305 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { | 293 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { |
306 caption_button_container_->UpdateSizeButtonVisibility(); | 294 caption_button_container_->UpdateSizeButtonVisibility(); |
307 parent()->Layout(); | 295 parent()->Layout(); |
308 } | 296 } |
309 | 297 |
310 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { | 298 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { |
311 caption_button_container_->UpdateSizeButtonVisibility(); | 299 caption_button_container_->UpdateSizeButtonVisibility(); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 FrameCaptionButtonContainerView* CustomFrameViewAsh:: | 539 FrameCaptionButtonContainerView* CustomFrameViewAsh:: |
552 GetFrameCaptionButtonContainerViewForTest() { | 540 GetFrameCaptionButtonContainerViewForTest() { |
553 return header_view_->caption_button_container(); | 541 return header_view_->caption_button_container(); |
554 } | 542 } |
555 | 543 |
556 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 544 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
557 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 545 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
558 } | 546 } |
559 | 547 |
560 } // namespace ash | 548 } // namespace ash |
OLD | NEW |