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

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

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