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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // when we quit (the messageloop is shared among multiple | 108 // when we quit (the messageloop is shared among multiple |
109 // HTMLDocumentApplicationDelegates). | 109 // HTMLDocumentApplicationDelegates). |
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 mojo::ApplicationConnection* connection = | 118 scoped_ptr<mojo::ApplicationConnection> connection = |
119 app_.ConnectToApplication(request.Pass()); | 119 app_.ConnectToApplication(request.Pass()); |
120 connection->ConnectToService(&network_service_); | 120 connection->ConnectToService(&network_service_); |
121 connection->ConnectToService(&url_loader_factory_); | 121 connection->ConnectToService(&url_loader_factory_); |
122 } | 122 } |
123 | 123 |
124 bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( | 124 bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( |
125 mojo::ApplicationConnection* connection) { | 125 mojo::ApplicationConnection* connection) { |
126 if (initial_response_) { | 126 if (initial_response_) { |
127 OnResponseReceived(mojo::URLLoaderPtr(), connection, nullptr, | 127 OnResponseReceived(mojo::URLLoaderPtr(), connection, nullptr, |
128 initial_response_.Pass()); | 128 initial_response_.Pass()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 documents_.insert(document); | 186 documents_.insert(document); |
187 } | 187 } |
188 | 188 |
189 if (connector_queue) { | 189 if (connector_queue) { |
190 connector_queue->PushRequestsTo(connection); | 190 connector_queue->PushRequestsTo(connection); |
191 connection->SetServiceConnector(nullptr); | 191 connection->SetServiceConnector(nullptr); |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 } // namespace html_viewer | 195 } // namespace html_viewer |
OLD | NEW |