| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // windows. | 48 // windows. |
| 49 class CustomFrameViewAshWindowStateDelegate | 49 class CustomFrameViewAshWindowStateDelegate |
| 50 : public ash::wm::WindowStateDelegate, | 50 : public ash::wm::WindowStateDelegate, |
| 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) | |
| 59 // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for | |
| 60 // Windows Ash. | |
| 61 if (ash::switches::UseImmersiveFullscreenForAllWindows()) { | 58 if (ash::switches::UseImmersiveFullscreenForAllWindows()) { |
| 62 immersive_fullscreen_controller_.reset( | 59 immersive_fullscreen_controller_.reset( |
| 63 new ash::ImmersiveFullscreenController); | 60 new ash::ImmersiveFullscreenController); |
| 64 custom_frame_view->InitImmersiveFullscreenControllerForView( | 61 custom_frame_view->InitImmersiveFullscreenControllerForView( |
| 65 immersive_fullscreen_controller_.get()); | 62 immersive_fullscreen_controller_.get()); |
| 66 | 63 |
| 67 // Add a window state observer to exit fullscreen properly in case | 64 // Add a window state observer to exit fullscreen properly in case |
| 68 // fullscreen is exited without going through | 65 // fullscreen is exited without going through |
| 69 // WindowState::ToggleFullscreen(). This is the case when exiting | 66 // WindowState::ToggleFullscreen(). This is the case when exiting |
| 70 // immersive fullscreen via the "Restore" window control. | 67 // immersive fullscreen via the "Restore" window control. |
| 71 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 | 68 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 |
| 72 window_state_ = window_state; | 69 window_state_ = window_state; |
| 73 window_state_->AddObserver(this); | 70 window_state_->AddObserver(this); |
| 74 window_state_->window()->AddObserver(this); | 71 window_state_->window()->AddObserver(this); |
| 75 } | 72 } |
| 76 #endif | |
| 77 } | 73 } |
| 78 virtual ~CustomFrameViewAshWindowStateDelegate() { | 74 virtual ~CustomFrameViewAshWindowStateDelegate() { |
| 79 if (window_state_) { | 75 if (window_state_) { |
| 80 window_state_->RemoveObserver(this); | 76 window_state_->RemoveObserver(this); |
| 81 window_state_->window()->RemoveObserver(this); | 77 window_state_->window()->RemoveObserver(this); |
| 82 } | 78 } |
| 83 } | 79 } |
| 84 private: | 80 private: |
| 85 // Overridden from ash::wm::WindowStateDelegate: | 81 // Overridden from ash::wm::WindowStateDelegate: |
| 86 virtual bool ToggleFullscreen(ash::wm::WindowState* window_state) OVERRIDE { | 82 virtual bool ToggleFullscreen(ash::wm::WindowState* window_state) OVERRIDE { |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 } | 507 } |
| 512 | 508 |
| 513 //////////////////////////////////////////////////////////////////////////////// | 509 //////////////////////////////////////////////////////////////////////////////// |
| 514 // CustomFrameViewAsh, private: | 510 // CustomFrameViewAsh, private: |
| 515 | 511 |
| 516 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 512 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
| 517 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 513 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
| 518 } | 514 } |
| 519 | 515 |
| 520 } // namespace ash | 516 } // namespace ash |
| OLD | NEW |