Chromium Code Reviews| 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..00d4297a3592602b96516ed265edddb969b1224e 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 && SetCapture(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 && FocusWindow(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 && ActivateWindow(view); |
| } |
| bool WindowManagerApp::IsReady() const { |
| @@ -191,6 +182,18 @@ void WindowManagerApp::OnViewManagerDisconnected( |
| message_loop->Quit(); |
| } |
| +void WindowManagerApp::OnPerformAction(mojo::View* view, |
|
msw
2015/02/25 22:29:30
nit: match the function definition order of this "
sky
2015/02/25 23:20:27
The order here and in the header is consistent, bu
|
| + const std::string& action) { |
| + if (!view) |
| + return; |
| + if (action == "capture") |
| + SetCapture(view); |
| + else if (action == "focus") |
| + FocusWindow(view); |
| + else if (action == "activate") |
| + ActivateWindow(view); |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // WindowManagerApp, ViewObserver implementation: |
| @@ -278,6 +281,24 @@ void WindowManagerApp::OnCaptureChanged(View* gained_capture) { |
| //////////////////////////////////////////////////////////////////////////////// |
| // WindowManagerApp, private: |
| +bool WindowManagerApp::SetCapture(View* view) { |
| + CHECK(view); |
| + capture_controller_->SetCapture(view); |
| + return capture_controller_->GetCapture() == view; |
| +} |
| + |
| +bool WindowManagerApp::FocusWindow(View* view) { |
| + CHECK(view); |
| + focus_controller_->FocusView(view); |
| + return focus_controller_->GetFocusedView() == view; |
| +} |
| + |
| +bool WindowManagerApp::ActivateWindow(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()) == |