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

Unified Diff: sky/tools/debugger/focus_rules.cc

Issue 718573002: Revert "Remove aura and make a pure mojo::View version of the aura::Window FocusController." (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/tools/debugger/focus_rules.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tools/debugger/focus_rules.cc
diff --git a/sky/tools/debugger/focus_rules.cc b/sky/tools/debugger/focus_rules.cc
new file mode 100644
index 0000000000000000000000000000000000000000..68eca6223cdaf4d6b0d41ebdffbd4628c183e834
--- /dev/null
+++ b/sky/tools/debugger/focus_rules.cc
@@ -0,0 +1,61 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sky/tools/debugger/focus_rules.h"
+
+namespace sky {
+namespace debugger {
+
+FocusRules::FocusRules(mojo::WindowManagerApp* window_manager_app,
+ mojo::View* content)
+ : content_(content),
+ window_manager_app_(window_manager_app) {
+}
+
+FocusRules::~FocusRules() {
+}
+
+bool FocusRules::IsToplevelWindow(aura::Window* window) const {
+ return mojo::WindowManagerApp::GetViewForWindow(window)->parent() == content_;
+}
+
+bool FocusRules::CanActivateWindow(aura::Window* window) const {
+ return mojo::WindowManagerApp::GetViewForWindow(window)->parent() == content_;
+}
+
+bool FocusRules::CanFocusWindow(aura::Window* window) const {
+ return true;
+}
+
+aura::Window* FocusRules::GetToplevelWindow(aura::Window* window) const {
+ mojo::View* view = mojo::WindowManagerApp::GetViewForWindow(window);
+ while (view->parent() != content_) {
+ view = view->parent();
+ if (!view)
+ return NULL;
+ }
+ return window_manager_app_->GetWindowForViewId(view->id());
+}
+
+aura::Window* FocusRules::GetActivatableWindow(aura::Window* window) const {
+ return GetToplevelWindow(window);
+}
+
+aura::Window* FocusRules::GetFocusableWindow(aura::Window* window) const {
+ return window;
+}
+
+aura::Window* FocusRules::GetNextActivatableWindow(aura::Window* ignore) const {
+ aura::Window* activatable = GetActivatableWindow(ignore);
+ const aura::Window::Windows& children = activatable->parent()->children();
+ for (aura::Window::Windows::const_reverse_iterator it = children.rbegin();
+ it != children.rend(); ++it) {
+ if (*it != ignore)
+ return *it;
+ }
+ return NULL;
+}
+
+} // namespace debugger
+} // namespace sky
« 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