| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/frame/custom_frame_view_ash.h" | 9 #include "ash/common/frame/custom_frame_view_ash.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/wm/window_resizer.h" | 11 #include "ash/common/wm/window_resizer.h" |
| 12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/common/wm/window_state_delegate.h" | 13 #include "ash/common/wm/window_state_delegate.h" |
| 14 #include "ash/common/wm_shell.h" | |
| 15 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
| 16 #include "ash/public/cpp/shell_window_ids.h" | 15 #include "ash/public/cpp/shell_window_ids.h" |
| 17 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
| 18 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
| 19 #include "base/logging.h" | 18 #include "base/logging.h" |
| 20 #include "base/macros.h" | 19 #include "base/macros.h" |
| 21 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
| 24 #include "base/trace_event/trace_event_argument.h" | 23 #include "base/trace_event/trace_event_argument.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 50 | 49 |
| 51 // This is a struct for accelerator keys used to close ShellSurfaces. | 50 // This is a struct for accelerator keys used to close ShellSurfaces. |
| 52 const struct Accelerator { | 51 const struct Accelerator { |
| 53 ui::KeyboardCode keycode; | 52 ui::KeyboardCode keycode; |
| 54 int modifiers; | 53 int modifiers; |
| 55 } kCloseWindowAccelerators[] = { | 54 } kCloseWindowAccelerators[] = { |
| 56 {ui::VKEY_W, ui::EF_CONTROL_DOWN}, | 55 {ui::VKEY_W, ui::EF_CONTROL_DOWN}, |
| 57 {ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN}, | 56 {ui::VKEY_W, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN}, |
| 58 {ui::VKEY_F4, ui::EF_ALT_DOWN}}; | 57 {ui::VKEY_F4, ui::EF_ALT_DOWN}}; |
| 59 | 58 |
| 60 void UpdateShelfStateForFullscreenChange(views::Widget* widget) { | |
| 61 for (ash::WmWindow* root_window : ash::WmShell::Get()->GetAllRootWindows()) | |
| 62 ash::WmShelf::ForWindow(root_window)->UpdateVisibilityState(); | |
| 63 } | |
| 64 | |
| 65 class CustomFrameView : public views::NonClientFrameView { | 59 class CustomFrameView : public views::NonClientFrameView { |
| 66 public: | 60 public: |
| 67 explicit CustomFrameView(views::Widget* widget) : widget_(widget) {} | 61 explicit CustomFrameView(views::Widget* widget) : widget_(widget) {} |
| 68 ~CustomFrameView() override {} | 62 ~CustomFrameView() override {} |
| 69 | 63 |
| 70 // Overridden from views::NonClientFrameView: | 64 // Overridden from views::NonClientFrameView: |
| 71 gfx::Rect GetBoundsForClientView() const override { return bounds(); } | 65 gfx::Rect GetBoundsForClientView() const override { return bounds(); } |
| 72 gfx::Rect GetWindowBoundsForClientBounds( | 66 gfx::Rect GetWindowBoundsForClientBounds( |
| 73 const gfx::Rect& client_bounds) const override { | 67 const gfx::Rect& client_bounds) const override { |
| 74 return client_bounds; | 68 return client_bounds; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 158 } |
| 165 | 159 |
| 166 // Overridden from ash::wm::WindowStateDelegate: | 160 // Overridden from ash::wm::WindowStateDelegate: |
| 167 bool ToggleFullscreen(ash::wm::WindowState* window_state) override { | 161 bool ToggleFullscreen(ash::wm::WindowState* window_state) override { |
| 168 if (widget_) { | 162 if (widget_) { |
| 169 bool enter_fullscreen = !window_state->IsFullscreen(); | 163 bool enter_fullscreen = !window_state->IsFullscreen(); |
| 170 widget_->SetFullscreen(enter_fullscreen); | 164 widget_->SetFullscreen(enter_fullscreen); |
| 171 ash::wm::WindowState* window_state = | 165 ash::wm::WindowState* window_state = |
| 172 ash::wm::GetWindowState(widget_->GetNativeWindow()); | 166 ash::wm::GetWindowState(widget_->GetNativeWindow()); |
| 173 window_state->set_in_immersive_fullscreen(enter_fullscreen); | 167 window_state->set_in_immersive_fullscreen(enter_fullscreen); |
| 174 UpdateShelfStateForFullscreenChange(widget_); | |
| 175 } | 168 } |
| 176 return true; | 169 return true; |
| 177 } | 170 } |
| 178 | 171 |
| 179 // Overridden from views::WidgetObserver: | 172 // Overridden from views::WidgetObserver: |
| 180 void OnWidgetDestroying(views::Widget* widget) override { | 173 void OnWidgetDestroying(views::Widget* widget) override { |
| 181 widget_->RemoveObserver(this); | 174 widget_->RemoveObserver(this); |
| 182 widget_ = nullptr; | 175 widget_ = nullptr; |
| 183 } | 176 } |
| 184 | 177 |
| (...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 // small style shadow for them. | 1510 // small style shadow for them. |
| 1518 if (!activatable_) | 1511 if (!activatable_) |
| 1519 shadow->SetElevation(wm::ShadowElevation::SMALL); | 1512 shadow->SetElevation(wm::ShadowElevation::SMALL); |
| 1520 // We don't have rounded corners unless frame is enabled. | 1513 // We don't have rounded corners unless frame is enabled. |
| 1521 if (!frame_enabled_) | 1514 if (!frame_enabled_) |
| 1522 shadow->SetRoundedCornerRadius(0); | 1515 shadow->SetRoundedCornerRadius(0); |
| 1523 } | 1516 } |
| 1524 } | 1517 } |
| 1525 | 1518 |
| 1526 } // namespace exo | 1519 } // namespace exo |
| OLD | NEW |