Commit 18bd2389 authored by sadrul@chromium.org's avatar sadrul@chromium.org

athena: Add a ScreenPositionClient on the root-window.

Some of the code (e.g. virtual keyboard related code in RenderWidgetHostViewAura)
expects a non-null ScreenPositionClient on the root window. So install a simple
implementation of the client that provides implementation for a single display.

BUG=380215
R=oshima@chromium.org

Review URL: https://codereview.chromium.org/330973003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278508 0039d316-1c4b-4281-b951-d872f2087c98
parent 0d897c0d
......@@ -9,9 +9,11 @@
#include "athena/screen/screen_accelerator_handler.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/wm/core/capture_controller.h"
namespace athena {
......@@ -76,6 +78,42 @@ class AthenaWindowTreeClient : public aura::client::WindowTreeClient {
DISALLOW_COPY_AND_ASSIGN(AthenaWindowTreeClient);
};
class AthenaScreenPositionClient : public aura::client::ScreenPositionClient {
public:
AthenaScreenPositionClient() {
}
virtual ~AthenaScreenPositionClient() {
}
private:
// aura::client::ScreenPositionClient:
virtual void ConvertPointToScreen(const aura::Window* window,
gfx::Point* point) OVERRIDE {
const aura::Window* root = window->GetRootWindow();
aura::Window::ConvertPointToTarget(window, root, point);
}
virtual void ConvertPointFromScreen(const aura::Window* window,
gfx::Point* point) OVERRIDE {
const aura::Window* root = window->GetRootWindow();
aura::Window::ConvertPointToTarget(root, window, point);
}
virtual void ConvertHostPointToScreen(aura::Window* window,
gfx::Point* point) OVERRIDE {
// TODO(oshima): Implement this when adding multiple display support.
NOTREACHED();
}
virtual void SetBounds(aura::Window* window,
const gfx::Rect& bounds,
const gfx::Display& display) OVERRIDE {
window->SetBounds(bounds);
}
DISALLOW_COPY_AND_ASSIGN(AthenaScreenPositionClient);
};
aura::Window* CreateContainerInternal(aura::Window* parent,
const std::string& name) {
aura::Window* container = new aura::Window(NULL);
......@@ -108,6 +146,7 @@ class ScreenManagerImpl : public ScreenManager {
scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
scoped_ptr<AcceleratorHandler> accelerator_handler_;
scoped_ptr< ::wm::ScopedCaptureClient> capture_client_;
scoped_ptr<aura::client::ScreenPositionClient> screen_position_client_;
DISALLOW_COPY_AND_ASSIGN(ScreenManagerImpl);
};
......@@ -129,6 +168,11 @@ aura::Window* ScreenManagerImpl::CreateDefaultContainer(
aura::Window* container = CreateContainerInternal(root_window_, name);
window_tree_client_.reset(new AthenaWindowTreeClient(container));
aura::client::SetWindowTreeClient(root_window_, window_tree_client_.get());
screen_position_client_.reset(new AthenaScreenPositionClient());
aura::client::SetScreenPositionClient(root_window_,
screen_position_client_.get());
return container;
}
......@@ -148,6 +192,7 @@ ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window)
}
ScreenManagerImpl::~ScreenManagerImpl() {
aura::client::SetScreenPositionClient(root_window_, NULL);
aura::client::SetWindowTreeClient(root_window_, NULL);
instance = NULL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment