| 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" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 TRACE_EVENT2("exo", "ShellSurface::SetPinned", "pinned", pinned, "trusted", | 486 TRACE_EVENT2("exo", "ShellSurface::SetPinned", "pinned", pinned, "trusted", |
| 487 trusted); | 487 trusted); |
| 488 | 488 |
| 489 if (!widget_) | 489 if (!widget_) |
| 490 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); | 490 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); |
| 491 | 491 |
| 492 // Note: This will ask client to configure its surface even if pinned | 492 // Note: This will ask client to configure its surface even if pinned |
| 493 // state doesn't change. | 493 // state doesn't change. |
| 494 ScopedConfigure scoped_configure(this, true); | 494 ScopedConfigure scoped_configure(this, true); |
| 495 if (pinned) { | 495 if (pinned) { |
| 496 ash::wm::PinWindow(widget_->GetNativeWindow(), trusted); | 496 aura::client::WindowPinType pin_type = |
| 497 trusted ? aura::client::WindowPinType::TRUSTED_PINNED |
| 498 : aura::client::WindowPinType::PINNED; |
| 499 widget_->GetNativeWindow()->SetProperty(aura::client::kWindowPinTypeKey, |
| 500 pin_type); |
| 497 } else { | 501 } else { |
| 498 // At the moment, we cannot just unpin the window state, due to ash | 502 // 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 | 503 // implementation. Instead, we call Restore() to unpin, if it is Pinned |
| 500 // state. In this implementation, we may loose the previous state, | 504 // state. In this implementation, we may loose the previous state, |
| 501 // if the previous state is fullscreen, etc. | 505 // if the previous state is fullscreen, etc. |
| 502 if (ash::wm::GetWindowState(widget_->GetNativeWindow())->IsPinned()) | 506 widget_->GetNativeWindow()->SetProperty(aura::client::kWindowPinTypeKey, |
| 503 widget_->Restore(); | 507 aura::client::WindowPinType::NONE); |
| 504 } | 508 } |
| 505 } | 509 } |
| 506 | 510 |
| 507 void ShellSurface::SetSystemUiVisibility(bool autohide) { | 511 void ShellSurface::SetSystemUiVisibility(bool autohide) { |
| 508 TRACE_EVENT1("exo", "ShellSurface::SetSystemUiVisibility", "autohide", | 512 TRACE_EVENT1("exo", "ShellSurface::SetSystemUiVisibility", "autohide", |
| 509 autohide); | 513 autohide); |
| 510 // TODO: Implemented in next CL. crbug.com/705723 | 514 // TODO: Implemented in next CL. crbug.com/705723 |
| 511 NOTIMPLEMENTED(); | 515 NOTIMPLEMENTED(); |
| 512 } | 516 } |
| 513 | 517 |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 gfx::Point ShellSurface::GetMouseLocation() const { | 1709 gfx::Point ShellSurface::GetMouseLocation() const { |
| 1706 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); | 1710 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); |
| 1707 gfx::Point location = | 1711 gfx::Point location = |
| 1708 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 1712 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
| 1709 aura::Window::ConvertPointToTarget( | 1713 aura::Window::ConvertPointToTarget( |
| 1710 root_window, widget_->GetNativeWindow()->parent(), &location); | 1714 root_window, widget_->GetNativeWindow()->parent(), &location); |
| 1711 return location; | 1715 return location; |
| 1712 } | 1716 } |
| 1713 | 1717 |
| 1714 } // namespace exo | 1718 } // namespace exo |
| OLD | NEW |