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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 !window_state->IsMinimized() && | 101 !window_state->IsMinimized() && |
102 immersive_fullscreen_controller_.get() && | 102 immersive_fullscreen_controller_.get() && |
103 immersive_fullscreen_controller_->IsEnabled()) { | 103 immersive_fullscreen_controller_->IsEnabled()) { |
104 immersive_fullscreen_controller_->SetEnabled( | 104 immersive_fullscreen_controller_->SetEnabled( |
105 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, | 105 ash::ImmersiveFullscreenController::WINDOW_TYPE_OTHER, |
106 false); | 106 false); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 ash::wm::WindowState* window_state_; | 110 ash::wm::WindowState* window_state_; |
111 scoped_ptr<ash::ImmersiveFullscreenController> | 111 std::unique_ptr<ash::ImmersiveFullscreenController> |
112 immersive_fullscreen_controller_; | 112 immersive_fullscreen_controller_; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshWindowStateDelegate); | 114 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshWindowStateDelegate); |
115 }; | 115 }; |
116 | 116 |
117 } // namespace | 117 } // namespace |
118 | 118 |
119 namespace ash { | 119 namespace ash { |
120 | 120 |
121 /////////////////////////////////////////////////////////////////////////////// | 121 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void OnImmersiveRevealStarted() override; | 175 void OnImmersiveRevealStarted() override; |
176 void OnImmersiveRevealEnded() override; | 176 void OnImmersiveRevealEnded() override; |
177 void OnImmersiveFullscreenExited() override; | 177 void OnImmersiveFullscreenExited() override; |
178 void SetVisibleFraction(double visible_fraction) override; | 178 void SetVisibleFraction(double visible_fraction) override; |
179 std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override; | 179 std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override; |
180 | 180 |
181 // The widget that the caption buttons act on. | 181 // The widget that the caption buttons act on. |
182 views::Widget* frame_; | 182 views::Widget* frame_; |
183 | 183 |
184 // Helper for painting the header. | 184 // Helper for painting the header. |
185 scoped_ptr<DefaultHeaderPainter> header_painter_; | 185 std::unique_ptr<DefaultHeaderPainter> header_painter_; |
186 | 186 |
187 views::ImageView* avatar_icon_; | 187 views::ImageView* avatar_icon_; |
188 | 188 |
189 // View which contains the window caption buttons. | 189 // View which contains the window caption buttons. |
190 FrameCaptionButtonContainerView* caption_button_container_; | 190 FrameCaptionButtonContainerView* caption_button_container_; |
191 | 191 |
192 // The fraction of the header's height which is visible while in fullscreen. | 192 // The fraction of the header's height which is visible while in fullscreen. |
193 // This value is meaningless when not in fullscreen. | 193 // This value is meaningless when not in fullscreen. |
194 double fullscreen_visible_fraction_; | 194 double fullscreen_visible_fraction_; |
195 | 195 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 380 |
381 HeaderView* header_view_; | 381 HeaderView* header_view_; |
382 | 382 |
383 DISALLOW_COPY_AND_ASSIGN(OverlayView); | 383 DISALLOW_COPY_AND_ASSIGN(OverlayView); |
384 }; | 384 }; |
385 | 385 |
386 CustomFrameViewAsh::OverlayView::OverlayView(HeaderView* header_view) | 386 CustomFrameViewAsh::OverlayView::OverlayView(HeaderView* header_view) |
387 : header_view_(header_view) { | 387 : header_view_(header_view) { |
388 AddChildView(header_view); | 388 AddChildView(header_view); |
389 SetEventTargeter( | 389 SetEventTargeter( |
390 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 390 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
391 } | 391 } |
392 | 392 |
393 CustomFrameViewAsh::OverlayView::~OverlayView() { | 393 CustomFrameViewAsh::OverlayView::~OverlayView() { |
394 } | 394 } |
395 | 395 |
396 /////////////////////////////////////////////////////////////////////////////// | 396 /////////////////////////////////////////////////////////////////////////////// |
397 // CustomFrameViewAsh::OverlayView, views::View overrides: | 397 // CustomFrameViewAsh::OverlayView, views::View overrides: |
398 | 398 |
399 void CustomFrameViewAsh::OverlayView::Layout() { | 399 void CustomFrameViewAsh::OverlayView::Layout() { |
400 // Layout |header_view_| because layout affects the result of | 400 // Layout |header_view_| because layout affects the result of |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 frame_border_hit_test_controller_( | 435 frame_border_hit_test_controller_( |
436 new FrameBorderHitTestController(frame_)) { | 436 new FrameBorderHitTestController(frame_)) { |
437 // |header_view_| is set as the non client view's overlay view so that it can | 437 // |header_view_| is set as the non client view's overlay view so that it can |
438 // overlay the web contents in immersive fullscreen. | 438 // overlay the web contents in immersive fullscreen. |
439 frame->non_client_view()->SetOverlayView(new OverlayView(header_view_)); | 439 frame->non_client_view()->SetOverlayView(new OverlayView(header_view_)); |
440 | 440 |
441 // A delegate for a more complex way of fullscreening the window may already | 441 // A delegate for a more complex way of fullscreening the window may already |
442 // be set. This is the case for packaged apps. | 442 // be set. This is the case for packaged apps. |
443 wm::WindowState* window_state = wm::GetWindowState(frame->GetNativeWindow()); | 443 wm::WindowState* window_state = wm::GetWindowState(frame->GetNativeWindow()); |
444 if (!window_state->HasDelegate()) { | 444 if (!window_state->HasDelegate()) { |
445 window_state->SetDelegate(scoped_ptr<wm::WindowStateDelegate>( | 445 window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>( |
446 new CustomFrameViewAshWindowStateDelegate( | 446 new CustomFrameViewAshWindowStateDelegate(window_state, this))); |
447 window_state, this))); | |
448 } | 447 } |
449 } | 448 } |
450 | 449 |
451 CustomFrameViewAsh::~CustomFrameViewAsh() { | 450 CustomFrameViewAsh::~CustomFrameViewAsh() { |
452 } | 451 } |
453 | 452 |
454 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( | 453 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( |
455 ImmersiveFullscreenController* immersive_fullscreen_controller) { | 454 ImmersiveFullscreenController* immersive_fullscreen_controller) { |
456 immersive_fullscreen_controller->Init(header_view_, frame_, header_view_); | 455 immersive_fullscreen_controller->Init(header_view_, frame_, header_view_); |
457 } | 456 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 FrameCaptionButtonContainerView* CustomFrameViewAsh:: | 580 FrameCaptionButtonContainerView* CustomFrameViewAsh:: |
582 GetFrameCaptionButtonContainerViewForTest() { | 581 GetFrameCaptionButtonContainerViewForTest() { |
583 return header_view_->caption_button_container(); | 582 return header_view_->caption_button_container(); |
584 } | 583 } |
585 | 584 |
586 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 585 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
587 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 586 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
588 } | 587 } |
589 | 588 |
590 } // namespace ash | 589 } // namespace ash |
OLD | NEW |