| Index: mojo/services/window_manager/window_manager_service_impl.cc
|
| diff --git a/mojo/services/window_manager/window_manager_service_impl.cc b/mojo/services/window_manager/window_manager_service_impl.cc
|
| index 847e3fde9e0b7232a3b8c93aefb6bfc21feab812..f8ce3d9746bc35d0dcffe14ea44f14d3c4084d2b 100644
|
| --- a/mojo/services/window_manager/window_manager_service_impl.cc
|
| +++ b/mojo/services/window_manager/window_manager_service_impl.cc
|
| @@ -26,20 +26,71 @@ void WindowManagerServiceImpl::NotifyReady() {
|
| client()->OnWindowManagerReady();
|
| }
|
|
|
| +void WindowManagerServiceImpl::NotifyNodeFocused(
|
| + view_manager::Id new_focused_id,
|
| + view_manager::Id old_focused_id) {
|
| + client()->OnFocusChanged(old_focused_id, new_focused_id);
|
| +}
|
| +
|
| +void WindowManagerServiceImpl::NotifyWindowActivated(
|
| + view_manager::Id new_active_id,
|
| + view_manager::Id old_active_id) {
|
| + client()->OnActiveWindowChanged(old_active_id, new_active_id);
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WindowManagerServiceImpl, WindowManager implementation:
|
|
|
| void WindowManagerServiceImpl::OpenWindow(
|
| const Callback<void(view_manager::Id)>& callback) {
|
| - view_manager::Id id = window_manager_->OpenWindow();
|
| - callback.Run(id);
|
| + bool success = window_manager_->IsReady();
|
| + if (success) {
|
| + view_manager::Id id = window_manager_->OpenWindow();
|
| + callback.Run(id);
|
| + } else {
|
| + // TODO(beng): perhaps should take an error code for this.
|
| + callback.Run(0);
|
| + }
|
| +}
|
| +
|
| +void WindowManagerServiceImpl::OpenWindowWithURL(
|
| + const String& url,
|
| + const Callback<void(view_manager::Id)>& callback) {
|
| + bool success = window_manager_->IsReady();
|
| + if (success) {
|
| + view_manager::Id id = window_manager_->OpenWindowWithURL(url);
|
| + callback.Run(id);
|
| + } else {
|
| + // TODO(beng): perhaps should take an error code for this.
|
| + callback.Run(0);
|
| + }
|
| }
|
|
|
| void WindowManagerServiceImpl::SetCapture(
|
| view_manager::Id node,
|
| const Callback<void(bool)>& callback) {
|
| - window_manager_->SetCapture(node);
|
| - callback.Run(true);
|
| + bool success = window_manager_->IsReady();
|
| + if (success)
|
| + window_manager_->SetCapture(node);
|
| + callback.Run(success);
|
| +}
|
| +
|
| +void WindowManagerServiceImpl::FocusWindow(
|
| + view_manager::Id node,
|
| + const Callback<void(bool)>& callback) {
|
| + bool success = window_manager_->IsReady();
|
| + if (success)
|
| + window_manager_->FocusWindow(node);
|
| + callback.Run(success);
|
| +}
|
| +
|
| +void WindowManagerServiceImpl::ActivateWindow(
|
| + view_manager::Id node,
|
| + const Callback<void(bool)>& callback) {
|
| + bool success = window_manager_->IsReady();
|
| + if (success)
|
| + window_manager_->ActivateWindow(node);
|
| + callback.Run(success);
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
|
|