Reland: Remove aura and make a pure mojo::View version of FocusController.
[Changes: Remove additional deps which Linux/Windows was fine with, but which broke android because it implied an aura dependency. window_manager should now be properly deauraed.] This patch is only half done, however the main driver (removing aura) is needed by other teams for them to make progress. Input handling is regressed in this patch; while FocusController is rebuilt to the point where it should theoretically work, all of the details about ui::EventTargeter don't work correctly. There is an empty subclass ViewTargeter which will need to be filled out before Thankfully, this should only regress people who are using the wm_flow demo, and this should unblock the android guys who don't have aura support on their platform. BUG=431047 TBR=eseidel@chromium.org, sky@chromium.org Review URL: https://codereview.chromium.org/710203006
This commit is contained in:
@@ -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" ]
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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<mojo::FocusRules>(
|
||||
new mojo::BasicFocusRules(window_manager_app_.get(), content_)));
|
||||
|
||||
if (!pending_url_.empty())
|
||||
NavigateToURL(pending_url_);
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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_
|
||||
Reference in New Issue
Block a user