Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: services/window_manager/window_manager_app.cc

Issue 954273002: Routes WindowManager functionality through the view manager (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/window_manager/window_manager_app.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()) ==
« no previous file with comments | « services/window_manager/window_manager_app.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698