Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Side by Side Diff: components/exo/shell_surface.cc

Issue 2778733004: Add WindowPinType property on arua::Window (Closed)
Patch Set: Address review issues. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
17 #include "ash/public/interfaces/window_pin_type.mojom.h"
16 #include "ash/wm/drag_window_resizer.h" 18 #include "ash/wm/drag_window_resizer.h"
17 #include "ash/wm/window_state_aura.h" 19 #include "ash/wm/window_state_aura.h"
18 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
19 #include "base/logging.h" 21 #include "base/logging.h"
20 #include "base/macros.h" 22 #include "base/macros.h"
21 #include "base/memory/ptr_util.h" 23 #include "base/memory/ptr_util.h"
22 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
23 #include "base/trace_event/trace_event.h" 25 #include "base/trace_event/trace_event.h"
24 #include "base/trace_event/trace_event_argument.h" 26 #include "base/trace_event/trace_event_argument.h"
25 #include "components/exo/surface.h" 27 #include "components/exo/surface.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 477
476 if (!widget_) 478 if (!widget_)
477 CreateShellSurfaceWidget(ui::SHOW_STATE_FULLSCREEN); 479 CreateShellSurfaceWidget(ui::SHOW_STATE_FULLSCREEN);
478 480
479 // Note: This will ask client to configure its surface even if fullscreen 481 // Note: This will ask client to configure its surface even if fullscreen
480 // state doesn't change. 482 // state doesn't change.
481 ScopedConfigure scoped_configure(this, true); 483 ScopedConfigure scoped_configure(this, true);
482 widget_->SetFullscreen(fullscreen); 484 widget_->SetFullscreen(fullscreen);
483 } 485 }
484 486
485 void ShellSurface::SetPinned(bool pinned, bool trusted) { 487 void ShellSurface::SetPinned(ash::mojom::WindowPinType type) {
486 TRACE_EVENT2("exo", "ShellSurface::SetPinned", "pinned", pinned, "trusted", 488 TRACE_EVENT1("exo", "ShellSurface::SetPinned", "type",
487 trusted); 489 static_cast<int>(type));
488 490
489 if (!widget_) 491 if (!widget_)
490 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL); 492 CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL);
491 493
492 // Note: This will ask client to configure its surface even if pinned 494 // Note: This will ask client to configure its surface even if pinned
493 // state doesn't change. 495 // state doesn't change.
494 ScopedConfigure scoped_configure(this, true); 496 ScopedConfigure scoped_configure(this, true);
495 if (pinned) { 497 widget_->GetNativeWindow()->SetProperty(ash::kWindowPinTypeKey, type);
496 ash::wm::PinWindow(widget_->GetNativeWindow(), trusted);
497 } else {
498 // 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
500 // state. In this implementation, we may loose the previous state,
501 // if the previous state is fullscreen, etc.
502 if (ash::wm::GetWindowState(widget_->GetNativeWindow())->IsPinned())
503 widget_->Restore();
504 }
505 } 498 }
506 499
507 void ShellSurface::SetSystemUiVisibility(bool autohide) { 500 void ShellSurface::SetSystemUiVisibility(bool autohide) {
508 TRACE_EVENT1("exo", "ShellSurface::SetSystemUiVisibility", "autohide", 501 TRACE_EVENT1("exo", "ShellSurface::SetSystemUiVisibility", "autohide",
509 autohide); 502 autohide);
510 ash::wm::SetAutoHideShelf(widget_->GetNativeWindow(), autohide); 503 ash::wm::SetAutoHideShelf(widget_->GetNativeWindow(), autohide);
511 } 504 }
512 505
513 void ShellSurface::SetTitle(const base::string16& title) { 506 void ShellSurface::SetTitle(const base::string16& title) {
514 TRACE_EVENT1("exo", "ShellSurface::SetTitle", "title", 507 TRACE_EVENT1("exo", "ShellSurface::SetTitle", "title",
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 gfx::Point ShellSurface::GetMouseLocation() const { 1698 gfx::Point ShellSurface::GetMouseLocation() const {
1706 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); 1699 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow();
1707 gfx::Point location = 1700 gfx::Point location =
1708 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); 1701 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot();
1709 aura::Window::ConvertPointToTarget( 1702 aura::Window::ConvertPointToTarget(
1710 root_window, widget_->GetNativeWindow()->parent(), &location); 1703 root_window, widget_->GetNativeWindow()->parent(), &location);
1711 return location; 1704 return location;
1712 } 1705 }
1713 1706
1714 } // namespace exo 1707 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/shell_surface.h ('k') | components/exo/shell_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698