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 "components/html_viewer/global_state.h" | 8 #include "components/html_viewer/global_state.h" |
9 #include "components/html_viewer/html_document.h" | 9 #include "components/html_viewer/html_document.h" |
10 #include "mojo/application/public/cpp/application_connection.h" | 10 #include "mojo/application/public/cpp/application_connection.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Callback from the quit closure. We key off this rather than | 84 // Callback from the quit closure. We key off this rather than |
85 // ApplicationDelegate::Quit() as we don't want to shut down the messageloop | 85 // ApplicationDelegate::Quit() as we don't want to shut down the messageloop |
86 // when we quit (the messageloop is shared among multiple | 86 // when we quit (the messageloop is shared among multiple |
87 // HTMLDocumentApplicationDelegates). | 87 // HTMLDocumentApplicationDelegates). |
88 void HTMLDocumentApplicationDelegate::OnTerminate() { | 88 void HTMLDocumentApplicationDelegate::OnTerminate() { |
89 delete this; | 89 delete this; |
90 } | 90 } |
91 | 91 |
92 // ApplicationDelegate; | 92 // ApplicationDelegate; |
93 void HTMLDocumentApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { | 93 void HTMLDocumentApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { |
94 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 94 app_.ConnectToService("mojo:network_service", &url_loader_factory_); |
95 request->url = mojo::String::From("mojo:network_service"); | |
96 scoped_ptr<mojo::ApplicationConnection> connection = | |
97 app_.ConnectToApplication(request.Pass()); | |
98 connection->ConnectToService(&url_loader_factory_); | |
99 } | 95 } |
100 | 96 |
101 bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( | 97 bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( |
102 mojo::ApplicationConnection* connection) { | 98 mojo::ApplicationConnection* connection) { |
103 if (initial_response_) { | 99 if (initial_response_) { |
104 OnResponseReceived(nullptr, mojo::URLLoaderPtr(), connection, nullptr, | 100 OnResponseReceived(nullptr, mojo::URLLoaderPtr(), connection, nullptr, |
105 initial_response_.Pass()); | 101 initial_response_.Pass()); |
106 } else if (url_ == "about:blank") { | 102 } else if (url_ == "about:blank") { |
107 // This is a little unfortunate. At the browser side, when starting a new | 103 // This is a little unfortunate. At the browser side, when starting a new |
108 // app for "about:blank", the application manager uses | 104 // app for "about:blank", the application manager uses |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 HTMLFrame::CreateParams* params) { | 175 HTMLFrame::CreateParams* params) { |
180 return new HTMLFrame(params); | 176 return new HTMLFrame(params); |
181 } | 177 } |
182 | 178 |
183 HTMLWidgetRootLocal* HTMLDocumentApplicationDelegate::CreateHTMLWidgetRootLocal( | 179 HTMLWidgetRootLocal* HTMLDocumentApplicationDelegate::CreateHTMLWidgetRootLocal( |
184 HTMLWidgetRootLocal::CreateParams* params) { | 180 HTMLWidgetRootLocal::CreateParams* params) { |
185 return new HTMLWidgetRootLocal(params); | 181 return new HTMLWidgetRootLocal(params); |
186 } | 182 } |
187 | 183 |
188 } // namespace html_viewer | 184 } // namespace html_viewer |
OLD | NEW |