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

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

Issue 788453002: Put code in //services/window_manager in namespace window_manager (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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') | services/window_manager/main.cc » ('j') | 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 window_manager {
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. 19 // Returns true if the children of |window| can be activated.
20 virtual bool SupportsChildActivation(View* window) const = 0; 20 virtual bool SupportsChildActivation(mojo::View* window) const = 0;
21 21
22 // 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
23 // 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
24 // govern activation and focus. Not all toplevel views are activatable, 24 // govern activation and focus. Not all toplevel views are activatable,
25 // call CanActivateView() to determine if a view can be activated. 25 // call CanActivateView() to determine if a view can be activated.
26 virtual bool IsToplevelView(View* view) const = 0; 26 virtual bool IsToplevelView(mojo::View* view) const = 0;
27 // Returns true if |view| can be activated or focused. 27 // Returns true if |view| can be activated or focused.
28 virtual bool CanActivateView(View* view) const = 0; 28 virtual bool CanActivateView(mojo::View* view) const = 0;
29 // For CanFocusView(), null is supported, because null is a valid focusable 29 // For CanFocusView(), null is supported, because null is a valid focusable
30 // view (in the case of clearing focus). 30 // view (in the case of clearing focus).
31 virtual bool CanFocusView(View* view) const = 0; 31 virtual bool CanFocusView(mojo::View* view) const = 0;
32 32
33 // Returns the toplevel view containing |view|. Not all toplevel views 33 // Returns the toplevel view containing |view|. Not all toplevel views
34 // are activatable, call GetActivatableView() instead to return the 34 // are activatable, call GetActivatableView() instead to return the
35 // activatable view, which might be in a different hierarchy. 35 // activatable view, which might be in a different hierarchy.
36 // Will return null if |view| is not contained by a view considered to be 36 // Will return null if |view| is not contained by a view considered to be
37 // a toplevel view. 37 // a toplevel view.
38 virtual View* GetToplevelView(View* view) const = 0; 38 virtual mojo::View* GetToplevelView(mojo::View* view) const = 0;
39 // Returns the activatable or focusable view given an attempt to activate or 39 // Returns the activatable or focusable view given an attempt to activate or
40 // focus |view|. Some possible scenarios (not intended to be exhaustive): 40 // focus |view|. Some possible scenarios (not intended to be exhaustive):
41 // - |view| is a child of a non-focusable view and so focus must be set 41 // - |view| is a child of a non-focusable view and so focus must be set
42 // according to rules defined by the delegate, e.g. to a parent. 42 // according to rules defined by the delegate, e.g. to a parent.
43 // - |view| is an activatable view that is the transient parent of a modal 43 // - |view| is an activatable view that is the transient parent of a modal
44 // view, so attempts to activate |view| should result in the modal 44 // view, so attempts to activate |view| should result in the modal
45 // transient being activated instead. 45 // transient being activated instead.
46 // These methods may return null if they are unable to find an activatable 46 // These methods may return null if they are unable to find an activatable
47 // or focusable view given |view|. 47 // or focusable view given |view|.
48 virtual View* GetActivatableView(View* view) const = 0; 48 virtual mojo::View* GetActivatableView(mojo::View* view) const = 0;
49 virtual View* GetFocusableView(View* view) const = 0; 49 virtual mojo::View* GetFocusableView(mojo::View* view) const = 0;
50 50
51 // Returns the next view to activate in the event that |ignore| is no longer 51 // Returns the next view to activate in the event that |ignore| is no longer
52 // activatable. This function is called when something is happening to 52 // activatable. This function is called when something is happening to
53 // |ignore| that means it can no longer have focus or activation, including 53 // |ignore| that means it can no longer have focus or activation, including
54 // but not limited to: 54 // but not limited to:
55 // - it or its parent hierarchy is being hidden, or removed from the 55 // - it or its parent hierarchy is being hidden, or removed from the
56 // RootView. 56 // RootView.
57 // - it is being destroyed. 57 // - it is being destroyed.
58 // - it is being explicitly deactivated. 58 // - it is being explicitly deactivated.
59 // |ignore| cannot be null. 59 // |ignore| cannot be null.
60 virtual View* GetNextActivatableView(View* ignore) const = 0; 60 virtual mojo::View* GetNextActivatableView(mojo::View* ignore) const = 0;
61 }; 61 };
62 62
63 } // namespace mojo 63 } // namespace window_manager
64 64
65 #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') | services/window_manager/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698