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

Side by Side Diff: mojo/services/window_manager/basic_focus_rules.cc

Issue 737913002: Dispatch key events to the currently focused window. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Redo FocusController storage so that it is a local property on a view. Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/services/window_manager/basic_focus_rules.h" 5 #include "mojo/services/window_manager/basic_focus_rules.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "mojo/services/public/cpp/view_manager/view.h" 8 #include "mojo/services/public/cpp/view_manager/view.h"
9 #include "mojo/services/window_manager/window_manager_app.h"
10 9
11 namespace mojo { 10 namespace mojo {
12 11
13 BasicFocusRules::BasicFocusRules(mojo::WindowManagerApp* window_manager_app, 12 BasicFocusRules::BasicFocusRules(mojo::View* window_container)
14 mojo::View* window_container) 13 : window_container_(window_container) {
15 : window_container_(window_container), 14 }
16 window_manager_app_(window_manager_app) {}
17 15
18 BasicFocusRules::~BasicFocusRules() {} 16 BasicFocusRules::~BasicFocusRules() {}
19 17
20 bool BasicFocusRules::IsToplevelView(mojo::View* view) const { 18 bool BasicFocusRules::IsToplevelView(mojo::View* view) const {
21 return view->parent() == window_container_; 19 return view->parent() == window_container_;
22 } 20 }
23 21
24 bool BasicFocusRules::CanActivateView(mojo::View* view) const { 22 bool BasicFocusRules::CanActivateView(mojo::View* view) const {
25 // TODO(erg): This needs to check visibility, along with focus, and several 23 // TODO(erg): This needs to check visibility, along with focus, and several
26 // other things (see wm::BaseFocusRules). 24 // other things (see wm::BaseFocusRules).
(...skipping 28 matching lines...) Expand all
55 const mojo::View::Children& children = activatable->parent()->children(); 53 const mojo::View::Children& children = activatable->parent()->children();
56 for (mojo::View::Children::const_reverse_iterator it = children.rbegin(); 54 for (mojo::View::Children::const_reverse_iterator it = children.rbegin();
57 it != children.rend(); ++it) { 55 it != children.rend(); ++it) {
58 if (*it != activatable) 56 if (*it != activatable)
59 return *it; 57 return *it;
60 } 58 }
61 return nullptr; 59 return nullptr;
62 } 60 }
63 61
64 } // namespace mojo 62 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/window_manager/basic_focus_rules.h ('k') | mojo/services/window_manager/focus_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698