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

Side by Side Diff: mojo/services/window_manager/window_manager_service_impl.cc

Issue 466273002: Remove OpenWindow from the WindowManager interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/services/window_manager/window_manager_service_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "mojo/services/window_manager/window_manager_service_impl.h" 6 #include "mojo/services/window_manager/window_manager_service_impl.h"
7 7
8 #include "mojo/services/window_manager/window_manager_app.h" 8 #include "mojo/services/window_manager/window_manager_app.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 void WindowManagerServiceImpl::NotifyWindowActivated(Id new_active_id, 34 void WindowManagerServiceImpl::NotifyWindowActivated(Id new_active_id,
35 Id old_active_id) { 35 Id old_active_id) {
36 client()->OnActiveWindowChanged(old_active_id, new_active_id); 36 client()->OnActiveWindowChanged(old_active_id, new_active_id);
37 } 37 }
38 38
39 //////////////////////////////////////////////////////////////////////////////// 39 ////////////////////////////////////////////////////////////////////////////////
40 // WindowManagerServiceImpl, WindowManager implementation: 40 // WindowManagerServiceImpl, WindowManager implementation:
41 41
42 void WindowManagerServiceImpl::OpenWindow(
43 const Callback<void(Id)>& callback) {
44 bool success = window_manager_->IsReady();
45 if (success) {
46 Id id = window_manager_->OpenWindow();
47 callback.Run(id);
48 } else {
49 // TODO(beng): perhaps should take an error code for this.
50 callback.Run(0);
51 }
52 }
53
54 void WindowManagerServiceImpl::OpenWindowWithURL(
55 const String& url,
56 const Callback<void(Id)>& callback) {
57 bool success = window_manager_->IsReady();
58 if (success) {
59 Id id = window_manager_->OpenWindowWithURL(url);
60 callback.Run(id);
61 } else {
62 // TODO(beng): perhaps should take an error code for this.
63 callback.Run(0);
64 }
65 }
66
67 void WindowManagerServiceImpl::SetCapture( 42 void WindowManagerServiceImpl::SetCapture(
68 Id node, 43 Id view,
69 const Callback<void(bool)>& callback) { 44 const Callback<void(bool)>& callback) {
70 bool success = window_manager_->IsReady(); 45 bool success = window_manager_->IsReady();
71 if (success) 46 if (success)
72 window_manager_->SetCapture(node); 47 window_manager_->SetCapture(view);
73 callback.Run(success); 48 callback.Run(success);
74 } 49 }
75 50
76 void WindowManagerServiceImpl::FocusWindow( 51 void WindowManagerServiceImpl::FocusWindow(
77 Id node, 52 Id view,
78 const Callback<void(bool)>& callback) { 53 const Callback<void(bool)>& callback) {
79 bool success = window_manager_->IsReady(); 54 bool success = window_manager_->IsReady();
80 if (success) 55 if (success)
81 window_manager_->FocusWindow(node); 56 window_manager_->FocusWindow(view);
82 callback.Run(success); 57 callback.Run(success);
83 } 58 }
84 59
85 void WindowManagerServiceImpl::ActivateWindow( 60 void WindowManagerServiceImpl::ActivateWindow(
86 Id node, 61 Id view,
87 const Callback<void(bool)>& callback) { 62 const Callback<void(bool)>& callback) {
88 bool success = window_manager_->IsReady(); 63 bool success = window_manager_->IsReady();
89 if (success) 64 if (success)
90 window_manager_->ActivateWindow(node); 65 window_manager_->ActivateWindow(view);
91 callback.Run(success); 66 callback.Run(success);
92 } 67 }
93 68
94 //////////////////////////////////////////////////////////////////////////////// 69 ////////////////////////////////////////////////////////////////////////////////
95 // WindowManagerServiceImpl, InterfaceImpl overrides: 70 // WindowManagerServiceImpl, InterfaceImpl overrides:
96 71
97 void WindowManagerServiceImpl::OnConnectionEstablished() { 72 void WindowManagerServiceImpl::OnConnectionEstablished() {
98 // If the connection was established prior to the window manager being 73 // If the connection was established prior to the window manager being
99 // embedded by the view manager, |window_manager_|'s ViewManagerDelegate 74 // embedded by the view manager, |window_manager_|'s ViewManagerDelegate
100 // impl will call NotifyReady() when it is. 75 // impl will call NotifyReady() when it is.
101 if (window_manager_->IsReady()) 76 if (window_manager_->IsReady())
102 NotifyReady(); 77 NotifyReady();
103 } 78 }
104 79
105 } // namespace mojo 80 } // namespace mojo
OLDNEW
« 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