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_document_application_delegate.h" | 5 #include "components/html_viewer/html_document_application_delegate.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 "components/html_viewer/global_state.h" | 9 #include "components/html_viewer/global_state.h" |
10 #include "components/html_viewer/html_document_oopif.h" | 10 #include "components/html_viewer/html_document_oopif.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void HTMLDocumentApplicationDelegate::OnTerminate() { | 110 void HTMLDocumentApplicationDelegate::OnTerminate() { |
111 delete this; | 111 delete this; |
112 } | 112 } |
113 | 113 |
114 // ApplicationDelegate; | 114 // ApplicationDelegate; |
115 void HTMLDocumentApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { | 115 void HTMLDocumentApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { |
116 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 116 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
117 request->url = mojo::String::From("mojo:network_service"); | 117 request->url = mojo::String::From("mojo:network_service"); |
118 scoped_ptr<mojo::ApplicationConnection> connection = | 118 scoped_ptr<mojo::ApplicationConnection> connection = |
119 app_.ConnectToApplication(request.Pass()); | 119 app_.ConnectToApplication(request.Pass()); |
120 connection->ConnectToService(&network_service_); | |
121 connection->ConnectToService(&url_loader_factory_); | 120 connection->ConnectToService(&url_loader_factory_); |
122 } | 121 } |
123 | 122 |
124 bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( | 123 bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( |
125 mojo::ApplicationConnection* connection) { | 124 mojo::ApplicationConnection* connection) { |
126 if (initial_response_) { | 125 if (initial_response_) { |
127 OnResponseReceived(mojo::URLLoaderPtr(), connection, nullptr, | 126 OnResponseReceived(mojo::URLLoaderPtr(), connection, nullptr, |
128 initial_response_.Pass()); | 127 initial_response_.Pass()); |
129 } else { | 128 } else { |
130 // HTMLDocument provides services, but is created asynchronously. Queue up | 129 // HTMLDocument provides services, but is created asynchronously. Queue up |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 documents_.insert(document); | 185 documents_.insert(document); |
187 } | 186 } |
188 | 187 |
189 if (connector_queue) { | 188 if (connector_queue) { |
190 connector_queue->PushRequestsTo(connection); | 189 connector_queue->PushRequestsTo(connection); |
191 connection->SetServiceConnector(nullptr); | 190 connection->SetServiceConnector(nullptr); |
192 } | 191 } |
193 } | 192 } |
194 | 193 |
195 } // namespace html_viewer | 194 } // namespace html_viewer |
OLD | NEW |