| Index: mojo/services/view_manager/root_view_manager.cc
|
| diff --git a/mojo/services/view_manager/root_view_manager.cc b/mojo/services/view_manager/root_view_manager.cc
|
| index 2156c447f07618eaad9adc2d00acd35242a57bf7..8c4a68f07515198b654daaaef9de948f59f62a9b 100644
|
| --- a/mojo/services/view_manager/root_view_manager.cc
|
| +++ b/mojo/services/view_manager/root_view_manager.cc
|
| @@ -12,7 +12,6 @@
|
| #include "mojo/services/view_manager/screen_impl.h"
|
| #include "mojo/services/view_manager/window_tree_host_impl.h"
|
| #include "ui/aura/client/default_capture_client.h"
|
| -#include "ui/aura/client/focus_change_observer.h"
|
| #include "ui/aura/client/focus_client.h"
|
| #include "ui/aura/client/window_tree_client.h"
|
| #include "ui/aura/window.h"
|
| @@ -21,69 +20,23 @@
|
| namespace mojo {
|
| namespace service {
|
|
|
| -// TODO(sky): revisit this, we may need a more sophisticated FocusClient
|
| -// implementation.
|
| -class FocusClientImpl : public aura::client::FocusClient,
|
| - public aura::WindowObserver {
|
| - public:
|
| - FocusClientImpl()
|
| - : focused_window_(NULL),
|
| - observer_manager_(this) {
|
| - }
|
| - virtual ~FocusClientImpl() {}
|
| -
|
| - private:
|
| - // Overridden from aura::client::FocusClient:
|
| - virtual void AddObserver(aura::client::FocusChangeObserver* observer)
|
| - OVERRIDE {
|
| - observers_.AddObserver(observer);
|
| - }
|
| - virtual void RemoveObserver(aura::client::FocusChangeObserver* observer)
|
| - OVERRIDE {
|
| - observers_.RemoveObserver(observer);
|
| - }
|
| - virtual void FocusWindow(aura::Window* window) OVERRIDE {
|
| - if (window && !window->CanFocus())
|
| - return;
|
| - if (window == focused_window_)
|
| - return;
|
| - if (focused_window_)
|
| - observer_manager_.Remove(focused_window_);
|
| - aura::Window* old_focused_window = focused_window_;
|
| - focused_window_ = window;
|
| - if (focused_window_)
|
| - observer_manager_.Add(focused_window_);
|
| -
|
| - FOR_EACH_OBSERVER(aura::client::FocusChangeObserver,
|
| - observers_,
|
| - OnWindowFocused(focused_window_, old_focused_window));
|
| - aura::client::FocusChangeObserver* observer =
|
| - aura::client::GetFocusChangeObserver(old_focused_window);
|
| - if (observer)
|
| - observer->OnWindowFocused(focused_window_, old_focused_window);
|
| - observer = aura::client::GetFocusChangeObserver(focused_window_);
|
| - if (observer)
|
| - observer->OnWindowFocused(focused_window_, old_focused_window);
|
| - }
|
| - virtual void ResetFocusWithinActiveWindow(aura::Window* window) OVERRIDE {
|
| - if (!window->Contains(focused_window_))
|
| - FocusWindow(window);
|
| - }
|
| - virtual aura::Window* GetFocusedWindow() OVERRIDE {
|
| - return focused_window_;
|
| - }
|
| -
|
| - // Overridden from WindowObserver:
|
| - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {
|
| - DCHECK_EQ(window, focused_window_);
|
| - FocusWindow(NULL);
|
| - }
|
| -
|
| - aura::Window* focused_window_;
|
| - ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_;
|
| - ObserverList<aura::client::FocusChangeObserver> observers_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(FocusClientImpl);
|
| +// TODO(sky): Remove once aura is removed from the service.
|
| +class FocusClientImpl : public aura::client::FocusClient {
|
| + public:
|
| + FocusClientImpl() {}
|
| + virtual ~FocusClientImpl() {}
|
| +
|
| + private:
|
| + // Overridden from aura::client::FocusClient:
|
| + virtual void AddObserver(
|
| + aura::client::FocusChangeObserver* observer) OVERRIDE {}
|
| + virtual void RemoveObserver(
|
| + aura::client::FocusChangeObserver* observer) OVERRIDE {}
|
| + virtual void FocusWindow(aura::Window* window) OVERRIDE {}
|
| + virtual void ResetFocusWithinActiveWindow(aura::Window* window) OVERRIDE {}
|
| + virtual aura::Window* GetFocusedWindow() OVERRIDE { return NULL; }
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FocusClientImpl);
|
| };
|
|
|
| class WindowTreeClientImpl : public aura::client::WindowTreeClient {
|
| @@ -133,7 +86,9 @@ RootViewManager::RootViewManager(
|
| gfx::Rect(800, 600),
|
| base::Bind(&RootViewManager::OnCompositorCreated,
|
| base::Unretained(this)),
|
| - native_viewport_closed_callback));
|
| + native_viewport_closed_callback,
|
| + base::Bind(&RootNodeManager::DispatchNodeInputEventToWindowManager,
|
| + base::Unretained(root_node_manager_))));
|
| }
|
|
|
| RootViewManager::~RootViewManager() {
|
| @@ -154,10 +109,9 @@ void RootViewManager::OnCompositorCreated() {
|
| window_tree_client_.reset(
|
| new WindowTreeClientImpl(window_tree_host_->window()));
|
|
|
| - focus_client_.reset(new FocusClientImpl());
|
| + focus_client_.reset(new FocusClientImpl);
|
| aura::client::SetFocusClient(window_tree_host_->window(),
|
| focus_client_.get());
|
| - focus_client_->AddObserver(root_node_manager_);
|
|
|
| window_tree_host_->Show();
|
|
|
|
|