OLD | NEW |
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" | 9 #include "mojo/services/window_manager/window_manager_app.h" |
10 | 10 |
11 namespace mojo { | 11 namespace mojo { |
12 | 12 |
13 BasicFocusRules::BasicFocusRules(mojo::WindowManagerApp* window_manager_app, | 13 BasicFocusRules::BasicFocusRules(mojo::WindowManagerApp* window_manager_app, |
14 mojo::View* window_container) | 14 mojo::View* window_container) |
15 : window_container_(window_container), | 15 : window_container_(window_container), |
16 window_manager_app_(window_manager_app) {} | 16 window_manager_app_(window_manager_app) { |
| 17 } |
17 | 18 |
18 BasicFocusRules::~BasicFocusRules() {} | 19 BasicFocusRules::~BasicFocusRules() {} |
19 | 20 |
20 bool BasicFocusRules::IsToplevelView(mojo::View* view) const { | 21 bool BasicFocusRules::IsToplevelView(mojo::View* view) const { |
21 return view->parent() == window_container_; | 22 return view->parent() == window_container_; |
22 } | 23 } |
23 | 24 |
24 bool BasicFocusRules::CanActivateView(mojo::View* view) const { | 25 bool BasicFocusRules::CanActivateView(mojo::View* view) const { |
25 // TODO(erg): This needs to check visibility, along with focus, and several | 26 // TODO(erg): This needs to check visibility, along with focus, and several |
26 // other things (see wm::BaseFocusRules). | 27 // other things (see wm::BaseFocusRules). |
(...skipping 28 matching lines...) Expand all Loading... |
55 const mojo::View::Children& children = activatable->parent()->children(); | 56 const mojo::View::Children& children = activatable->parent()->children(); |
56 for (mojo::View::Children::const_reverse_iterator it = children.rbegin(); | 57 for (mojo::View::Children::const_reverse_iterator it = children.rbegin(); |
57 it != children.rend(); ++it) { | 58 it != children.rend(); ++it) { |
58 if (*it != activatable) | 59 if (*it != activatable) |
59 return *it; | 60 return *it; |
60 } | 61 } |
61 return nullptr; | 62 return nullptr; |
62 } | 63 } |
63 | 64 |
64 } // namespace mojo | 65 } // namespace mojo |
OLD | NEW |