| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm/window_resizer.h" | 9 #include "ash/common/wm/window_resizer.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // This is a struct for accelerator keys used to close ShellSurfaces. | 44 // This is a struct for accelerator keys used to close ShellSurfaces. |
| 45 const struct Accelerator { | 45 const struct Accelerator { |
| 46 ui::KeyboardCode keycode; | 46 ui::KeyboardCode keycode; |
| 47 int modifiers; | 47 int modifiers; |
| 48 } kCloseWindowAccelerators[] = { | 48 } kCloseWindowAccelerators[] = { |
| 49 {ui::VKEY_W, ui::EF_CONTROL_DOWN}, | 49 {ui::VKEY_W, ui::EF_CONTROL_DOWN}, |
| 50 {ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN}, | 50 {ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN}, |
| 51 {ui::VKEY_F4, ui::EF_ALT_DOWN}}; | 51 {ui::VKEY_F4, ui::EF_ALT_DOWN}}; |
| 52 | 52 |
| 53 void UpdateShelfStateForFullscreenChange(views::Widget* widget) { |
| 54 ash::wm::WindowState* window_state = |
| 55 ash::wm::GetWindowState(widget->GetNativeWindow()); |
| 56 window_state->set_shelf_mode_in_fullscreen( |
| 57 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE); |
| 58 ash::Shell::GetInstance()->UpdateShelfVisibility(); |
| 59 } |
| 60 |
| 53 class CustomFrameView : public views::NonClientFrameView { | 61 class CustomFrameView : public views::NonClientFrameView { |
| 54 public: | 62 public: |
| 55 explicit CustomFrameView(views::Widget* widget) : widget_(widget) {} | 63 explicit CustomFrameView(views::Widget* widget) : widget_(widget) {} |
| 56 ~CustomFrameView() override {} | 64 ~CustomFrameView() override {} |
| 57 | 65 |
| 58 // Overridden from views::NonClientFrameView: | 66 // Overridden from views::NonClientFrameView: |
| 59 gfx::Rect GetBoundsForClientView() const override { return bounds(); } | 67 gfx::Rect GetBoundsForClientView() const override { return bounds(); } |
| 60 gfx::Rect GetWindowBoundsForClientBounds( | 68 gfx::Rect GetWindowBoundsForClientBounds( |
| 61 const gfx::Rect& client_bounds) const override { | 69 const gfx::Rect& client_bounds) const override { |
| 62 return client_bounds; | 70 return client_bounds; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 ~CustomWindowStateDelegate() override { | 119 ~CustomWindowStateDelegate() override { |
| 112 if (widget_) | 120 if (widget_) |
| 113 widget_->RemoveObserver(this); | 121 widget_->RemoveObserver(this); |
| 114 } | 122 } |
| 115 | 123 |
| 116 // Overridden from ash::wm::WindowStateDelegate: | 124 // Overridden from ash::wm::WindowStateDelegate: |
| 117 bool ToggleFullscreen(ash::wm::WindowState* window_state) override { | 125 bool ToggleFullscreen(ash::wm::WindowState* window_state) override { |
| 118 if (widget_) { | 126 if (widget_) { |
| 119 bool enter_fullscreen = !window_state->IsFullscreen(); | 127 bool enter_fullscreen = !window_state->IsFullscreen(); |
| 120 widget_->SetFullscreen(enter_fullscreen); | 128 widget_->SetFullscreen(enter_fullscreen); |
| 129 UpdateShelfStateForFullscreenChange(widget_); |
| 121 } | 130 } |
| 122 return true; | 131 return true; |
| 123 } | 132 } |
| 124 | 133 |
| 125 // Overridden from views::WidgetObserver: | 134 // Overridden from views::WidgetObserver: |
| 126 void OnWidgetDestroying(views::Widget* widget) override { | 135 void OnWidgetDestroying(views::Widget* widget) override { |
| 127 widget_->RemoveObserver(this); | 136 widget_->RemoveObserver(this); |
| 128 widget_ = nullptr; | 137 widget_ = nullptr; |
| 129 } | 138 } |
| 130 | 139 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 void ShellSurface::SetFullscreen(bool fullscreen) { | 392 void ShellSurface::SetFullscreen(bool fullscreen) { |
| 384 TRACE_EVENT1("exo", "ShellSurface::SetFullscreen", "fullscreen", fullscreen); | 393 TRACE_EVENT1("exo", "ShellSurface::SetFullscreen", "fullscreen", fullscreen); |
| 385 | 394 |
| 386 if (!widget_) | 395 if (!widget_) |
| 387 CreateShellSurfaceWidget(ui::SHOW_STATE_FULLSCREEN); | 396 CreateShellSurfaceWidget(ui::SHOW_STATE_FULLSCREEN); |
| 388 | 397 |
| 389 // Note: This will ask client to configure its surface even if fullscreen | 398 // Note: This will ask client to configure its surface even if fullscreen |
| 390 // state doesn't change. | 399 // state doesn't change. |
| 391 ScopedConfigure scoped_configure(this, true); | 400 ScopedConfigure scoped_configure(this, true); |
| 392 widget_->SetFullscreen(fullscreen); | 401 widget_->SetFullscreen(fullscreen); |
| 402 UpdateShelfStateForFullscreenChange(widget_); |
| 393 } | 403 } |
| 394 | 404 |
| 395 void ShellSurface::SetPinned(bool pinned) { | 405 void ShellSurface::SetPinned(bool pinned) { |
| 396 TRACE_EVENT1("exo", "ShellSurface::SetPinned", "pinned", pinned); | 406 TRACE_EVENT1("exo", "ShellSurface::SetPinned", "pinned", pinned); |
| 397 | 407 |
| 398 if (!widget_) | 408 if (!widget_) |
| 399 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); | 409 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); |
| 400 | 410 |
| 401 // Note: This will ask client to configure its surface even if pinned | 411 // Note: This will ask client to configure its surface even if pinned |
| 402 // state doesn't change. | 412 // state doesn't change. |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 shadow_overlay_->layer()->Add(shadow->layer()); | 1252 shadow_overlay_->layer()->Add(shadow->layer()); |
| 1243 window->AddChild(shadow_overlay_); | 1253 window->AddChild(shadow_overlay_); |
| 1244 shadow_overlay_->Show(); | 1254 shadow_overlay_->Show(); |
| 1245 } | 1255 } |
| 1246 shadow_overlay_->SetBounds(shadow_bounds); | 1256 shadow_overlay_->SetBounds(shadow_bounds); |
| 1247 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1257 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
| 1248 } | 1258 } |
| 1249 } | 1259 } |
| 1250 | 1260 |
| 1251 } // namespace exo | 1261 } // namespace exo |
| OLD | NEW |