OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/launcher/launch_instance.h" | 5 #include "services/ui/launcher/launch_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 viewport_event_dispatcher_binding_.Bind(GetProxy(&dispatcher)); | 55 viewport_event_dispatcher_binding_.Bind(GetProxy(&dispatcher)); |
56 viewport_->SetEventDispatcher(dispatcher.Pass()); | 56 viewport_->SetEventDispatcher(dispatcher.Pass()); |
57 | 57 |
58 // Match the Nexus 5 aspect ratio initially. | 58 // Match the Nexus 5 aspect ratio initially. |
59 auto size = mojo::Size::New(); | 59 auto size = mojo::Size::New(); |
60 size->width = 320; | 60 size->width = 320; |
61 size->height = 640; | 61 size->height = 640; |
62 | 62 |
63 auto requested_configuration = mojo::SurfaceConfiguration::New(); | 63 auto requested_configuration = mojo::SurfaceConfiguration::New(); |
64 viewport_->Create( | 64 viewport_->Create( |
65 size.Clone(), requested_configuration.Pass(), | 65 size.Pass(), requested_configuration.Pass(), |
66 base::Bind(&LaunchInstance::OnViewportCreated, base::Unretained(this))); | 66 base::Bind(&LaunchInstance::OnViewportCreated, base::Unretained(this))); |
67 } | 67 } |
68 | 68 |
69 void LaunchInstance::OnViewportConnectionError() { | 69 void LaunchInstance::OnViewportConnectionError() { |
70 LOG(ERROR) << "Exiting due to viewport connection error."; | 70 LOG(ERROR) << "Exiting due to viewport connection error."; |
71 shutdown_callback_.Run(); | 71 shutdown_callback_.Run(); |
72 } | 72 } |
73 | 73 |
74 void LaunchInstance::OnViewportCreated(mojo::ViewportMetricsPtr metrics) { | 74 void LaunchInstance::OnViewportCreated(mojo::ViewportMetricsPtr metrics) { |
75 viewport_->Show(); | 75 viewport_->Show(); |
(...skipping 23 matching lines...) Expand all Loading... |
99 } | 99 } |
100 | 100 |
101 void LaunchInstance::OnEvent(mojo::EventPtr event, | 101 void LaunchInstance::OnEvent(mojo::EventPtr event, |
102 const mojo::Callback<void()>& callback) { | 102 const mojo::Callback<void()>& callback) { |
103 if (view_tree_) | 103 if (view_tree_) |
104 view_tree_->DispatchEvent(event.Pass()); | 104 view_tree_->DispatchEvent(event.Pass()); |
105 callback.Run(); | 105 callback.Run(); |
106 } | 106 } |
107 | 107 |
108 } // namespace launcher | 108 } // namespace launcher |
OLD | NEW |