diff --git a/engine/src/flutter/BUILD.gn b/engine/src/flutter/BUILD.gn index ee665ca6e7..5a686fbbd7 100644 --- a/engine/src/flutter/BUILD.gn +++ b/engine/src/flutter/BUILD.gn @@ -14,14 +14,10 @@ group("sky") { "//sky/engine/web:sky_unittests", "//sky/engine/wtf:unittests", "//sky/services/inspector", + "//sky/tools/debugger", + "//sky/tools/tester", "//sky/viewer", ] - if (use_aura) { - deps += [ - "//sky/tools/debugger", - "//sky/tools/tester", - ] - } if (!is_android) { deps += [ "//third_party/mesa:osmesa" ] } diff --git a/engine/src/flutter/tools/debugger/BUILD.gn b/engine/src/flutter/tools/debugger/BUILD.gn index 199269cc46..72a4a1b076 100644 --- a/engine/src/flutter/tools/debugger/BUILD.gn +++ b/engine/src/flutter/tools/debugger/BUILD.gn @@ -17,8 +17,6 @@ shared_library("sky_debugger") { sources = [ "debugger.cc", "debugger.h", - "focus_rules.cc", - "focus_rules.h", "main.cc", "navigator_host_impl.cc", "navigator_host_impl.h", @@ -37,8 +35,6 @@ shared_library("sky_debugger") { "//mojo/services/public/interfaces/navigation", "//mojo/services/window_manager:lib", "//sky/viewer:bindings", - "//ui/aura:aura", - "//ui/wm:wm", ":bindings", ] } diff --git a/engine/src/flutter/tools/debugger/debugger.cc b/engine/src/flutter/tools/debugger/debugger.cc index 96e68cc1bf..3fb3a9834a 100644 --- a/engine/src/flutter/tools/debugger/debugger.cc +++ b/engine/src/flutter/tools/debugger/debugger.cc @@ -4,6 +4,8 @@ #include "sky/tools/debugger/debugger.h" +#include "mojo/services/window_manager/basic_focus_rules.h" + namespace sky { namespace debugger { @@ -58,8 +60,8 @@ void SkyDebugger::OnEmbed( content_->SetBounds(root_->bounds()); root_->AddChild(content_); - window_manager_app_->InitFocus( - new FocusRules(window_manager_app_.get(), content_)); + window_manager_app_->InitFocus(scoped_ptr( + new mojo::BasicFocusRules(window_manager_app_.get(), content_))); if (!pending_url_.empty()) NavigateToURL(pending_url_); diff --git a/engine/src/flutter/tools/debugger/debugger.h b/engine/src/flutter/tools/debugger/debugger.h index e48a6280d7..8c40fc4f5c 100644 --- a/engine/src/flutter/tools/debugger/debugger.h +++ b/engine/src/flutter/tools/debugger/debugger.h @@ -15,7 +15,6 @@ #include "mojo/services/window_manager/window_manager_app.h" #include "mojo/services/window_manager/window_manager_delegate.h" #include "sky/tools/debugger/debugger.mojom.h" -#include "sky/tools/debugger/focus_rules.h" #include "sky/tools/debugger/navigator_host_impl.h" #include "sky/viewer/services/inspector.mojom.h" diff --git a/engine/src/flutter/tools/debugger/focus_rules.cc b/engine/src/flutter/tools/debugger/focus_rules.cc deleted file mode 100644 index 68eca6223c..0000000000 --- a/engine/src/flutter/tools/debugger/focus_rules.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 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 diff --git a/engine/src/flutter/tools/debugger/focus_rules.h b/engine/src/flutter/tools/debugger/focus_rules.h deleted file mode 100644 index fa5a91974f..0000000000 --- a/engine/src/flutter/tools/debugger/focus_rules.h +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -#ifndef SKY_TOOLS_DEBUGGER_FOCUS_RULES_H_ -#define SKY_TOOLS_DEBUGGER_FOCUS_RULES_H_ - -#include "mojo/services/window_manager/window_manager_app.h" -#include "ui/aura/window.h" -#include "ui/wm/core/focus_rules.h" - -namespace sky { -namespace debugger { - -class FocusRules : public wm::FocusRules { - public: - FocusRules(mojo::WindowManagerApp* window_manager_app, mojo::View* content); - virtual ~FocusRules(); - - private: - // Overridden from wm::FocusRules: - bool IsToplevelWindow(aura::Window* window) const override; - bool CanActivateWindow(aura::Window* window) const override; - bool CanFocusWindow(aura::Window* window) const override; - aura::Window* GetToplevelWindow(aura::Window* window) const override; - aura::Window* GetActivatableWindow(aura::Window* window) const override; - aura::Window* GetFocusableWindow(aura::Window* window) const override; - aura::Window* GetNextActivatableWindow(aura::Window* ignore) const override; - - mojo::View* content_; - mojo::WindowManagerApp* window_manager_app_; - - DISALLOW_COPY_AND_ASSIGN(FocusRules); -}; - -} // namespace debugger -} // namespace sky - -#endif // SKY_TOOLS_DEBUGGER_FOCUS_RULES_H_