Chromium Code Reviews| 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> | |
|
flackr
2014/05/08 19:02:21
not used?
jonross
2014/05/08 21:15:40
Cpplint, used outside my changed.
| |
| 8 #include <vector> | |
|
flackr
2014/05/08 19:02:21
not used?
jonross
2014/05/08 21:15:40
Cpplint, used outside my changed.
| |
| 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/caption_buttons/frame_maximize_button.h" | 12 #include "ash/frame/caption_buttons/frame_maximize_button.h" |
| 10 #include "ash/frame/caption_buttons/frame_maximize_button_observer.h" | 13 #include "ash/frame/caption_buttons/frame_maximize_button_observer.h" |
| 11 #include "ash/frame/default_header_painter.h" | 14 #include "ash/frame/default_header_painter.h" |
| 12 #include "ash/frame/frame_border_hit_test_controller.h" | 15 #include "ash/frame/frame_border_hit_test_controller.h" |
| 13 #include "ash/frame/frame_util.h" | 16 #include "ash/frame/frame_util.h" |
| 14 #include "ash/frame/header_painter.h" | 17 #include "ash/frame/header_painter.h" |
| 15 #include "ash/session/session_state_delegate.h" | 18 #include "ash/session/session_state_delegate.h" |
| 16 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 int GetPreferredHeight() const; | 150 int GetPreferredHeight() const; |
| 148 | 151 |
| 149 // Returns the view's minimum width. | 152 // Returns the view's minimum width. |
| 150 int GetMinimumWidth() const; | 153 int GetMinimumWidth() const; |
| 151 | 154 |
| 152 void UpdateAvatarIcon(); | 155 void UpdateAvatarIcon(); |
| 153 | 156 |
| 154 // views::View: | 157 // views::View: |
| 155 virtual void Layout() OVERRIDE; | 158 virtual void Layout() OVERRIDE; |
| 156 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 159 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 160 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | |
| 157 | 161 |
| 158 // ShellObserver: | 162 // ShellObserver: |
| 159 virtual void OnMaximizeModeStarted() OVERRIDE; | 163 virtual void OnMaximizeModeStarted() OVERRIDE; |
| 160 virtual void OnMaximizeModeEnded() OVERRIDE; | 164 virtual void OnMaximizeModeEnded() OVERRIDE; |
| 161 | 165 |
| 162 FrameCaptionButtonContainerView* caption_button_container() { | 166 FrameCaptionButtonContainerView* caption_button_container() { |
| 163 return caption_button_container_; | 167 return caption_button_container_; |
| 164 } | 168 } |
| 165 | 169 |
| 166 views::View* avatar_icon() const { | 170 views::View* avatar_icon() const { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { | 305 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { |
| 302 bool paint_as_active = | 306 bool paint_as_active = |
| 303 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); | 307 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); |
| 304 caption_button_container_->SetPaintAsActive(paint_as_active); | 308 caption_button_container_->SetPaintAsActive(paint_as_active); |
| 305 | 309 |
| 306 HeaderPainter::Mode header_mode = paint_as_active ? | 310 HeaderPainter::Mode header_mode = paint_as_active ? |
| 307 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE; | 311 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE; |
| 308 header_painter_->PaintHeader(canvas, header_mode); | 312 header_painter_->PaintHeader(canvas, header_mode); |
| 309 } | 313 } |
| 310 | 314 |
| 315 void | |
| 316 CustomFrameViewAsh::HeaderView::ChildPreferredSizeChanged(views::View* child) { | |
| 317 if (child != caption_button_container_) | |
|
flackr
2014/05/08 19:02:21
Comment why.
jonross
2014/05/08 21:15:40
Done.
| |
| 318 return; | |
| 319 parent()->Layout(); | |
| 320 } | |
| 321 | |
| 311 /////////////////////////////////////////////////////////////////////////////// | 322 /////////////////////////////////////////////////////////////////////////////// |
| 312 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: | 323 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: |
| 313 | 324 |
| 314 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { | 325 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { |
| 315 caption_button_container_->UpdateSizeButtonVisibility(true); | 326 caption_button_container_->UpdateSizeButtonVisibility(true); |
| 316 parent()->Layout(); | 327 parent()->Layout(); |
| 317 } | 328 } |
| 318 | 329 |
| 319 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { | 330 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { |
| 320 caption_button_container_->UpdateSizeButtonVisibility(false); | 331 caption_button_container_->UpdateSizeButtonVisibility(false); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 574 FrameCaptionButtonContainerView* CustomFrameViewAsh:: | 585 FrameCaptionButtonContainerView* CustomFrameViewAsh:: |
| 575 GetFrameCaptionButtonContainerViewForTest() { | 586 GetFrameCaptionButtonContainerViewForTest() { |
| 576 return header_view_->caption_button_container(); | 587 return header_view_->caption_button_container(); |
| 577 } | 588 } |
| 578 | 589 |
| 579 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 590 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
| 580 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 591 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
| 581 } | 592 } |
| 582 | 593 |
| 583 } // namespace ash | 594 } // namespace ash |
| OLD | NEW |