OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/services/window_manager/window_manager_service_impl.h" |
| 6 |
| 7 #include "mojo/services/window_manager/window_manager_app.h" |
| 8 |
| 9 namespace mojo { |
| 10 |
| 11 //////////////////////////////////////////////////////////////////////////////// |
| 12 // WindowManagerServiceImpl, public: |
| 13 |
| 14 WindowManagerServiceImpl::WindowManagerServiceImpl( |
| 15 ApplicationConnection* connection, |
| 16 WindowManagerApp* window_manager) |
| 17 : window_manager_(window_manager) { |
| 18 window_manager_->AddConnection(this); |
| 19 } |
| 20 |
| 21 WindowManagerServiceImpl::~WindowManagerServiceImpl() { |
| 22 window_manager_->RemoveConnection(this); |
| 23 } |
| 24 |
| 25 void WindowManagerServiceImpl::NotifyReady() { |
| 26 client()->OnWindowManagerReady(); |
| 27 } |
| 28 |
| 29 //////////////////////////////////////////////////////////////////////////////// |
| 30 // WindowManagerServiceImpl, WindowManager implementation: |
| 31 |
| 32 void WindowManagerServiceImpl::OpenWindow( |
| 33 const Callback<void(view_manager::Id)>& callback) { |
| 34 view_manager::Id id = window_manager_->OpenWindow(); |
| 35 callback.Run(id); |
| 36 } |
| 37 |
| 38 void WindowManagerServiceImpl::SetCapture( |
| 39 view_manager::Id node, |
| 40 const Callback<void(bool)>& callback) { |
| 41 window_manager_->SetCapture(node); |
| 42 callback.Run(true); |
| 43 } |
| 44 |
| 45 //////////////////////////////////////////////////////////////////////////////// |
| 46 // WindowManagerServiceImpl, InterfaceImpl overrides: |
| 47 |
| 48 void WindowManagerServiceImpl::OnConnectionEstablished() { |
| 49 // If the connection was established prior to the window manager being |
| 50 // embedded by the view manager, |window_manager_|'s ViewManagerDelegate |
| 51 // impl will call NotifyReady() when it is. |
| 52 if (window_manager_->IsReady()) |
| 53 NotifyReady(); |
| 54 } |
| 55 |
| 56 } // namespace mojo |
OLD | NEW |