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

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

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 8 months 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 SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_
6 #define SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_
7
8 #include "third_party/mojo_services/src/view_manager/public/cpp/types.h"
9 #include "third_party/mojo_services/src/view_manager/public/cpp/view.h"
10
11 namespace window_manager {
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 the children of |window| can be activated.
20 virtual bool SupportsChildActivation(mojo::View* window) const = 0;
21
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
24 // govern activation and focus. Not all toplevel views are activatable,
25 // call CanActivateView() to determine if a view can be activated.
26 virtual bool IsToplevelView(mojo::View* view) const = 0;
27 // Returns true if |view| can be activated or focused.
28 virtual bool CanActivateView(mojo::View* view) const = 0;
29 // For CanFocusView(), null is supported, because null is a valid focusable
30 // view (in the case of clearing focus).
31 virtual bool CanFocusView(mojo::View* view) const = 0;
32
33 // Returns the toplevel view containing |view|. Not all toplevel views
34 // are activatable, call GetActivatableView() instead to return the
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
37 // a toplevel view.
38 virtual mojo::View* GetToplevelView(mojo::View* view) const = 0;
39 // Returns the activatable or focusable view given an attempt to activate or
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
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
44 // view, so attempts to activate |view| should result in the modal
45 // transient being activated instead.
46 // These methods may return null if they are unable to find an activatable
47 // or focusable view given |view|.
48 virtual mojo::View* GetActivatableView(mojo::View* view) const = 0;
49 virtual mojo::View* GetFocusableView(mojo::View* view) const = 0;
50
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
53 // |ignore| that means it can no longer have focus or activation, including
54 // but not limited to:
55 // - it or its parent hierarchy is being hidden, or removed from the
56 // RootView.
57 // - it is being destroyed.
58 // - it is being explicitly deactivated.
59 // |ignore| cannot be null.
60 virtual mojo::View* GetNextActivatableView(mojo::View* ignore) const = 0;
61 };
62
63 } // namespace window_manager
64
65 #endif // SERVICES_WINDOW_MANAGER_FOCUS_RULES_H_
OLDNEW
« no previous file with comments | « mojo/services/window_manager/focus_controller_unittest.cc ('k') | mojo/services/window_manager/hit_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698