OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/window_manager/window_manager_impl.h" | 5 #include "services/window_manager/window_manager_impl.h" |
6 | 6 |
7 #include "services/window_manager/window_manager_app.h" | 7 #include "services/window_manager/window_manager_app.h" |
8 | 8 |
9 namespace mojo { | 9 using mojo::Callback; |
| 10 using mojo::Id; |
| 11 |
| 12 namespace window_manager { |
10 | 13 |
11 WindowManagerImpl::WindowManagerImpl(WindowManagerApp* window_manager, | 14 WindowManagerImpl::WindowManagerImpl(WindowManagerApp* window_manager, |
12 bool from_vm) | 15 bool from_vm) |
13 : window_manager_(window_manager), from_vm_(from_vm), binding_(this) { | 16 : window_manager_(window_manager), from_vm_(from_vm), binding_(this) { |
14 window_manager_->AddConnection(this); | 17 window_manager_->AddConnection(this); |
15 binding_.set_error_handler(this); | 18 binding_.set_error_handler(this); |
16 } | 19 } |
17 | 20 |
18 WindowManagerImpl::~WindowManagerImpl() { | 21 WindowManagerImpl::~WindowManagerImpl() { |
19 window_manager_->RemoveConnection(this); | 22 window_manager_->RemoveConnection(this); |
20 } | 23 } |
21 | 24 |
22 void WindowManagerImpl::Bind(ScopedMessagePipeHandle window_manager_pipe) { | 25 void WindowManagerImpl::Bind( |
| 26 mojo::ScopedMessagePipeHandle window_manager_pipe) { |
23 binding_.Bind(window_manager_pipe.Pass()); | 27 binding_.Bind(window_manager_pipe.Pass()); |
24 } | 28 } |
25 | 29 |
26 void WindowManagerImpl::NotifyViewFocused(Id new_focused_id, | 30 void WindowManagerImpl::NotifyViewFocused(Id new_focused_id, |
27 Id old_focused_id) { | 31 Id old_focused_id) { |
28 if (from_vm_) | 32 if (from_vm_) |
29 client()->OnFocusChanged(old_focused_id, new_focused_id); | 33 client()->OnFocusChanged(old_focused_id, new_focused_id); |
30 } | 34 } |
31 | 35 |
32 void WindowManagerImpl::NotifyWindowActivated(Id new_active_id, | 36 void WindowManagerImpl::NotifyWindowActivated(Id new_active_id, |
33 Id old_active_id) { | 37 Id old_active_id) { |
34 if (from_vm_) | 38 if (from_vm_) |
35 client()->OnActiveWindowChanged(old_active_id, new_active_id); | 39 client()->OnActiveWindowChanged(old_active_id, new_active_id); |
36 } | 40 } |
37 | 41 |
38 void WindowManagerImpl::Embed( | 42 void WindowManagerImpl::Embed( |
39 const String& url, | 43 const mojo::String& url, |
40 InterfaceRequest<ServiceProvider> service_provider) { | 44 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) { |
41 window_manager_->Embed(url, service_provider.Pass()); | 45 window_manager_->Embed(url, service_provider.Pass()); |
42 } | 46 } |
43 | 47 |
44 void WindowManagerImpl::SetCapture(Id view, | 48 void WindowManagerImpl::SetCapture(Id view, |
45 const Callback<void(bool)>& callback) { | 49 const Callback<void(bool)>& callback) { |
46 if (!from_vm_) | 50 if (!from_vm_) |
47 return; // See comments for |from_vm_| on this. | 51 return; // See comments for |from_vm_| on this. |
48 | 52 |
49 bool success = window_manager_->IsReady(); | 53 bool success = window_manager_->IsReady(); |
50 if (success) | 54 if (success) |
(...skipping 20 matching lines...) Expand all Loading... |
71 bool success = window_manager_->IsReady(); | 75 bool success = window_manager_->IsReady(); |
72 if (success) | 76 if (success) |
73 window_manager_->ActivateWindow(view); | 77 window_manager_->ActivateWindow(view); |
74 callback.Run(success); | 78 callback.Run(success); |
75 } | 79 } |
76 | 80 |
77 void WindowManagerImpl::OnConnectionError() { | 81 void WindowManagerImpl::OnConnectionError() { |
78 delete this; | 82 delete this; |
79 } | 83 } |
80 | 84 |
81 } // namespace mojo | 85 } // namespace window_manager |
OLD | NEW |