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

Side by Side Diff: mojo/services/window_manager/window_manager_app.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
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_app.h" 5 #include "mojo/services/window_manager/window_manager_app.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "mojo/aura/aura_init.h" 9 #include "mojo/aura/aura_init.h"
10 #include "mojo/aura/window_tree_host_mojo.h" 10 #include "mojo/aura/window_tree_host_mojo.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // WindowManagerApp, public: 71 // WindowManagerApp, public:
72 72
73 WindowManagerApp::WindowManagerApp(ViewManagerDelegate* delegate) 73 WindowManagerApp::WindowManagerApp(ViewManagerDelegate* delegate)
74 : window_manager_service_factory_(this), 74 : window_manager_service_factory_(this),
75 wrapped_delegate_(delegate), 75 wrapped_delegate_(delegate),
76 view_manager_(NULL), 76 view_manager_(NULL),
77 view_manager_client_factory_(this), 77 view_manager_client_factory_(this),
78 root_(NULL) { 78 root_(NULL) {
79 } 79 }
80 80
81 WindowManagerApp::~WindowManagerApp() { 81 WindowManagerApp::~WindowManagerApp() {}
82 // TODO(beng): Figure out if this should be done in
83 // OnViewManagerDisconnected().
84 STLDeleteValues(&view_id_to_window_map_);
85 if (focus_client_.get())
86 focus_client_->RemoveObserver(this);
87 if (activation_client_)
88 activation_client_->RemoveObserver(this);
89 }
90 82
91 void WindowManagerApp::AddConnection(WindowManagerServiceImpl* connection) { 83 void WindowManagerApp::AddConnection(WindowManagerServiceImpl* connection) {
92 DCHECK(connections_.find(connection) == connections_.end()); 84 DCHECK(connections_.find(connection) == connections_.end());
93 connections_.insert(connection); 85 connections_.insert(connection);
94 } 86 }
95 87
96 void WindowManagerApp::RemoveConnection(WindowManagerServiceImpl* connection) { 88 void WindowManagerApp::RemoveConnection(WindowManagerServiceImpl* connection) {
97 DCHECK(connections_.find(connection) != connections_.end()); 89 DCHECK(connections_.find(connection) != connections_.end());
98 connections_.erase(connection); 90 connections_.erase(connection);
99 } 91 }
100 92
101 Id WindowManagerApp::OpenWindow() {
102 View* view = View::Create(view_manager_);
103 root_->AddChild(view);
104 return view->id();
105 }
106
107 Id WindowManagerApp::OpenWindowWithURL(const String& url) {
108 View* view = View::Create(view_manager_);
109 root_->AddChild(view);
110 view->Embed(url);
111 return view->id();
112 }
113
114 void WindowManagerApp::SetCapture(Id view) { 93 void WindowManagerApp::SetCapture(Id view) {
115 capture_client_->capture_client()->SetCapture(GetWindowForViewId(view)); 94 capture_client_->capture_client()->SetCapture(GetWindowForViewId(view));
116 // TODO(beng): notify connected clients that capture has changed, probably 95 // TODO(beng): notify connected clients that capture has changed, probably
117 // by implementing some capture-client observer. 96 // by implementing some capture-client observer.
118 } 97 }
119 98
120 void WindowManagerApp::FocusWindow(Id view) { 99 void WindowManagerApp::FocusWindow(Id view) {
121 aura::Window* window = GetWindowForViewId(view); 100 aura::Window* window = GetWindowForViewId(view);
122 DCHECK(window); 101 DCHECK(window);
123 focus_client_->FocusWindow(window); 102 focus_client_->FocusWindow(window);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 DCHECK(it != view_id_to_window_map_.end()); 190 DCHECK(it != view_id_to_window_map_.end());
212 RegisterSubtree(params.target->id(), it->second); 191 RegisterSubtree(params.target->id(), it->second);
213 } 192 }
214 } else if (params.old_parent) { 193 } else if (params.old_parent) {
215 UnregisterSubtree(params.target->id()); 194 UnregisterSubtree(params.target->id());
216 } 195 }
217 } 196 }
218 197
219 void WindowManagerApp::OnViewDestroyed(View* view) { 198 void WindowManagerApp::OnViewDestroyed(View* view) {
220 root_ = NULL; 199 root_ = NULL;
200 STLDeleteValues(&view_id_to_window_map_);
201 if (focus_client_.get())
202 focus_client_->RemoveObserver(this);
203 if (activation_client_)
204 activation_client_->RemoveObserver(this);
221 window_tree_host_.reset(); 205 window_tree_host_.reset();
222 } 206 }
223 207
224 //////////////////////////////////////////////////////////////////////////////// 208 ////////////////////////////////////////////////////////////////////////////////
225 // WindowManagerApp, WindowTreeHostMojoDelegate implementation: 209 // WindowManagerApp, WindowTreeHostMojoDelegate implementation:
226 210
227 void WindowManagerApp::CompositorContentsChanged(const SkBitmap& bitmap) { 211 void WindowManagerApp::CompositorContentsChanged(const SkBitmap& bitmap) {
228 // We draw nothing. 212 // We draw nothing.
229 NOTREACHED(); 213 NOTREACHED();
230 } 214 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 ViewIdToWindowMap::iterator it = view_id_to_window_map_.find(id); 263 ViewIdToWindowMap::iterator it = view_id_to_window_map_.find(id);
280 DCHECK(it != view_id_to_window_map_.end()); 264 DCHECK(it != view_id_to_window_map_.end());
281 scoped_ptr<aura::Window> window(it->second); 265 scoped_ptr<aura::Window> window(it->second);
282 view_id_to_window_map_.erase(it); 266 view_id_to_window_map_.erase(it);
283 View::Children::const_iterator child = view->children().begin(); 267 View::Children::const_iterator child = view->children().begin();
284 for (; child != view->children().end(); ++child) 268 for (; child != view->children().end(); ++child)
285 UnregisterSubtree((*child)->id()); 269 UnregisterSubtree((*child)->id());
286 } 270 }
287 271
288 } // namespace mojo 272 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/window_manager/window_manager_app.h ('k') | mojo/services/window_manager/window_manager_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698