| 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/view_manager/root_view_manager.h" | 5 #include "mojo/services/view_manager/root_view_manager.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
| 9 #include "mojo/public/cpp/application/application_connection.h" | 9 #include "mojo/public/cpp/application/application_connection.h" |
| 10 #include "mojo/services/view_manager/root_node_manager.h" | 10 #include "mojo/services/view_manager/root_node_manager.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 aura::Window* window_; | 112 aura::Window* window_; |
| 113 | 113 |
| 114 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | 114 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl); | 116 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 RootViewManager::RootViewManager(ApplicationConnection* app_connection, | 119 RootViewManager::RootViewManager( |
| 120 RootNodeManager* root_node, | 120 ApplicationConnection* app_connection, |
| 121 RootViewManagerDelegate* delegate) | 121 RootNodeManager* root_node, |
| 122 RootViewManagerDelegate* delegate, |
| 123 const Callback<void()>& native_viewport_closed_callback) |
| 122 : delegate_(delegate), | 124 : delegate_(delegate), |
| 123 root_node_manager_(root_node), | 125 root_node_manager_(root_node), |
| 124 in_setup_(false) { | 126 in_setup_(false) { |
| 125 screen_.reset(ScreenImpl::Create()); | 127 screen_.reset(ScreenImpl::Create()); |
| 126 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 128 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); |
| 127 NativeViewportPtr viewport; | 129 NativeViewportPtr viewport; |
| 128 app_connection->ConnectToService( | 130 app_connection->ConnectToService( |
| 129 "mojo:mojo_native_viewport_service", &viewport); | 131 "mojo:mojo_native_viewport_service", &viewport); |
| 130 window_tree_host_.reset(new WindowTreeHostImpl( | 132 window_tree_host_.reset(new WindowTreeHostImpl( |
| 131 viewport.Pass(), | 133 viewport.Pass(), |
| 132 gfx::Rect(800, 600), | 134 gfx::Rect(800, 600), |
| 133 base::Bind(&RootViewManager::OnCompositorCreated, | 135 base::Bind(&RootViewManager::OnCompositorCreated, |
| 134 base::Unretained(this)))); | 136 base::Unretained(this)), |
| 137 native_viewport_closed_callback)); |
| 135 } | 138 } |
| 136 | 139 |
| 137 RootViewManager::~RootViewManager() { | 140 RootViewManager::~RootViewManager() { |
| 138 window_tree_client_.reset(); | 141 window_tree_client_.reset(); |
| 139 window_tree_host_.reset(); | 142 window_tree_host_.reset(); |
| 140 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); | 143 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); |
| 141 } | 144 } |
| 142 | 145 |
| 143 void RootViewManager::OnCompositorCreated() { | 146 void RootViewManager::OnCompositorCreated() { |
| 144 base::AutoReset<bool> resetter(&in_setup_, true); | 147 base::AutoReset<bool> resetter(&in_setup_, true); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 158 focus_client_->AddObserver(root_node_manager_); | 161 focus_client_->AddObserver(root_node_manager_); |
| 159 | 162 |
| 160 window_tree_host_->Show(); | 163 window_tree_host_->Show(); |
| 161 | 164 |
| 162 delegate_->OnRootViewManagerWindowTreeHostCreated(); | 165 delegate_->OnRootViewManagerWindowTreeHostCreated(); |
| 163 } | 166 } |
| 164 | 167 |
| 165 } // namespace service | 168 } // namespace service |
| 166 } // namespace view_manager | 169 } // namespace view_manager |
| 167 } // namespace mojo | 170 } // namespace mojo |
| OLD | NEW |