| Index: services/window_manager/window_manager_app.cc
|
| diff --git a/services/window_manager/window_manager_app.cc b/services/window_manager/window_manager_app.cc
|
| index 9b1a87b0b1ae362272a3809e3182508683269eaa..9e3cd79252cfa4501199bc4dcad81c093736178e 100644
|
| --- a/services/window_manager/window_manager_app.cc
|
| +++ b/services/window_manager/window_manager_app.cc
|
| @@ -87,26 +87,17 @@ void WindowManagerApp::RemoveConnection(WindowManagerImpl* connection) {
|
|
|
| bool WindowManagerApp::SetCapture(Id view_id) {
|
| View* view = view_manager()->GetViewById(view_id);
|
| - if (!view)
|
| - return false;
|
| - capture_controller_->SetCapture(view);
|
| - return capture_controller_->GetCapture() == view;
|
| + return view && SetCaptureImpl(view);
|
| }
|
|
|
| bool WindowManagerApp::FocusWindow(Id view_id) {
|
| View* view = view_manager()->GetViewById(view_id);
|
| - if (!view)
|
| - return false;
|
| - focus_controller_->FocusView(view);
|
| - return focus_controller_->GetFocusedView() == view;
|
| + return view && FocusWindowImpl(view);
|
| }
|
|
|
| bool WindowManagerApp::ActivateWindow(Id view_id) {
|
| View* view = view_manager()->GetViewById(view_id);
|
| - if (!view)
|
| - return false;
|
| - focus_controller_->ActivateView(view);
|
| - return focus_controller_->GetActiveView() == view;
|
| + return view && ActivateWindowImpl(view);
|
| }
|
|
|
| bool WindowManagerApp::IsReady() const {
|
| @@ -191,6 +182,19 @@ void WindowManagerApp::OnViewManagerDisconnected(
|
| message_loop->Quit();
|
| }
|
|
|
| +bool WindowManagerApp::OnPerformAction(mojo::View* view,
|
| + const std::string& action) {
|
| + if (!view)
|
| + return false;
|
| + if (action == "capture")
|
| + return SetCaptureImpl(view);
|
| + if (action == "focus")
|
| + return FocusWindowImpl(view);
|
| + else if (action == "activate")
|
| + return ActivateWindowImpl(view);
|
| + return false;
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WindowManagerApp, ViewObserver implementation:
|
|
|
| @@ -278,6 +282,24 @@ void WindowManagerApp::OnCaptureChanged(View* gained_capture) {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WindowManagerApp, private:
|
|
|
| +bool WindowManagerApp::SetCaptureImpl(View* view) {
|
| + CHECK(view);
|
| + capture_controller_->SetCapture(view);
|
| + return capture_controller_->GetCapture() == view;
|
| +}
|
| +
|
| +bool WindowManagerApp::FocusWindowImpl(View* view) {
|
| + CHECK(view);
|
| + focus_controller_->FocusView(view);
|
| + return focus_controller_->GetFocusedView() == view;
|
| +}
|
| +
|
| +bool WindowManagerApp::ActivateWindowImpl(View* view) {
|
| + CHECK(view);
|
| + focus_controller_->ActivateView(view);
|
| + return focus_controller_->GetActiveView() == view;
|
| +}
|
| +
|
| void WindowManagerApp::RegisterSubtree(View* view) {
|
| view->AddObserver(this);
|
| DCHECK(registered_view_id_set_.find(view->id()) ==
|
|
|