Revert "Remove aura and make a pure mojo::View version of the aura::Window FocusController."

This reverts commit bb29e4293b6e60ee721b5be17f9fa9f4989a1981.

This is a speculative revert due to android waterfall bots failing.

BUG=431047
TBR=ojan@chromium.org,sky@chromium.org

Review URL: https://codereview.chromium.org/718573002
This commit is contained in:
Elliot Glaysher 2014-11-10 16:28:49 -08:00
parent 62abe6ed54
commit afbfcfecda
6 changed files with 113 additions and 6 deletions

View File

@ -14,10 +14,14 @@ 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" ]
}

View File

@ -17,6 +17,8 @@ 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",
@ -35,6 +37,8 @@ shared_library("sky_debugger") {
"//mojo/services/public/interfaces/navigation",
"//mojo/services/window_manager:lib",
"//sky/viewer:bindings",
"//ui/aura:aura",
"//ui/wm:wm",
":bindings",
]
}

View File

@ -4,8 +4,6 @@
#include "sky/tools/debugger/debugger.h"
#include "mojo/services/window_manager/basic_focus_rules.h"
namespace sky {
namespace debugger {
@ -60,8 +58,8 @@ void SkyDebugger::OnEmbed(
content_->SetBounds(root_->bounds());
root_->AddChild(content_);
window_manager_app_->InitFocus(scoped_ptr<mojo::FocusRules>(
new mojo::BasicFocusRules(window_manager_app_.get(), content_)));
window_manager_app_->InitFocus(
new FocusRules(window_manager_app_.get(), content_));
if (!pending_url_.empty())
NavigateToURL(pending_url_);

View File

@ -15,6 +15,7 @@
#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"

View File

@ -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

View File

@ -0,0 +1,39 @@
// 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_