| 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 "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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void WindowManagerApp::AddConnection(WindowManagerServiceImpl* connection) { | 91 void WindowManagerApp::AddConnection(WindowManagerServiceImpl* connection) { |
| 92 DCHECK(connections_.find(connection) == connections_.end()); | 92 DCHECK(connections_.find(connection) == connections_.end()); |
| 93 connections_.insert(connection); | 93 connections_.insert(connection); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void WindowManagerApp::RemoveConnection(WindowManagerServiceImpl* connection) { | 96 void WindowManagerApp::RemoveConnection(WindowManagerServiceImpl* connection) { |
| 97 DCHECK(connections_.find(connection) != connections_.end()); | 97 DCHECK(connections_.find(connection) != connections_.end()); |
| 98 connections_.erase(connection); | 98 connections_.erase(connection); |
| 99 } | 99 } |
| 100 | 100 |
| 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) { | 101 void WindowManagerApp::SetCapture(Id view) { |
| 115 capture_client_->capture_client()->SetCapture(GetWindowForViewId(view)); | 102 capture_client_->capture_client()->SetCapture(GetWindowForViewId(view)); |
| 116 // TODO(beng): notify connected clients that capture has changed, probably | 103 // TODO(beng): notify connected clients that capture has changed, probably |
| 117 // by implementing some capture-client observer. | 104 // by implementing some capture-client observer. |
| 118 } | 105 } |
| 119 | 106 |
| 120 void WindowManagerApp::FocusWindow(Id view) { | 107 void WindowManagerApp::FocusWindow(Id view) { |
| 121 aura::Window* window = GetWindowForViewId(view); | 108 aura::Window* window = GetWindowForViewId(view); |
| 122 DCHECK(window); | 109 DCHECK(window); |
| 123 focus_client_->FocusWindow(window); | 110 focus_client_->FocusWindow(window); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 ViewIdToWindowMap::iterator it = view_id_to_window_map_.find(id); | 266 ViewIdToWindowMap::iterator it = view_id_to_window_map_.find(id); |
| 280 DCHECK(it != view_id_to_window_map_.end()); | 267 DCHECK(it != view_id_to_window_map_.end()); |
| 281 scoped_ptr<aura::Window> window(it->second); | 268 scoped_ptr<aura::Window> window(it->second); |
| 282 view_id_to_window_map_.erase(it); | 269 view_id_to_window_map_.erase(it); |
| 283 View::Children::const_iterator child = view->children().begin(); | 270 View::Children::const_iterator child = view->children().begin(); |
| 284 for (; child != view->children().end(); ++child) | 271 for (; child != view->children().end(); ++child) |
| 285 UnregisterSubtree((*child)->id()); | 272 UnregisterSubtree((*child)->id()); |
| 286 } | 273 } |
| 287 | 274 |
| 288 } // namespace mojo | 275 } // namespace mojo |
| OLD | NEW |