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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 2534823003: Adds NativeWidgetAura::is_parallel_widget_in_window_manager (Closed)
Patch Set: order Created 4 years 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 | « ui/views/widget/native_widget_aura.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "services/ui/public/interfaces/window_manager.mojom.h"
14 #include "third_party/skia/include/core/SkRegion.h" 15 #include "third_party/skia/include/core/SkRegion.h"
15 #include "ui/aura/client/aura_constants.h" 16 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
17 #include "ui/aura/client/cursor_client.h" 18 #include "ui/aura/client/cursor_client.h"
18 #include "ui/aura/client/drag_drop_client.h" 19 #include "ui/aura/client/drag_drop_client.h"
19 #include "ui/aura/client/focus_client.h" 20 #include "ui/aura/client/focus_client.h"
20 #include "ui/aura/client/screen_position_client.h" 21 #include "ui/aura/client/screen_position_client.h"
21 #include "ui/aura/client/window_parenting_client.h" 22 #include "ui/aura/client/window_parenting_client.h"
22 #include "ui/aura/env.h" 23 #include "ui/aura/env.h"
23 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 window->ClearProperty(key); 82 window->ClearProperty(key);
82 else 83 else
83 window->SetProperty(key, new gfx::ImageSkia(value)); 84 window->SetProperty(key, new gfx::ImageSkia(value));
84 } 85 }
85 86
86 } // namespace 87 } // namespace
87 88
88 //////////////////////////////////////////////////////////////////////////////// 89 ////////////////////////////////////////////////////////////////////////////////
89 // NativeWidgetAura, public: 90 // NativeWidgetAura, public:
90 91
91 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) 92 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate,
93 bool is_parallel_widget_in_window_manager)
92 : delegate_(delegate), 94 : delegate_(delegate),
95 is_parallel_widget_in_window_manager_(
96 is_parallel_widget_in_window_manager),
93 window_(new aura::Window(this)), 97 window_(new aura::Window(this)),
94 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 98 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
95 destroying_(false), 99 destroying_(false),
96 cursor_(gfx::kNullCursor), 100 cursor_(gfx::kNullCursor),
97 saved_window_state_(ui::SHOW_STATE_DEFAULT), 101 saved_window_state_(ui::SHOW_STATE_DEFAULT),
98 close_widget_factory_(this) { 102 close_widget_factory_(this) {
99 aura::client::SetFocusChangeObserver(window_, this); 103 aura::client::SetFocusChangeObserver(window_, this);
100 aura::client::SetActivationChangeObserver(window_, this); 104 aura::client::SetActivationChangeObserver(window_, this);
101 } 105 }
102 106
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 307 }
304 308
305 ui::InputMethod* NativeWidgetAura::GetInputMethod() { 309 ui::InputMethod* NativeWidgetAura::GetInputMethod() {
306 if (!window_) 310 if (!window_)
307 return nullptr; 311 return nullptr;
308 aura::Window* root_window = window_->GetRootWindow(); 312 aura::Window* root_window = window_->GetRootWindow();
309 return root_window ? root_window->GetHost()->GetInputMethod() : nullptr; 313 return root_window ? root_window->GetHost()->GetInputMethod() : nullptr;
310 } 314 }
311 315
312 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { 316 void NativeWidgetAura::CenterWindow(const gfx::Size& size) {
313 if (!window_) 317 if (!window_ || is_parallel_widget_in_window_manager_)
314 return; 318 return;
315 319
316 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow()); 320 gfx::Rect parent_bounds(window_->parent()->GetBoundsInRootWindow());
317 // When centering window, we take the intersection of the host and 321 // When centering window, we take the intersection of the host and
318 // the parent. We assume the root window represents the visible 322 // the parent. We assume the root window represents the visible
319 // rect of a single screen. 323 // rect of a single screen.
320 gfx::Rect work_area = display::Screen::GetScreen() 324 gfx::Rect work_area = display::Screen::GetScreen()
321 ->GetDisplayNearestWindow(window_) 325 ->GetDisplayNearestWindow(window_)
322 .work_area(); 326 .work_area();
323 327
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 void NativeWidgetAura::GetWindowPlacement( 367 void NativeWidgetAura::GetWindowPlacement(
364 gfx::Rect* bounds, 368 gfx::Rect* bounds,
365 ui::WindowShowState* show_state) const { 369 ui::WindowShowState* show_state) const {
366 // The interface specifies returning restored bounds, not current bounds. 370 // The interface specifies returning restored bounds, not current bounds.
367 *bounds = GetRestoredBounds(); 371 *bounds = GetRestoredBounds();
368 *show_state = window_ ? window_->GetProperty(aura::client::kShowStateKey) : 372 *show_state = window_ ? window_->GetProperty(aura::client::kShowStateKey) :
369 ui::SHOW_STATE_DEFAULT; 373 ui::SHOW_STATE_DEFAULT;
370 } 374 }
371 375
372 bool NativeWidgetAura::SetWindowTitle(const base::string16& title) { 376 bool NativeWidgetAura::SetWindowTitle(const base::string16& title) {
373 if (!window_) 377 if (!window_ || is_parallel_widget_in_window_manager_)
374 return false; 378 return false;
375 if (window_->GetTitle() == title) 379 if (window_->GetTitle() == title)
376 return false; 380 return false;
377 window_->SetTitle(title); 381 window_->SetTitle(title);
378 return true; 382 return true;
379 } 383 }
380 384
381 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon, 385 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon,
382 const gfx::ImageSkia& app_icon) { 386 const gfx::ImageSkia& app_icon) {
383 AssignIconToAuraWindow(window_, window_icon, app_icon); 387 if (!is_parallel_widget_in_window_manager_)
388 AssignIconToAuraWindow(window_, window_icon, app_icon);
384 } 389 }
385 390
386 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) { 391 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) {
387 if (modal_type != ui::MODAL_TYPE_NONE) 392 if (modal_type != ui::MODAL_TYPE_NONE)
388 window_->SetProperty(aura::client::kModalKey, modal_type); 393 window_->SetProperty(aura::client::kModalKey, modal_type);
389 } 394 }
390 395
391 gfx::Rect NativeWidgetAura::GetWindowBoundsInScreen() const { 396 gfx::Rect NativeWidgetAura::GetWindowBoundsInScreen() const {
392 return window_ ? window_->GetBoundsInScreen() : gfx::Rect(); 397 return window_ ? window_->GetBoundsInScreen() : gfx::Rect();
393 } 398 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 return; 565 return;
561 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow( 566 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow(
562 window_); 567 window_);
563 } 568 }
564 569
565 bool NativeWidgetAura::IsActive() const { 570 bool NativeWidgetAura::IsActive() const {
566 return window_ && wm::IsActiveWindow(window_); 571 return window_ && wm::IsActiveWindow(window_);
567 } 572 }
568 573
569 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { 574 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) {
570 if (window_) 575 if (window_ && !is_parallel_widget_in_window_manager_)
571 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top); 576 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top);
572 } 577 }
573 578
574 bool NativeWidgetAura::IsAlwaysOnTop() const { 579 bool NativeWidgetAura::IsAlwaysOnTop() const {
575 return window_ && window_->GetProperty(aura::client::kAlwaysOnTopKey); 580 return window_ && window_->GetProperty(aura::client::kAlwaysOnTopKey);
576 } 581 }
577 582
578 void NativeWidgetAura::SetVisibleOnAllWorkspaces(bool always_visible) { 583 void NativeWidgetAura::SetVisibleOnAllWorkspaces(bool always_visible) {
579 // Not implemented on chromeos or for child widgets. 584 // Not implemented on chromeos or for child widgets.
580 } 585 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 #else 756 #else
752 return ui::NativeThemeAura::instance(); 757 return ui::NativeThemeAura::instance();
753 #endif 758 #endif
754 } 759 }
755 760
756 bool NativeWidgetAura::IsTranslucentWindowOpacitySupported() const { 761 bool NativeWidgetAura::IsTranslucentWindowOpacitySupported() const {
757 return true; 762 return true;
758 } 763 }
759 764
760 void NativeWidgetAura::OnSizeConstraintsChanged() { 765 void NativeWidgetAura::OnSizeConstraintsChanged() {
766 if (is_parallel_widget_in_window_manager_)
767 return;
768
761 window_->SetProperty(aura::client::kCanMaximizeKey, 769 window_->SetProperty(aura::client::kCanMaximizeKey,
762 GetWidget()->widget_delegate()->CanMaximize()); 770 GetWidget()->widget_delegate()->CanMaximize());
763 window_->SetProperty(aura::client::kCanMinimizeKey, 771 window_->SetProperty(aura::client::kCanMinimizeKey,
764 GetWidget()->widget_delegate()->CanMinimize()); 772 GetWidget()->widget_delegate()->CanMinimize());
765 window_->SetProperty(aura::client::kCanResizeKey, 773 window_->SetProperty(aura::client::kCanResizeKey,
766 GetWidget()->widget_delegate()->CanResize()); 774 GetWidget()->widget_delegate()->CanResize());
767 } 775 }
768 776
769 void NativeWidgetAura::RepostNativeEvent(gfx::NativeEvent native_event) { 777 void NativeWidgetAura::RepostNativeEvent(gfx::NativeEvent native_event) {
770 OnEvent(native_event); 778 OnEvent(native_event);
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 gfx::NativeView native_view) { 1221 gfx::NativeView native_view) {
1214 aura::client::CaptureClient* capture_client = 1222 aura::client::CaptureClient* capture_client =
1215 aura::client::GetCaptureClient(native_view->GetRootWindow()); 1223 aura::client::GetCaptureClient(native_view->GetRootWindow());
1216 if (!capture_client) 1224 if (!capture_client)
1217 return nullptr; 1225 return nullptr;
1218 return capture_client->GetGlobalCaptureWindow(); 1226 return capture_client->GetGlobalCaptureWindow();
1219 } 1227 }
1220 1228
1221 } // namespace internal 1229 } // namespace internal
1222 } // namespace views 1230 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698