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

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

Issue 418983002: Nukes view_manager namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: resolve merge 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "mojo/services/window_manager/window_manager_service_impl.h" 5 #include "mojo/services/window_manager/window_manager_service_impl.h"
6 6
7 #include "mojo/services/window_manager/window_manager_app.h" 7 #include "mojo/services/window_manager/window_manager_app.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 10
11 //////////////////////////////////////////////////////////////////////////////// 11 ////////////////////////////////////////////////////////////////////////////////
12 // WindowManagerServiceImpl, public: 12 // WindowManagerServiceImpl, public:
13 13
14 WindowManagerServiceImpl::WindowManagerServiceImpl( 14 WindowManagerServiceImpl::WindowManagerServiceImpl(
15 WindowManagerApp* window_manager) 15 WindowManagerApp* window_manager)
16 : window_manager_(window_manager) { 16 : window_manager_(window_manager) {
17 window_manager_->AddConnection(this); 17 window_manager_->AddConnection(this);
18 } 18 }
19 19
20 WindowManagerServiceImpl::~WindowManagerServiceImpl() { 20 WindowManagerServiceImpl::~WindowManagerServiceImpl() {
21 window_manager_->RemoveConnection(this); 21 window_manager_->RemoveConnection(this);
22 } 22 }
23 23
24 void WindowManagerServiceImpl::NotifyReady() { 24 void WindowManagerServiceImpl::NotifyReady() {
25 client()->OnWindowManagerReady(); 25 client()->OnWindowManagerReady();
26 } 26 }
27 27
28 void WindowManagerServiceImpl::NotifyNodeFocused( 28 void WindowManagerServiceImpl::NotifyNodeFocused(Id new_focused_id,
29 view_manager::Id new_focused_id, 29 Id old_focused_id) {
30 view_manager::Id old_focused_id) {
31 client()->OnFocusChanged(old_focused_id, new_focused_id); 30 client()->OnFocusChanged(old_focused_id, new_focused_id);
32 } 31 }
33 32
34 void WindowManagerServiceImpl::NotifyWindowActivated( 33 void WindowManagerServiceImpl::NotifyWindowActivated(Id new_active_id,
35 view_manager::Id new_active_id, 34 Id old_active_id) {
36 view_manager::Id old_active_id) {
37 client()->OnActiveWindowChanged(old_active_id, new_active_id); 35 client()->OnActiveWindowChanged(old_active_id, new_active_id);
38 } 36 }
39 37
40 //////////////////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////////////////
41 // WindowManagerServiceImpl, WindowManager implementation: 39 // WindowManagerServiceImpl, WindowManager implementation:
42 40
43 void WindowManagerServiceImpl::OpenWindow( 41 void WindowManagerServiceImpl::OpenWindow(
44 const Callback<void(view_manager::Id)>& callback) { 42 const Callback<void(Id)>& callback) {
45 bool success = window_manager_->IsReady(); 43 bool success = window_manager_->IsReady();
46 if (success) { 44 if (success) {
47 view_manager::Id id = window_manager_->OpenWindow(); 45 Id id = window_manager_->OpenWindow();
48 callback.Run(id); 46 callback.Run(id);
49 } else { 47 } else {
50 // TODO(beng): perhaps should take an error code for this. 48 // TODO(beng): perhaps should take an error code for this.
51 callback.Run(0); 49 callback.Run(0);
52 } 50 }
53 } 51 }
54 52
55 void WindowManagerServiceImpl::OpenWindowWithURL( 53 void WindowManagerServiceImpl::OpenWindowWithURL(
56 const String& url, 54 const String& url,
57 const Callback<void(view_manager::Id)>& callback) { 55 const Callback<void(Id)>& callback) {
58 bool success = window_manager_->IsReady(); 56 bool success = window_manager_->IsReady();
59 if (success) { 57 if (success) {
60 view_manager::Id id = window_manager_->OpenWindowWithURL(url); 58 Id id = window_manager_->OpenWindowWithURL(url);
61 callback.Run(id); 59 callback.Run(id);
62 } else { 60 } else {
63 // TODO(beng): perhaps should take an error code for this. 61 // TODO(beng): perhaps should take an error code for this.
64 callback.Run(0); 62 callback.Run(0);
65 } 63 }
66 } 64 }
67 65
68 void WindowManagerServiceImpl::SetCapture( 66 void WindowManagerServiceImpl::SetCapture(
69 view_manager::Id node, 67 Id node,
70 const Callback<void(bool)>& callback) { 68 const Callback<void(bool)>& callback) {
71 bool success = window_manager_->IsReady(); 69 bool success = window_manager_->IsReady();
72 if (success) 70 if (success)
73 window_manager_->SetCapture(node); 71 window_manager_->SetCapture(node);
74 callback.Run(success); 72 callback.Run(success);
75 } 73 }
76 74
77 void WindowManagerServiceImpl::FocusWindow( 75 void WindowManagerServiceImpl::FocusWindow(
78 view_manager::Id node, 76 Id node,
79 const Callback<void(bool)>& callback) { 77 const Callback<void(bool)>& callback) {
80 bool success = window_manager_->IsReady(); 78 bool success = window_manager_->IsReady();
81 if (success) 79 if (success)
82 window_manager_->FocusWindow(node); 80 window_manager_->FocusWindow(node);
83 callback.Run(success); 81 callback.Run(success);
84 } 82 }
85 83
86 void WindowManagerServiceImpl::ActivateWindow( 84 void WindowManagerServiceImpl::ActivateWindow(
87 view_manager::Id node, 85 Id node,
88 const Callback<void(bool)>& callback) { 86 const Callback<void(bool)>& callback) {
89 bool success = window_manager_->IsReady(); 87 bool success = window_manager_->IsReady();
90 if (success) 88 if (success)
91 window_manager_->ActivateWindow(node); 89 window_manager_->ActivateWindow(node);
92 callback.Run(success); 90 callback.Run(success);
93 } 91 }
94 92
95 //////////////////////////////////////////////////////////////////////////////// 93 ////////////////////////////////////////////////////////////////////////////////
96 // WindowManagerServiceImpl, InterfaceImpl overrides: 94 // WindowManagerServiceImpl, InterfaceImpl overrides:
97 95
98 void WindowManagerServiceImpl::OnConnectionEstablished() { 96 void WindowManagerServiceImpl::OnConnectionEstablished() {
99 // If the connection was established prior to the window manager being 97 // If the connection was established prior to the window manager being
100 // embedded by the view manager, |window_manager_|'s ViewManagerDelegate 98 // embedded by the view manager, |window_manager_|'s ViewManagerDelegate
101 // impl will call NotifyReady() when it is. 99 // impl will call NotifyReady() when it is.
102 if (window_manager_->IsReady()) 100 if (window_manager_->IsReady())
103 NotifyReady(); 101 NotifyReady();
104 } 102 }
105 103
106 } // namespace mojo 104 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/window_manager/window_manager_service_impl.h ('k') | mojo/shell/view_manager_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698