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

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

Issue 710203006: Reland: Remove aura and make a pure mojo::View version of FocusController. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove the offending lines. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_SERIVCES_WINDOW_MANAGER_FOCUS_RULES_H_
6 #define MOJO_SERIVCES_WINDOW_MANAGER_FOCUS_RULES_H_
7
8 #include "mojo/services/public/cpp/view_manager/types.h"
9 #include "mojo/services/public/cpp/view_manager/view.h"
10
11 namespace mojo {
12
13 // Implemented by an object that establishes the rules about what can be
14 // focused or activated.
15 class FocusRules {
16 public:
17 virtual ~FocusRules() {}
18
19 // 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
21 // govern activation and focus. Not all toplevel views are activatable,
22 // call CanActivateView() to determine if a view can be activated.
23 virtual bool IsToplevelView(View* view) const = 0;
24 // Returns true if |view| can be activated or focused.
25 virtual bool CanActivateView(View* view) const = 0;
26 // For CanFocusView(), null is supported, because null is a valid focusable
27 // view (in the case of clearing focus).
28 virtual bool CanFocusView(View* view) const = 0;
29
30 // Returns the toplevel view containing |view|. Not all toplevel views
31 // are activatable, call GetActivatableView() instead to return the
32 // activatable view, which might be in a different hierarchy.
33 // Will return null if |view| is not contained by a view considered to be
34 // a toplevel view.
35 virtual View* GetToplevelView(View* view) const = 0;
36 // Returns the activatable or focusable view given an attempt to activate or
37 // focus |view|. Some possible scenarios (not intended to be exhaustive):
38 // - |view| is a child of a non-focusable view and so focus must be set
39 // according to rules defined by the delegate, e.g. to a parent.
40 // - |view| is an activatable view that is the transient parent of a modal
41 // view, so attempts to activate |view| should result in the modal
42 // transient being activated instead.
43 // These methods may return null if they are unable to find an activatable
44 // or focusable view given |view|.
45 virtual View* GetActivatableView(View* view) const = 0;
46 virtual View* GetFocusableView(View* view) const = 0;
47
48 // Returns the next view to activate in the event that |ignore| is no longer
49 // activatable. This function is called when something is happening to
50 // |ignore| that means it can no longer have focus or activation, including
51 // but not limited to:
52 // - it or its parent hierarchy is being hidden, or removed from the
53 // RootView.
54 // - it is being destroyed.
55 // - it is being explicitly deactivated.
56 // |ignore| cannot be null.
57 virtual View* GetNextActivatableView(View* ignore) const = 0;
58 };
59
60 } // namespace mojo
61
62 #endif // MOJO_SERIVCES_WINDOW_MANAGER_FOCUS_RULES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698