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

Side by Side Diff: sky/tools/debugger/focus_rules.cc

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
« no previous file with comments | « sky/tools/debugger/focus_rules.h ('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
(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 #include "sky/tools/debugger/focus_rules.h"
6
7 namespace sky {
8 namespace debugger {
9
10 FocusRules::FocusRules(mojo::WindowManagerApp* window_manager_app,
11 mojo::View* content)
12 : content_(content),
13 window_manager_app_(window_manager_app) {
14 }
15
16 FocusRules::~FocusRules() {
17 }
18
19 bool FocusRules::IsToplevelWindow(aura::Window* window) const {
20 return mojo::WindowManagerApp::GetViewForWindow(window)->parent() == content_;
21 }
22
23 bool FocusRules::CanActivateWindow(aura::Window* window) const {
24 return mojo::WindowManagerApp::GetViewForWindow(window)->parent() == content_;
25 }
26
27 bool FocusRules::CanFocusWindow(aura::Window* window) const {
28 return true;
29 }
30
31 aura::Window* FocusRules::GetToplevelWindow(aura::Window* window) const {
32 mojo::View* view = mojo::WindowManagerApp::GetViewForWindow(window);
33 while (view->parent() != content_) {
34 view = view->parent();
35 if (!view)
36 return NULL;
37 }
38 return window_manager_app_->GetWindowForViewId(view->id());
39 }
40
41 aura::Window* FocusRules::GetActivatableWindow(aura::Window* window) const {
42 return GetToplevelWindow(window);
43 }
44
45 aura::Window* FocusRules::GetFocusableWindow(aura::Window* window) const {
46 return window;
47 }
48
49 aura::Window* FocusRules::GetNextActivatableWindow(aura::Window* ignore) const {
50 aura::Window* activatable = GetActivatableWindow(ignore);
51 const aura::Window::Windows& children = activatable->parent()->children();
52 for (aura::Window::Windows::const_reverse_iterator it = children.rbegin();
53 it != children.rend(); ++it) {
54 if (*it != ignore)
55 return *it;
56 }
57 return NULL;
58 }
59
60 } // namespace debugger
61 } // namespace sky
OLDNEW
« no previous file with comments | « sky/tools/debugger/focus_rules.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698