mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Now the SkyDebugger implements NavigatorHost and actually navigates the mojo::View. This CL pulled a big refactor of sky/tools/debugger to separate out MojoMain from debugger.cc. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/690363002
62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
// 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
|