summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 22:25:09 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 22:25:09 +0000
commit18bd23891caeab7b85a685bb70bb22844053a79f (patch)
treebb4504169b93d25ab2d1986f4498fefa9969ea00
parent0d897c0d674e8e9b04cf803827bb4224ed9674b3 (diff)
downloadchromium_src-18bd23891caeab7b85a685bb70bb22844053a79f.zip
chromium_src-18bd23891caeab7b85a685bb70bb22844053a79f.tar.gz
chromium_src-18bd23891caeab7b85a685bb70bb22844053a79f.tar.bz2
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
-rw-r--r--athena/screen/screen_manager_impl.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/athena/screen/screen_manager_impl.cc b/athena/screen/screen_manager_impl.cc
index e426a80..6ea40ae 100644
--- a/athena/screen/screen_manager_impl.cc
+++ b/athena/screen/screen_manager_impl.cc
@@ -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;
}