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 25 matching lines...) Expand all Loading... |
36 static gfx::Font* title_font = NULL; | 36 static gfx::Font* title_font = NULL; |
37 if (!title_font) | 37 if (!title_font) |
38 title_font = new gfx::Font(views::NativeWidgetAura::GetWindowTitleFont()); | 38 title_font = new gfx::Font(views::NativeWidgetAura::GetWindowTitleFont()); |
39 return *title_font; | 39 return *title_font; |
40 } | 40 } |
41 | 41 |
42 /////////////////////////////////////////////////////////////////////////////// | 42 /////////////////////////////////////////////////////////////////////////////// |
43 // CustomFrameViewAshWindowStateDelegate | 43 // CustomFrameViewAshWindowStateDelegate |
44 | 44 |
45 // Handles a user's fullscreen request (Shift+F4/F4). Puts the window into | 45 // Handles a user's fullscreen request (Shift+F4/F4). Puts the window into |
46 // immersive fullscreen if the kAshEnableImmersiveFullscreenForAllWindows | 46 // immersive fullscreen if immersive fullscreen is enabled for non-browser |
47 // flag is set. | 47 // windows. |
48 class CustomFrameViewAshWindowStateDelegate | 48 class CustomFrameViewAshWindowStateDelegate |
49 : public ash::wm::WindowStateDelegate, | 49 : public ash::wm::WindowStateDelegate, |
50 public ash::wm::WindowStateObserver, | 50 public ash::wm::WindowStateObserver, |
51 public aura::WindowObserver { | 51 public aura::WindowObserver { |
52 public: | 52 public: |
53 CustomFrameViewAshWindowStateDelegate( | 53 CustomFrameViewAshWindowStateDelegate( |
54 ash::wm::WindowState* window_state, | 54 ash::wm::WindowState* window_state, |
55 ash::CustomFrameViewAsh* custom_frame_view) | 55 ash::CustomFrameViewAsh* custom_frame_view) |
56 : window_state_(NULL) { | 56 : window_state_(NULL) { |
57 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
58 // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for | 58 // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for |
59 // Windows Ash. | 59 // Windows Ash. |
60 if (CommandLine::ForCurrentProcess()->HasSwitch( | 60 if (ash::switches::UseImmersiveFullscreenForAllWindows()) { |
61 ash::switches::kAshEnableImmersiveFullscreenForAllWindows)) { | |
62 immersive_fullscreen_controller_.reset( | 61 immersive_fullscreen_controller_.reset( |
63 new ash::ImmersiveFullscreenController); | 62 new ash::ImmersiveFullscreenController); |
64 custom_frame_view->InitImmersiveFullscreenControllerForView( | 63 custom_frame_view->InitImmersiveFullscreenControllerForView( |
65 immersive_fullscreen_controller_.get()); | 64 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 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 485 } |
487 | 486 |
488 //////////////////////////////////////////////////////////////////////////////// | 487 //////////////////////////////////////////////////////////////////////////////// |
489 // CustomFrameViewAsh, private: | 488 // CustomFrameViewAsh, private: |
490 | 489 |
491 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 490 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
492 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 491 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
493 } | 492 } |
494 | 493 |
495 } // namespace ash | 494 } // namespace ash |
OLD | NEW |