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

Side by Side Diff: services/ui/input_manager/input_associate.cc

Issue 1687513002: Make the first app to request input win (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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 | « no previous file | 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 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 "services/ui/input_manager/input_associate.h" 5 #include "services/ui/input_manager/input_associate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "mojo/public/cpp/bindings/interface_request.h" 9 #include "mojo/public/cpp/bindings/interface_request.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 input_dispatchers_.AddBinding( 47 input_dispatchers_.AddBinding(
48 new InputDispatcherImpl(this, view_tree_token.Pass()), 48 new InputDispatcherImpl(this, view_tree_token.Pass()),
49 mojo::MakeRequest<mojo::ui::InputDispatcher>(client_handle.Pass())); 49 mojo::MakeRequest<mojo::ui::InputDispatcher>(client_handle.Pass()));
50 } 50 }
51 } 51 }
52 52
53 void InputAssociate::SetListener(mojo::ui::ViewToken* view_token, 53 void InputAssociate::SetListener(mojo::ui::ViewToken* view_token,
54 mojo::ui::InputListenerPtr listener) { 54 mojo::ui::InputListenerPtr listener) {
55 // TODO(jeffbrown): This simple hack just hooks up the first listener 55 // TODO(jeffbrown): This simple hack just hooks up the first listener
56 // ever seen. 56 // ever seen.
57 listener_ = listener.Pass(); 57 if (!listener_)
58 listener_ = listener.Pass();
58 } 59 }
59 60
60 void InputAssociate::DispatchEvent(mojo::ui::ViewTreeToken* view_tree_token, 61 void InputAssociate::DispatchEvent(mojo::ui::ViewTreeToken* view_tree_token,
61 mojo::EventPtr event) { 62 mojo::EventPtr event) {
62 if (listener_) 63 if (listener_)
63 listener_->OnEvent( 64 listener_->OnEvent(
64 event.Pass(), 65 event.Pass(),
65 base::Bind(&InputAssociate::OnEventFinished, base::Unretained(this))); 66 base::Bind(&InputAssociate::OnEventFinished, base::Unretained(this)));
66 } 67 }
67 68
(...skipping 24 matching lines...) Expand all
92 DCHECK(view_tree_token_); 93 DCHECK(view_tree_token_);
93 } 94 }
94 95
95 InputAssociate::InputDispatcherImpl::~InputDispatcherImpl() {} 96 InputAssociate::InputDispatcherImpl::~InputDispatcherImpl() {}
96 97
97 void InputAssociate::InputDispatcherImpl::DispatchEvent(mojo::EventPtr event) { 98 void InputAssociate::InputDispatcherImpl::DispatchEvent(mojo::EventPtr event) {
98 associate_->DispatchEvent(view_tree_token_.get(), event.Pass()); 99 associate_->DispatchEvent(view_tree_token_.get(), event.Pass());
99 } 100 }
100 101
101 } // namespace input_manager 102 } // namespace input_manager
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698