Chromium Code Reviews| Index: athena/screen/screen_manager_impl.cc |
| diff --git a/athena/screen/screen_manager_impl.cc b/athena/screen/screen_manager_impl.cc |
| index e426a80f873e3249c08820fd923c9f5ccb9965eb..9c1a326bea71d5ffb3aeea03a1ff051618ec1cd1 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,46 @@ 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); |
| + gfx::Point origin = root->GetHost()->GetBounds().origin(); |
| + point->Offset(origin.x(), origin.y()); |
|
oshima
2014/06/19 17:37:27
Looks like this convert to the native coords, inst
sadrul
2014/06/19 17:59:00
The doc for this is a bit lacking; but the current
sadrul
2014/06/19 18:17:44
Done.
|
| + } |
| + |
| + virtual void ConvertPointFromScreen(const aura::Window* window, |
| + gfx::Point* point) OVERRIDE { |
| + const aura::Window* root = window->GetRootWindow(); |
| + gfx::Point origin = root->GetHost()->GetBounds().origin(); |
| + point->Offset(-origin.x(), -origin.y()); |
| + aura::Window::ConvertPointToTarget(root, window, point); |
| + } |
| + |
| + virtual void ConvertHostPointToScreen(aura::Window* window, |
| + gfx::Point* point) OVERRIDE { |
| + aura::Window* root = window->GetRootWindow(); |
| + ConvertPointToScreen(root, point); |
| + } |
| + |
| + 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 +150,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 +172,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 +196,7 @@ ScreenManagerImpl::ScreenManagerImpl(aura::Window* root_window) |
| } |
| ScreenManagerImpl::~ScreenManagerImpl() { |
| + aura::client::SetScreenPositionClient(root_window_, NULL); |
| aura::client::SetWindowTreeClient(root_window_, NULL); |
| instance = NULL; |
| } |