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

Unified Diff: mojo/services/window_manager/window_manager_service_impl.cc

Issue 405523002: Add ability APIs for opening a window with a url embedded, focusing and activating a window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 | « mojo/services/window_manager/window_manager_service_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « mojo/services/window_manager/window_manager_service_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698