| 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/wm/custom_frame_view_ash.h" | 5 #include "ash/wm/custom_frame_view_ash.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" | 8 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" |
| 9 #include "ash/wm/caption_buttons/frame_maximize_button.h" | 9 #include "ash/wm/caption_buttons/frame_maximize_button.h" |
| 10 #include "ash/wm/caption_buttons/frame_maximize_button_observer.h" | 10 #include "ash/wm/caption_buttons/frame_maximize_button_observer.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 public ash::wm::WindowStateObserver, | 51 public ash::wm::WindowStateObserver, |
| 52 public aura::WindowObserver { | 52 public aura::WindowObserver { |
| 53 public: | 53 public: |
| 54 CustomFrameViewAshWindowStateDelegate( | 54 CustomFrameViewAshWindowStateDelegate( |
| 55 ash::wm::WindowState* window_state, | 55 ash::wm::WindowState* window_state, |
| 56 ash::CustomFrameViewAsh* custom_frame_view) | 56 ash::CustomFrameViewAsh* custom_frame_view) |
| 57 : window_state_(NULL) { | 57 : window_state_(NULL) { |
| 58 #if defined(OS_CHROMEOS) | 58 #if defined(OS_CHROMEOS) |
| 59 // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for | 59 // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for |
| 60 // Windows Ash. | 60 // Windows Ash. |
| 61 if (ash::switches::UseImmersiveFullscreenForAllWindows()) { | 61 immersive_fullscreen_controller_.reset( |
| 62 immersive_fullscreen_controller_.reset( | 62 new ash::ImmersiveFullscreenController); |
| 63 new ash::ImmersiveFullscreenController); | 63 custom_frame_view->InitImmersiveFullscreenControllerForView( |
| 64 custom_frame_view->InitImmersiveFullscreenControllerForView( | 64 immersive_fullscreen_controller_.get()); |
| 65 immersive_fullscreen_controller_.get()); | |
| 66 | 65 |
| 67 // Add a window state observer to exit fullscreen properly in case | 66 // Add a window state observer to exit fullscreen properly in case |
| 68 // fullscreen is exited without going through | 67 // fullscreen is exited without going through |
| 69 // WindowState::ToggleFullscreen(). This is the case when exiting | 68 // WindowState::ToggleFullscreen(). This is the case when exiting |
| 70 // immersive fullscreen via the "Restore" window control. | 69 // immersive fullscreen via the "Restore" window control. |
| 71 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 | 70 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 |
| 72 window_state_ = window_state; | 71 window_state_ = window_state; |
| 73 window_state_->AddObserver(this); | 72 window_state_->AddObserver(this); |
| 74 window_state_->window()->AddObserver(this); | 73 window_state_->window()->AddObserver(this); |
| 75 } | |
| 76 #endif | 74 #endif |
| 77 } | 75 } |
| 78 virtual ~CustomFrameViewAshWindowStateDelegate() { | 76 virtual ~CustomFrameViewAshWindowStateDelegate() { |
| 79 if (window_state_) { | 77 if (window_state_) { |
| 80 window_state_->RemoveObserver(this); | 78 window_state_->RemoveObserver(this); |
| 81 window_state_->window()->RemoveObserver(this); | 79 window_state_->window()->RemoveObserver(this); |
| 82 } | 80 } |
| 83 } | 81 } |
| 84 private: | 82 private: |
| 85 // Overridden from ash::wm::WindowStateDelegate: | 83 // Overridden from ash::wm::WindowStateDelegate: |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 } | 509 } |
| 512 | 510 |
| 513 //////////////////////////////////////////////////////////////////////////////// | 511 //////////////////////////////////////////////////////////////////////////////// |
| 514 // CustomFrameViewAsh, private: | 512 // CustomFrameViewAsh, private: |
| 515 | 513 |
| 516 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 514 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
| 517 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 515 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
| 518 } | 516 } |
| 519 | 517 |
| 520 } // namespace ash | 518 } // namespace ash |
| OLD | NEW |