| 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/shelf/wm_shelf.h" |
| 8 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
| 9 #include "ash/common/wm/window_resizer.h" | 10 #include "ash/common/wm/window_resizer.h" |
| 10 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 11 #include "ash/common/wm/window_state_delegate.h" | 12 #include "ash/common/wm/window_state_delegate.h" |
| 12 #include "ash/shell.h" | 13 #include "ash/common/wm_shell.h" |
| 13 #include "ash/wm/window_state_aura.h" | 14 #include "ash/wm/window_state_aura.h" |
| 14 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/trace_event/trace_event.h" | 20 #include "base/trace_event/trace_event.h" |
| 20 #include "base/trace_event/trace_event_argument.h" | 21 #include "base/trace_event/trace_event_argument.h" |
| 21 #include "components/exo/surface.h" | 22 #include "components/exo/surface.h" |
| 22 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 46 ui::KeyboardCode keycode; | 47 ui::KeyboardCode keycode; |
| 47 int modifiers; | 48 int modifiers; |
| 48 } kCloseWindowAccelerators[] = { | 49 } kCloseWindowAccelerators[] = { |
| 49 {ui::VKEY_W, ui::EF_CONTROL_DOWN}, | 50 {ui::VKEY_W, ui::EF_CONTROL_DOWN}, |
| 50 {ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN}, | 51 {ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN}, |
| 51 {ui::VKEY_F4, ui::EF_ALT_DOWN}}; | 52 {ui::VKEY_F4, ui::EF_ALT_DOWN}}; |
| 52 | 53 |
| 53 void UpdateShelfStateForFullscreenChange(views::Widget* widget) { | 54 void UpdateShelfStateForFullscreenChange(views::Widget* widget) { |
| 54 ash::wm::WindowState* window_state = | 55 ash::wm::WindowState* window_state = |
| 55 ash::wm::GetWindowState(widget->GetNativeWindow()); | 56 ash::wm::GetWindowState(widget->GetNativeWindow()); |
| 56 window_state->set_shelf_mode_in_fullscreen( | 57 window_state->set_hide_shelf_when_fullscreen(false); |
| 57 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE); | 58 for (ash::WmWindow* root_window : ash::WmShell::Get()->GetAllRootWindows()) |
| 58 ash::Shell::GetInstance()->UpdateShelfVisibility(); | 59 ash::WmShelf::ForWindow(root_window)->UpdateVisibilityState(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 class CustomFrameView : public views::NonClientFrameView { | 62 class CustomFrameView : public views::NonClientFrameView { |
| 62 public: | 63 public: |
| 63 explicit CustomFrameView(views::Widget* widget) : widget_(widget) {} | 64 explicit CustomFrameView(views::Widget* widget) : widget_(widget) {} |
| 64 ~CustomFrameView() override {} | 65 ~CustomFrameView() override {} |
| 65 | 66 |
| 66 // Overridden from views::NonClientFrameView: | 67 // Overridden from views::NonClientFrameView: |
| 67 gfx::Rect GetBoundsForClientView() const override { return bounds(); } | 68 gfx::Rect GetBoundsForClientView() const override { return bounds(); } |
| 68 gfx::Rect GetWindowBoundsForClientBounds( | 69 gfx::Rect GetWindowBoundsForClientBounds( |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 void ShellSurface::SetFullscreen(bool fullscreen) { | 395 void ShellSurface::SetFullscreen(bool fullscreen) { |
| 395 TRACE_EVENT1("exo", "ShellSurface::SetFullscreen", "fullscreen", fullscreen); | 396 TRACE_EVENT1("exo", "ShellSurface::SetFullscreen", "fullscreen", fullscreen); |
| 396 | 397 |
| 397 if (!widget_) | 398 if (!widget_) |
| 398 CreateShellSurfaceWidget(ui::SHOW_STATE_FULLSCREEN); | 399 CreateShellSurfaceWidget(ui::SHOW_STATE_FULLSCREEN); |
| 399 | 400 |
| 400 // Note: This will ask client to configure its surface even if fullscreen | 401 // Note: This will ask client to configure its surface even if fullscreen |
| 401 // state doesn't change. | 402 // state doesn't change. |
| 402 ScopedConfigure scoped_configure(this, true); | 403 ScopedConfigure scoped_configure(this, true); |
| 403 widget_->SetFullscreen(fullscreen); | 404 widget_->SetFullscreen(fullscreen); |
| 404 UpdateShelfStateForFullscreenChange(widget_); | |
| 405 } | 405 } |
| 406 | 406 |
| 407 void ShellSurface::SetPinned(bool pinned, bool trusted) { | 407 void ShellSurface::SetPinned(bool pinned, bool trusted) { |
| 408 TRACE_EVENT2("exo", "ShellSurface::SetPinned", "pinned", pinned, "trusted", | 408 TRACE_EVENT2("exo", "ShellSurface::SetPinned", "pinned", pinned, "trusted", |
| 409 trusted); | 409 trusted); |
| 410 | 410 |
| 411 if (!widget_) | 411 if (!widget_) |
| 412 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); | 412 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); |
| 413 | 413 |
| 414 // Note: This will ask client to configure its surface even if pinned | 414 // Note: This will ask client to configure its surface even if pinned |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 shadow_overlay_->layer()->Add(shadow->layer()); | 1295 shadow_overlay_->layer()->Add(shadow->layer()); |
| 1296 window->AddChild(shadow_overlay_); | 1296 window->AddChild(shadow_overlay_); |
| 1297 shadow_overlay_->Show(); | 1297 shadow_overlay_->Show(); |
| 1298 } | 1298 } |
| 1299 shadow_overlay_->SetBounds(shadow_bounds); | 1299 shadow_overlay_->SetBounds(shadow_bounds); |
| 1300 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1300 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
| 1301 } | 1301 } |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 } // namespace exo | 1304 } // namespace exo |
| OLD | NEW |