| OLD | NEW |
| 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 "components/html_viewer/html_viewer.h" | 5 #include "components/html_viewer/html_viewer.h" |
| 6 | 6 |
| 7 #include "components/html_viewer/content_handler_impl.h" | 7 #include "components/html_viewer/content_handler_impl.h" |
| 8 #include "components/html_viewer/global_state.h" | 8 #include "components/html_viewer/global_state.h" |
| 9 #include "mojo/application/public/cpp/application_connection.h" | 9 #include "mojo/application/public/cpp/application_connection.h" |
| 10 | 10 |
| 11 | |
| 12 namespace html_viewer { | 11 namespace html_viewer { |
| 13 | 12 |
| 14 HTMLViewer::HTMLViewer() : app_(nullptr) { | 13 HTMLViewer::HTMLViewer() : app_(nullptr) { |
| 15 } | 14 } |
| 16 | 15 |
| 17 HTMLViewer::~HTMLViewer() { | 16 HTMLViewer::~HTMLViewer() { |
| 18 } | 17 } |
| 19 | 18 |
| 20 void HTMLViewer::Initialize(mojo::ApplicationImpl* app) { | 19 void HTMLViewer::Initialize(mojo::ApplicationImpl* app) { |
| 21 app_ = app; | 20 app_ = app; |
| 22 global_state_.reset(new GlobalState(app)); | 21 global_state_.reset(new GlobalState(app)); |
| 23 } | 22 } |
| 24 | 23 |
| 25 bool HTMLViewer::ConfigureIncomingConnection( | 24 bool HTMLViewer::ConfigureIncomingConnection( |
| 26 mojo::ApplicationConnection* connection) { | 25 mojo::ApplicationConnection* connection) { |
| 27 connection->AddService(this); | 26 connection->AddService(this); |
| 28 return true; | 27 return true; |
| 29 } | 28 } |
| 30 | 29 |
| 31 void HTMLViewer::Create( | 30 void HTMLViewer::Create( |
| 32 mojo::ApplicationConnection* connection, | 31 mojo::ApplicationConnection* connection, |
| 33 mojo::InterfaceRequest<mojo::ContentHandler> request) { | 32 mojo::InterfaceRequest<mojo::ContentHandler> request) { |
| 34 new ContentHandlerImpl(global_state_.get(), app_, request.Pass()); | 33 new ContentHandlerImpl(global_state_.get(), app_, request.Pass()); |
| 35 } | 34 } |
| 36 | 35 |
| 37 } // namespace html_viewer | 36 } // namespace html_viewer |
| OLD | NEW |