| 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/public/interfaces/gpu/gpu.mojom.h" | |
| 11 #include "mojo/services/view_manager/root_node_manager.h" | 10 #include "mojo/services/view_manager/root_node_manager.h" |
| 12 #include "mojo/services/view_manager/root_view_manager_delegate.h" | 11 #include "mojo/services/view_manager/root_view_manager_delegate.h" |
| 13 #include "mojo/services/view_manager/screen_impl.h" | 12 #include "mojo/services/view_manager/screen_impl.h" |
| 14 #include "mojo/services/view_manager/window_tree_host_impl.h" | 13 #include "mojo/services/view_manager/window_tree_host_impl.h" |
| 15 #include "ui/aura/client/default_capture_client.h" | 14 #include "ui/aura/client/default_capture_client.h" |
| 16 #include "ui/aura/client/focus_client.h" | 15 #include "ui/aura/client/focus_client.h" |
| 17 #include "ui/aura/client/window_tree_client.h" | 16 #include "ui/aura/client/window_tree_client.h" |
| 18 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
| 19 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 20 | 19 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 RootViewManagerDelegate* delegate, | 74 RootViewManagerDelegate* delegate, |
| 76 const Callback<void()>& native_viewport_closed_callback) | 75 const Callback<void()>& native_viewport_closed_callback) |
| 77 : delegate_(delegate), | 76 : delegate_(delegate), |
| 78 root_node_manager_(root_node), | 77 root_node_manager_(root_node), |
| 79 in_setup_(false) { | 78 in_setup_(false) { |
| 80 screen_.reset(ScreenImpl::Create()); | 79 screen_.reset(ScreenImpl::Create()); |
| 81 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 80 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); |
| 82 NativeViewportPtr viewport; | 81 NativeViewportPtr viewport; |
| 83 app_connection->ConnectToService( | 82 app_connection->ConnectToService( |
| 84 "mojo:mojo_native_viewport_service", &viewport); | 83 "mojo:mojo_native_viewport_service", &viewport); |
| 85 GpuPtr gpu_service; | |
| 86 // TODO(jamesr): Should be mojo:mojo_gpu_service | |
| 87 app_connection->ConnectToService("mojo:mojo_native_viewport_service", | |
| 88 &gpu_service); | |
| 89 window_tree_host_.reset(new WindowTreeHostImpl( | 84 window_tree_host_.reset(new WindowTreeHostImpl( |
| 90 viewport.Pass(), | 85 viewport.Pass(), |
| 91 gpu_service.Pass(), | 86 gfx::Rect(800, 600), |
| 92 gfx::Rect(800, 600), | 87 base::Bind(&RootViewManager::OnCompositorCreated, |
| 93 base::Bind(&RootViewManager::OnCompositorCreated, base::Unretained(this)), | 88 base::Unretained(this)), |
| 94 native_viewport_closed_callback, | 89 native_viewport_closed_callback, |
| 95 base::Bind(&RootNodeManager::DispatchNodeInputEventToWindowManager, | 90 base::Bind(&RootNodeManager::DispatchNodeInputEventToWindowManager, |
| 96 base::Unretained(root_node_manager_)))); | 91 base::Unretained(root_node_manager_)))); |
| 97 } | 92 } |
| 98 | 93 |
| 99 RootViewManager::~RootViewManager() { | 94 RootViewManager::~RootViewManager() { |
| 100 window_tree_client_.reset(); | 95 window_tree_client_.reset(); |
| 101 window_tree_host_.reset(); | 96 window_tree_host_.reset(); |
| 102 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); | 97 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); |
| 103 } | 98 } |
| 104 | 99 |
| 105 void RootViewManager::OnCompositorCreated() { | 100 void RootViewManager::OnCompositorCreated() { |
| 106 base::AutoReset<bool> resetter(&in_setup_, true); | 101 base::AutoReset<bool> resetter(&in_setup_, true); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 118 aura::client::SetFocusClient(window_tree_host_->window(), | 113 aura::client::SetFocusClient(window_tree_host_->window(), |
| 119 focus_client_.get()); | 114 focus_client_.get()); |
| 120 | 115 |
| 121 window_tree_host_->Show(); | 116 window_tree_host_->Show(); |
| 122 | 117 |
| 123 delegate_->OnRootViewManagerWindowTreeHostCreated(); | 118 delegate_->OnRootViewManagerWindowTreeHostCreated(); |
| 124 } | 119 } |
| 125 | 120 |
| 126 } // namespace service | 121 } // namespace service |
| 127 } // namespace mojo | 122 } // namespace mojo |
| OLD | NEW |