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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 int GetPreferredOnScreenHeight() const; | 144 int GetPreferredOnScreenHeight() const; |
145 | 145 |
146 // Returns the view's preferred height. | 146 // Returns the view's preferred height. |
147 int GetPreferredHeight() const; | 147 int GetPreferredHeight() const; |
148 | 148 |
149 // Returns the view's minimum width. | 149 // Returns the view's minimum width. |
150 int GetMinimumWidth() const; | 150 int GetMinimumWidth() const; |
151 | 151 |
152 void UpdateAvatarIcon(); | 152 void UpdateAvatarIcon(); |
153 | 153 |
| 154 void SizeConstraintsChanged(); |
| 155 |
154 // views::View: | 156 // views::View: |
155 virtual void Layout() OVERRIDE; | 157 virtual void Layout() OVERRIDE; |
156 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 158 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
157 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 159 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
158 | 160 |
159 // ShellObserver: | 161 // ShellObserver: |
160 virtual void OnMaximizeModeStarted() OVERRIDE; | 162 virtual void OnMaximizeModeStarted() OVERRIDE; |
161 virtual void OnMaximizeModeEnded() OVERRIDE; | 163 virtual void OnMaximizeModeEnded() OVERRIDE; |
162 | 164 |
163 FrameCaptionButtonContainerView* caption_button_container() { | 165 FrameCaptionButtonContainerView* caption_button_container() { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 if (!avatar_icon_) { | 265 if (!avatar_icon_) { |
264 avatar_icon_ = new views::ImageView(); | 266 avatar_icon_ = new views::ImageView(); |
265 AddChildView(avatar_icon_); | 267 AddChildView(avatar_icon_); |
266 } | 268 } |
267 avatar_icon_->SetImage(image); | 269 avatar_icon_->SetImage(image); |
268 } | 270 } |
269 header_painter_->UpdateLeftHeaderView(avatar_icon_); | 271 header_painter_->UpdateLeftHeaderView(avatar_icon_); |
270 Layout(); | 272 Layout(); |
271 } | 273 } |
272 | 274 |
| 275 void CustomFrameViewAsh::HeaderView::SizeConstraintsChanged() { |
| 276 caption_button_container_->ResetWindowControls(); |
| 277 caption_button_container_->UpdateSizeButtonVisibility(); |
| 278 Layout(); |
| 279 } |
| 280 |
273 /////////////////////////////////////////////////////////////////////////////// | 281 /////////////////////////////////////////////////////////////////////////////// |
274 // CustomFrameViewAsh::HeaderView, views::View overrides: | 282 // CustomFrameViewAsh::HeaderView, views::View overrides: |
275 | 283 |
276 void CustomFrameViewAsh::HeaderView::Layout() { | 284 void CustomFrameViewAsh::HeaderView::Layout() { |
277 header_painter_->LayoutHeader(); | 285 header_painter_->LayoutHeader(); |
278 } | 286 } |
279 | 287 |
280 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { | 288 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { |
281 bool paint_as_active = | 289 bool paint_as_active = |
282 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); | 290 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 header_view_->ResetWindowControls(); | 490 header_view_->ResetWindowControls(); |
483 } | 491 } |
484 | 492 |
485 void CustomFrameViewAsh::UpdateWindowIcon() { | 493 void CustomFrameViewAsh::UpdateWindowIcon() { |
486 } | 494 } |
487 | 495 |
488 void CustomFrameViewAsh::UpdateWindowTitle() { | 496 void CustomFrameViewAsh::UpdateWindowTitle() { |
489 header_view_->SchedulePaintForTitle(); | 497 header_view_->SchedulePaintForTitle(); |
490 } | 498 } |
491 | 499 |
| 500 void CustomFrameViewAsh::SizeConstraintsChanged() { |
| 501 header_view_->SizeConstraintsChanged(); |
| 502 } |
| 503 |
492 //////////////////////////////////////////////////////////////////////////////// | 504 //////////////////////////////////////////////////////////////////////////////// |
493 // CustomFrameViewAsh, views::View overrides: | 505 // CustomFrameViewAsh, views::View overrides: |
494 | 506 |
495 gfx::Size CustomFrameViewAsh::GetPreferredSize() const { | 507 gfx::Size CustomFrameViewAsh::GetPreferredSize() const { |
496 gfx::Size pref = frame_->client_view()->GetPreferredSize(); | 508 gfx::Size pref = frame_->client_view()->GetPreferredSize(); |
497 gfx::Rect bounds(0, 0, pref.width(), pref.height()); | 509 gfx::Rect bounds(0, 0, pref.width(), pref.height()); |
498 return frame_->non_client_view()->GetWindowBoundsForClientBounds( | 510 return frame_->non_client_view()->GetWindowBoundsForClientBounds( |
499 bounds).size(); | 511 bounds).size(); |
500 } | 512 } |
501 | 513 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 FrameCaptionButtonContainerView* CustomFrameViewAsh:: | 580 FrameCaptionButtonContainerView* CustomFrameViewAsh:: |
569 GetFrameCaptionButtonContainerViewForTest() { | 581 GetFrameCaptionButtonContainerViewForTest() { |
570 return header_view_->caption_button_container(); | 582 return header_view_->caption_button_container(); |
571 } | 583 } |
572 | 584 |
573 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 585 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
574 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 586 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
575 } | 587 } |
576 | 588 |
577 } // namespace ash | 589 } // namespace ash |
OLD | NEW |