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

Side by Side Diff: ui/views/mus/desktop_window_tree_host_mus.cc

Issue 2674683002: Revert: Change CaptureSynchronizer and PointerWatcherEventRouter to support multiple CaptureClients (Closed)
Patch Set: Created 3 years, 10 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 | « ui/aura/test/aura_test_helper.cc ('k') | ui/views/mus/desktop_window_tree_host_mus_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mus/desktop_window_tree_host_mus.h" 5 #include "ui/views/mus/desktop_window_tree_host_mus.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "ui/aura/client/aura_constants.h" 11 #include "ui/aura/client/aura_constants.h"
12 #include "ui/aura/client/capture_client.h"
13 #include "ui/aura/client/cursor_client.h" 12 #include "ui/aura/client/cursor_client.h"
14 #include "ui/aura/client/drag_drop_client.h" 13 #include "ui/aura/client/drag_drop_client.h"
15 #include "ui/aura/client/focus_client.h" 14 #include "ui/aura/client/focus_client.h"
16 #include "ui/aura/client/transient_window_client.h" 15 #include "ui/aura/client/transient_window_client.h"
17 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
18 #include "ui/aura/mus/window_port_mus.h" 17 #include "ui/aura/mus/window_port_mus.h"
19 #include "ui/aura/mus/window_tree_host_mus.h" 18 #include "ui/aura/mus/window_tree_host_mus.h"
20 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
21 #include "ui/base/hit_test.h" 20 #include "ui/base/hit_test.h"
22 #include "ui/display/screen.h" 21 #include "ui/display/screen.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // Widget can notify everyone listening for that signal. 313 // Widget can notify everyone listening for that signal.
315 native_widget_delegate_->OnNativeWidgetActivationChanged(active); 314 native_widget_delegate_->OnNativeWidgetActivationChanged(active);
316 } 315 }
317 316
318 void DesktopWindowTreeHostMus::OnWidgetInitDone() { 317 void DesktopWindowTreeHostMus::OnWidgetInitDone() {
319 // Because of construction order it's possible the bounds have changed before 318 // Because of construction order it's possible the bounds have changed before
320 // the NonClientView was created, which means we may not have sent the 319 // the NonClientView was created, which means we may not have sent the
321 // client-area and hit-test-mask. 320 // client-area and hit-test-mask.
322 SendClientAreaToServer(); 321 SendClientAreaToServer();
323 SendHitTestMaskToServer(); 322 SendHitTestMaskToServer();
324
325 MusClient::Get()->OnCaptureClientSet(
326 aura::client::GetCaptureClient(window()));
327 } 323 }
328 324
329 std::unique_ptr<corewm::Tooltip> DesktopWindowTreeHostMus::CreateTooltip() { 325 std::unique_ptr<corewm::Tooltip> DesktopWindowTreeHostMus::CreateTooltip() {
330 return base::MakeUnique<corewm::TooltipAura>(); 326 return base::MakeUnique<corewm::TooltipAura>();
331 } 327 }
332 328
333 std::unique_ptr<aura::client::DragDropClient> 329 std::unique_ptr<aura::client::DragDropClient>
334 DesktopWindowTreeHostMus::CreateDragDropClient( 330 DesktopWindowTreeHostMus::CreateDragDropClient(
335 DesktopNativeCursorManager* cursor_manager) { 331 DesktopNativeCursorManager* cursor_manager) {
336 // aura-mus handles installing a DragDropClient. 332 // aura-mus handles installing a DragDropClient.
337 return nullptr; 333 return nullptr;
338 } 334 }
339 335
340 void DesktopWindowTreeHostMus::Close() { 336 void DesktopWindowTreeHostMus::Close() {
341 if (close_widget_factory_.HasWeakPtrs()) 337 if (close_widget_factory_.HasWeakPtrs())
342 return; 338 return;
343 339
344 // Even though we don't close immediately, we need to hide immediately 340 // Even though we don't close immediately, we need to hide immediately
345 // (otherwise events may be processed, which is unexpected). 341 // (otherwise events may be processed, which is unexpected).
346 Hide(); 342 Hide();
347 343
348 // Close doesn't delete this immediately, as 'this' may still be on the stack 344 // Close doesn't delete this immediately, as 'this' may still be on the stack
349 // resulting in possible crashes when the stack unwindes. 345 // resulting in possible crashes when the stack unwindes.
350 base::ThreadTaskRunnerHandle::Get()->PostTask( 346 base::ThreadTaskRunnerHandle::Get()->PostTask(
351 FROM_HERE, base::Bind(&DesktopWindowTreeHostMus::CloseNow, 347 FROM_HERE, base::Bind(&DesktopWindowTreeHostMus::CloseNow,
352 close_widget_factory_.GetWeakPtr())); 348 close_widget_factory_.GetWeakPtr()));
353 } 349 }
354 350
355 void DesktopWindowTreeHostMus::CloseNow() { 351 void DesktopWindowTreeHostMus::CloseNow() {
356 MusClient::Get()->OnCaptureClientUnset(
357 aura::client::GetCaptureClient(window()));
358
359 native_widget_delegate_->OnNativeWidgetDestroying(); 352 native_widget_delegate_->OnNativeWidgetDestroying();
360 353
361 // If we have children, close them. Use a copy for iteration because they'll 354 // If we have children, close them. Use a copy for iteration because they'll
362 // remove themselves from |children_|. 355 // remove themselves from |children_|.
363 std::set<DesktopWindowTreeHostMus*> children_copy = children_; 356 std::set<DesktopWindowTreeHostMus*> children_copy = children_;
364 for (DesktopWindowTreeHostMus* child : children_copy) 357 for (DesktopWindowTreeHostMus* child : children_copy)
365 child->CloseNow(); 358 child->CloseNow();
366 DCHECK(children_.empty()); 359 DCHECK(children_.empty());
367 360
368 if (parent_) { 361 if (parent_) {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 aura::client::FocusClient* focus_client, 786 aura::client::FocusClient* focus_client,
794 aura::Window* window) { 787 aura::Window* window) {
795 if (window == this->window()) { 788 if (window == this->window()) {
796 desktop_native_widget_aura_->HandleActivationChanged(true); 789 desktop_native_widget_aura_->HandleActivationChanged(true);
797 } else if (is_active_) { 790 } else if (is_active_) {
798 desktop_native_widget_aura_->HandleActivationChanged(false); 791 desktop_native_widget_aura_->HandleActivationChanged(false);
799 } 792 }
800 } 793 }
801 794
802 } // namespace views 795 } // namespace views
OLDNEW
« no previous file with comments | « ui/aura/test/aura_test_helper.cc ('k') | ui/views/mus/desktop_window_tree_host_mus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698