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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_dispatcher_client.cc

Issue 280483003: wm: Change the DispatcherClient interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix-tests Created 6 years, 7 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 | Annotate | Revision Log
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/desktop_aura/desktop_dispatcher_client.h" 5 #include "ui/views/widget/desktop_aura/desktop_dispatcher_client.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 9
10 namespace views { 10 namespace views {
11 11
12 DesktopDispatcherClient::DesktopDispatcherClient() 12 DesktopDispatcherClient::DesktopDispatcherClient() {
13 : weak_ptr_factory_(this) {} 13 }
14 14
15 DesktopDispatcherClient::~DesktopDispatcherClient() { 15 DesktopDispatcherClient::~DesktopDispatcherClient() {
16 } 16 }
17 17
18 void DesktopDispatcherClient::RunWithDispatcher( 18 void DesktopDispatcherClient::RunWithDispatcher(
19 base::MessagePumpDispatcher* nested_dispatcher) { 19 base::MessagePumpDispatcher* nested_dispatcher,
20 // TODO(erg): This class has been copypastad from 20 base::Closure* quit_runloop) {
21 // ash/accelerators/nested_dispatcher_controller.cc. I have left my changes
22 // commented out because I don't entirely understand the implications of the
23 // change.
24 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); 21 base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
25 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop); 22 base::MessageLoopForUI::ScopedNestableTaskAllower allow_nested(loop);
26 23
27 base::Closure old_quit_closure = quit_closure_;
28 #if defined(OS_WIN) 24 #if defined(OS_WIN)
29 base::RunLoop run_loop(nested_dispatcher); 25 base::RunLoop run_loop(nested_dispatcher);
30 #else 26 #else
31 base::RunLoop run_loop; 27 base::RunLoop run_loop;
32 #endif 28 #endif
33 29 *quit_runloop = run_loop.QuitClosure();
34 quit_closure_ = run_loop.QuitClosure();
35 base::WeakPtr<DesktopDispatcherClient> alive(weak_ptr_factory_.GetWeakPtr());
36 run_loop.Run(); 30 run_loop.Run();
37 if (alive) {
38 weak_ptr_factory_.InvalidateWeakPtrs();
39 quit_closure_ = old_quit_closure;
40 }
41 }
42
43 void DesktopDispatcherClient::QuitNestedMessageLoop() {
44 CHECK(!quit_closure_.is_null());
45 quit_closure_.Run();
46 } 31 }
47 32
48 } // namespace views 33 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698