Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: ash/frame/custom_frame_view_ash.cc

Issue 308683002: Move MaximizeModeWindowManager to the controller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
jonross 2014/05/29 15:24:42 cpplint
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 caption_button_container_(NULL), 199 caption_button_container_(NULL),
197 fullscreen_visible_fraction_(0) { 200 fullscreen_visible_fraction_(0) {
198 // Unfortunately, there is no views::WidgetDelegate::CanMinimize(). Assume 201 // Unfortunately, there is no views::WidgetDelegate::CanMinimize(). Assume
199 // that the window frame can be minimized if it can be maximized. 202 // that the window frame can be minimized if it can be maximized.
200 FrameCaptionButtonContainerView::MinimizeAllowed minimize_allowed = 203 FrameCaptionButtonContainerView::MinimizeAllowed minimize_allowed =
201 frame_->widget_delegate()->CanMaximize() ? 204 frame_->widget_delegate()->CanMaximize() ?
202 FrameCaptionButtonContainerView::MINIMIZE_ALLOWED : 205 FrameCaptionButtonContainerView::MINIMIZE_ALLOWED :
203 FrameCaptionButtonContainerView::MINIMIZE_DISALLOWED; 206 FrameCaptionButtonContainerView::MINIMIZE_DISALLOWED;
204 caption_button_container_ = new FrameCaptionButtonContainerView(frame_, 207 caption_button_container_ = new FrameCaptionButtonContainerView(frame_,
205 minimize_allowed); 208 minimize_allowed);
206 caption_button_container_->UpdateSizeButtonVisibility(Shell::GetInstance()-> 209 caption_button_container_->UpdateSizeButtonVisibility();
207 IsMaximizeModeWindowManagerEnabled());
208 AddChildView(caption_button_container_); 210 AddChildView(caption_button_container_);
209 211
210 header_painter_->Init(frame_, this, NULL, caption_button_container_); 212 header_painter_->Init(frame_, this, NULL, caption_button_container_);
211 UpdateAvatarIcon(); 213 UpdateAvatarIcon();
212 214
213 Shell::GetInstance()->AddShellObserver(this); 215 Shell::GetInstance()->AddShellObserver(this);
214 } 216 }
215 217
216 CustomFrameViewAsh::HeaderView::~HeaderView() { 218 CustomFrameViewAsh::HeaderView::~HeaderView() {
217 Shell::GetInstance()->RemoveShellObserver(this); 219 Shell::GetInstance()->RemoveShellObserver(this);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 284
283 HeaderPainter::Mode header_mode = paint_as_active ? 285 HeaderPainter::Mode header_mode = paint_as_active ?
284 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE; 286 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE;
285 header_painter_->PaintHeader(canvas, header_mode); 287 header_painter_->PaintHeader(canvas, header_mode);
286 } 288 }
287 289
288 /////////////////////////////////////////////////////////////////////////////// 290 ///////////////////////////////////////////////////////////////////////////////
289 // CustomFrameViewAsh::HeaderView, ShellObserver overrides: 291 // CustomFrameViewAsh::HeaderView, ShellObserver overrides:
290 292
291 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() { 293 void CustomFrameViewAsh::HeaderView::OnMaximizeModeStarted() {
292 caption_button_container_->UpdateSizeButtonVisibility(true); 294 caption_button_container_->UpdateSizeButtonVisibility();
293 parent()->Layout(); 295 parent()->Layout();
294 } 296 }
295 297
296 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() { 298 void CustomFrameViewAsh::HeaderView::OnMaximizeModeEnded() {
297 caption_button_container_->UpdateSizeButtonVisibility(false); 299 caption_button_container_->UpdateSizeButtonVisibility();
298 parent()->Layout(); 300 parent()->Layout();
299 } 301 }
300 302
301 /////////////////////////////////////////////////////////////////////////////// 303 ///////////////////////////////////////////////////////////////////////////////
302 // CustomFrameViewAsh::HeaderView, 304 // CustomFrameViewAsh::HeaderView,
303 // ImmersiveFullscreenController::Delegate overrides: 305 // ImmersiveFullscreenController::Delegate overrides:
304 306
305 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealStarted() { 307 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealStarted() {
306 fullscreen_visible_fraction_ = 0; 308 fullscreen_visible_fraction_ = 0;
307 SetPaintToLayer(true); 309 SetPaintToLayer(true);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 FrameCaptionButtonContainerView* CustomFrameViewAsh:: 539 FrameCaptionButtonContainerView* CustomFrameViewAsh::
538 GetFrameCaptionButtonContainerViewForTest() { 540 GetFrameCaptionButtonContainerViewForTest() {
539 return header_view_->caption_button_container(); 541 return header_view_->caption_button_container();
540 } 542 }
541 543
542 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 544 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
543 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 545 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
544 } 546 }
545 547
546 } // namespace ash 548 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698