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/display_manager.h" | 5 #include "mojo/services/view_manager/display_manager.h" |
6 | 6 |
7 #include "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
8 #include "cc/surfaces/surface_id_allocator.h" | 8 #include "cc/surfaces/surface_id_allocator.h" |
9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
10 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 10 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 DisplayManager::DisplayManager( | 71 DisplayManager::DisplayManager( |
72 ApplicationConnection* app_connection, | 72 ApplicationConnection* app_connection, |
73 ConnectionManager* connection_manager, | 73 ConnectionManager* connection_manager, |
74 const Callback<void()>& native_viewport_closed_callback) | 74 const Callback<void()>& native_viewport_closed_callback) |
75 : connection_manager_(connection_manager), | 75 : connection_manager_(connection_manager), |
76 in_setup_(false), | 76 in_setup_(false), |
77 size_(800, 600), | 77 size_(800, 600), |
78 draw_timer_(false, false), | 78 draw_timer_(false, false), |
79 weak_factory_(this) { | 79 weak_factory_(this) { |
80 app_connection->ConnectToService("mojo:mojo_native_viewport_service", | 80 app_connection->ConnectToService("mojo:native_viewport_service", |
81 &native_viewport_); | 81 &native_viewport_); |
82 native_viewport_.set_client(this); | 82 native_viewport_.set_client(this); |
83 native_viewport_->Create( | 83 native_viewport_->Create( |
84 Size::From(size_), | 84 Size::From(size_), |
85 base::Bind(&DisplayManager::OnCreatedNativeViewport, | 85 base::Bind(&DisplayManager::OnCreatedNativeViewport, |
86 weak_factory_.GetWeakPtr())); | 86 weak_factory_.GetWeakPtr())); |
87 native_viewport_->Show(); | 87 native_viewport_->Show(); |
88 app_connection->ConnectToService("mojo:mojo_surfaces_service", | 88 app_connection->ConnectToService("mojo:surfaces_service", &surfaces_service_); |
89 &surfaces_service_); | |
90 surfaces_service_->CreateSurfaceConnection(base::Bind( | 89 surfaces_service_->CreateSurfaceConnection(base::Bind( |
91 &DisplayManager::OnSurfaceConnectionCreated, weak_factory_.GetWeakPtr())); | 90 &DisplayManager::OnSurfaceConnectionCreated, weak_factory_.GetWeakPtr())); |
92 } | 91 } |
93 | 92 |
94 DisplayManager::~DisplayManager() { | 93 DisplayManager::~DisplayManager() { |
95 } | 94 } |
96 | 95 |
97 void DisplayManager::SchedulePaint(const ServerView* view, | 96 void DisplayManager::SchedulePaint(const ServerView* view, |
98 const gfx::Rect& bounds) { | 97 const gfx::Rect& bounds) { |
99 if (!view->visible()) | 98 if (!view->visible()) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 connection_manager_->DispatchViewInputEventToDelegate(event.Pass()); | 162 connection_manager_->DispatchViewInputEventToDelegate(event.Pass()); |
164 callback.Run(); | 163 callback.Run(); |
165 } | 164 } |
166 | 165 |
167 void DisplayManager::ReturnResources(Array<ReturnedResourcePtr> resources) { | 166 void DisplayManager::ReturnResources(Array<ReturnedResourcePtr> resources) { |
168 DCHECK_EQ(0u, resources.size()); | 167 DCHECK_EQ(0u, resources.size()); |
169 } | 168 } |
170 | 169 |
171 } // namespace service | 170 } // namespace service |
172 } // namespace mojo | 171 } // namespace mojo |
OLD | NEW |