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

Side by Side Diff: services/window_manager/focus_rules.h

Issue 747163002: Port more focus controller unit tests and fix our focus rules. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove O(n) solution with O(1). Created 6 years 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 | « services/window_manager/focus_controller_unittest.cc ('k') | 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 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 #ifndef SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_ 5 #ifndef SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_
6 #define SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_ 6 #define SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_
7 7
8 #include "mojo/services/public/cpp/view_manager/types.h" 8 #include "mojo/services/public/cpp/view_manager/types.h"
9 #include "mojo/services/public/cpp/view_manager/view.h" 9 #include "mojo/services/public/cpp/view_manager/view.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 12
13 // Implemented by an object that establishes the rules about what can be 13 // Implemented by an object that establishes the rules about what can be
14 // focused or activated. 14 // focused or activated.
15 class FocusRules { 15 class FocusRules {
16 public: 16 public:
17 virtual ~FocusRules() {} 17 virtual ~FocusRules() {}
18 18
19 // Returns true if the children of |window| can be activated.
20 virtual bool SupportsChildActivation(View* window) const = 0;
21
19 // Returns true if |view| is a toplevel view. Whether or not a view 22 // Returns true if |view| is a toplevel view. Whether or not a view
20 // is considered toplevel is determined by a similar set of rules that 23 // is considered toplevel is determined by a similar set of rules that
21 // govern activation and focus. Not all toplevel views are activatable, 24 // govern activation and focus. Not all toplevel views are activatable,
22 // call CanActivateView() to determine if a view can be activated. 25 // call CanActivateView() to determine if a view can be activated.
23 virtual bool IsToplevelView(View* view) const = 0; 26 virtual bool IsToplevelView(View* view) const = 0;
24 // Returns true if |view| can be activated or focused. 27 // Returns true if |view| can be activated or focused.
25 virtual bool CanActivateView(View* view) const = 0; 28 virtual bool CanActivateView(View* view) const = 0;
26 // For CanFocusView(), null is supported, because null is a valid focusable 29 // For CanFocusView(), null is supported, because null is a valid focusable
27 // view (in the case of clearing focus). 30 // view (in the case of clearing focus).
28 virtual bool CanFocusView(View* view) const = 0; 31 virtual bool CanFocusView(View* view) const = 0;
(...skipping 24 matching lines...) Expand all
53 // RootView. 56 // RootView.
54 // - it is being destroyed. 57 // - it is being destroyed.
55 // - it is being explicitly deactivated. 58 // - it is being explicitly deactivated.
56 // |ignore| cannot be null. 59 // |ignore| cannot be null.
57 virtual View* GetNextActivatableView(View* ignore) const = 0; 60 virtual View* GetNextActivatableView(View* ignore) const = 0;
58 }; 61 };
59 62
60 } // namespace mojo 63 } // namespace mojo
61 64
62 #endif // SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_ 65 #endif // SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_
OLDNEW
« no previous file with comments | « services/window_manager/focus_controller_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698