Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(958)

Side by Side Diff: apps/moterm/moterm_view.cc

Issue 1975993002: Change InterfaceFactory<I>::Create() to take a ConnectionContext instead of an ApplicationConnectio… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « apps/moterm/moterm_view.h ('k') | examples/apptest/example_service_application.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "apps/moterm/moterm_view.h" 5 #include "apps/moterm/moterm_view.h"
6 6
7 #ifndef GL_GLEXT_PROTOTYPES 7 #ifndef GL_GLEXT_PROTOTYPES
8 #define GL_GLEXT_PROTOTYPES 8 #define GL_GLEXT_PROTOTYPES
9 #endif 9 #endif
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 input_handler_(GetViewServiceProvider(), this), 46 input_handler_(GetViewServiceProvider(), this),
47 model_(MotermModel::Size(240, 160), MotermModel::Size(24, 80), this), 47 model_(MotermModel::Size(240, 160), MotermModel::Size(24, 80), this),
48 force_next_draw_(false), 48 force_next_draw_(false),
49 ascent_(0), 49 ascent_(0),
50 line_height_(0), 50 line_height_(0),
51 advance_width_(0), 51 advance_width_(0),
52 keypad_application_mode_(false) { 52 keypad_application_mode_(false) {
53 // TODO(vtl): |service_provider_impl_|'s ctor doesn't like an invalid request, 53 // TODO(vtl): |service_provider_impl_|'s ctor doesn't like an invalid request,
54 // so we have to conditionally, explicitly bind. 54 // so we have to conditionally, explicitly bind.
55 if (service_provider_request.is_pending()) { 55 if (service_provider_request.is_pending()) {
56 service_provider_impl_.Bind(service_provider_request.Pass()); 56 // TODO(vtl): The connection context should probably be plumbed here, which
57 // means that mojo::ui::ViewProviderApp::CreateView() should probably have a
58 // connection context argument.
59 service_provider_impl_.Bind(mojo::ConnectionContext(),
60 service_provider_request.Pass());
57 service_provider_impl_.AddService<mojo::terminal::Terminal>(this); 61 service_provider_impl_.AddService<mojo::terminal::Terminal>(this);
58 } 62 }
59 63
60 regular_typeface_ = skia::AdoptRef(SkTypeface::CreateFromStream( 64 regular_typeface_ = skia::AdoptRef(SkTypeface::CreateFromStream(
61 new SkMemoryStream(font_data::kDejaVuSansMonoRegular.data, 65 new SkMemoryStream(font_data::kDejaVuSansMonoRegular.data,
62 font_data::kDejaVuSansMonoRegular.size))); 66 font_data::kDejaVuSansMonoRegular.size)));
63 67
64 // TODO(vtl): This duplicates some code. 68 // TODO(vtl): This duplicates some code.
65 SkPaint fg_paint; 69 SkPaint fg_paint;
66 fg_paint.setTypeface(regular_typeface_.get()); 70 fg_paint.setTypeface(regular_typeface_.get());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void MotermView::OnDestroyed() { 127 void MotermView::OnDestroyed() {
124 DCHECK(!driver_); 128 DCHECK(!driver_);
125 if (!on_closed_callback_.is_null()) { 129 if (!on_closed_callback_.is_null()) {
126 mojo::Closure callback; 130 mojo::Closure callback;
127 std::swap(callback, on_closed_callback_); 131 std::swap(callback, on_closed_callback_);
128 callback.Run(); 132 callback.Run();
129 } 133 }
130 } 134 }
131 135
132 void MotermView::Create( 136 void MotermView::Create(
133 mojo::ApplicationConnection* connection, 137 const mojo::ConnectionContext& connection_context,
134 mojo::InterfaceRequest<mojo::terminal::Terminal> request) { 138 mojo::InterfaceRequest<mojo::terminal::Terminal> request) {
135 terminal_bindings_.AddBinding(this, request.Pass()); 139 terminal_bindings_.AddBinding(this, request.Pass());
136 } 140 }
137 141
138 void MotermView::Connect( 142 void MotermView::Connect(
139 mojo::InterfaceRequest<mojo::files::File> terminal_file, 143 mojo::InterfaceRequest<mojo::files::File> terminal_file,
140 bool force, 144 bool force,
141 const ConnectCallback& callback) { 145 const ConnectCallback& callback) {
142 if (driver_) { 146 if (driver_) {
143 // We already have a connection. 147 // We already have a connection.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 336
333 void MotermView::OnKeyPressed(mojo::EventPtr key_event) { 337 void MotermView::OnKeyPressed(mojo::EventPtr key_event) {
334 std::string input_sequence = 338 std::string input_sequence =
335 GetInputSequenceForKeyPressedEvent(*key_event, keypad_application_mode_); 339 GetInputSequenceForKeyPressedEvent(*key_event, keypad_application_mode_);
336 if (input_sequence.empty()) 340 if (input_sequence.empty())
337 return; 341 return;
338 342
339 if (driver_) 343 if (driver_)
340 driver_->SendData(input_sequence.data(), input_sequence.size()); 344 driver_->SendData(input_sequence.data(), input_sequence.size());
341 } 345 }
OLDNEW
« no previous file with comments | « apps/moterm/moterm_view.h ('k') | examples/apptest/example_service_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698