Chromium Code Reviews| 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_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
| 15 #include "ash/public/cpp/shell_window_ids.h" | 15 #include "ash/public/cpp/shell_window_ids.h" |
| 16 #include "ash/public/cpp/window_properties.h" | |
| 16 #include "ash/wm/drag_window_resizer.h" | 17 #include "ash/wm/drag_window_resizer.h" |
| 17 #include "ash/wm/window_state_aura.h" | 18 #include "ash/wm/window_state_aura.h" |
| 18 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
| 19 #include "base/logging.h" | 20 #include "base/logging.h" |
| 20 #include "base/macros.h" | 21 #include "base/macros.h" |
| 21 #include "base/memory/ptr_util.h" | 22 #include "base/memory/ptr_util.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
| 24 #include "base/trace_event/trace_event_argument.h" | 25 #include "base/trace_event/trace_event_argument.h" |
| 25 #include "components/exo/surface.h" | 26 #include "components/exo/surface.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 void ShellSurface::SetPinned(bool pinned, bool trusted) { | 486 void ShellSurface::SetPinned(bool pinned, bool trusted) { |
| 486 TRACE_EVENT2("exo", "ShellSurface::SetPinned", "pinned", pinned, "trusted", | 487 TRACE_EVENT2("exo", "ShellSurface::SetPinned", "pinned", pinned, "trusted", |
| 487 trusted); | 488 trusted); |
| 488 | 489 |
| 489 if (!widget_) | 490 if (!widget_) |
| 490 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); | 491 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); |
| 491 | 492 |
| 492 // Note: This will ask client to configure its surface even if pinned | 493 // Note: This will ask client to configure its surface even if pinned |
| 493 // state doesn't change. | 494 // state doesn't change. |
| 494 ScopedConfigure scoped_configure(this, true); | 495 ScopedConfigure scoped_configure(this, true); |
| 495 if (pinned) { | 496 if (pinned) { |
|
sky
2017/04/03 16:38:56
Maybe move the determining of type to a function s
Peng
2017/04/03 18:03:48
Done.
| |
| 496 ash::wm::PinWindow(widget_->GetNativeWindow(), trusted); | 497 ash::WindowPinType pin_type = trusted ? ash::WindowPinType::TRUSTED_PINNED |
| 498 : ash::WindowPinType::PINNED; | |
| 499 widget_->GetNativeWindow()->SetProperty(ash::kWindowPinTypeKey, pin_type); | |
| 497 } else { | 500 } else { |
| 498 // At the moment, we cannot just unpin the window state, due to ash | 501 // At the moment, we cannot just unpin the window state, due to ash |
| 499 // implementation. Instead, we call Restore() to unpin, if it is Pinned | 502 // implementation. Instead, we call Restore() to unpin, if it is Pinned |
| 500 // state. In this implementation, we may loose the previous state, | 503 // state. In this implementation, we may loose the previous state, |
| 501 // if the previous state is fullscreen, etc. | 504 // if the previous state is fullscreen, etc. |
| 502 if (ash::wm::GetWindowState(widget_->GetNativeWindow())->IsPinned()) | 505 widget_->GetNativeWindow()->SetProperty(ash::kWindowPinTypeKey, |
| 503 widget_->Restore(); | 506 ash::WindowPinType::NONE); |
| 504 } | 507 } |
| 505 } | 508 } |
| 506 | 509 |
| 507 void ShellSurface::SetSystemUiVisibility(bool autohide) { | 510 void ShellSurface::SetSystemUiVisibility(bool autohide) { |
| 508 TRACE_EVENT1("exo", "ShellSurface::SetSystemUiVisibility", "autohide", | 511 TRACE_EVENT1("exo", "ShellSurface::SetSystemUiVisibility", "autohide", |
| 509 autohide); | 512 autohide); |
| 510 ash::wm::SetAutoHideShelf(widget_->GetNativeWindow(), autohide); | 513 ash::wm::SetAutoHideShelf(widget_->GetNativeWindow(), autohide); |
| 511 } | 514 } |
| 512 | 515 |
| 513 void ShellSurface::SetTitle(const base::string16& title) { | 516 void ShellSurface::SetTitle(const base::string16& title) { |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1705 gfx::Point ShellSurface::GetMouseLocation() const { | 1708 gfx::Point ShellSurface::GetMouseLocation() const { |
| 1706 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); | 1709 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); |
| 1707 gfx::Point location = | 1710 gfx::Point location = |
| 1708 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 1711 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
| 1709 aura::Window::ConvertPointToTarget( | 1712 aura::Window::ConvertPointToTarget( |
| 1710 root_window, widget_->GetNativeWindow()->parent(), &location); | 1713 root_window, widget_->GetNativeWindow()->parent(), &location); |
| 1711 return location; | 1714 return location; |
| 1712 } | 1715 } |
| 1713 | 1716 |
| 1714 } // namespace exo | 1717 } // namespace exo |
| OLD | NEW |