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/layout_test_content_handler_impl.h" | 5 #include "components/html_viewer/layout_test_content_handler_impl.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_application_delegate.h" | 9 #include "components/html_viewer/html_document_application_delegate.h" |
10 #include "components/html_viewer/html_widget.h" | 10 #include "components/html_viewer/html_widget.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 LayoutTestContentHandlerImpl::LayoutTestContentHandlerImpl( | 46 LayoutTestContentHandlerImpl::LayoutTestContentHandlerImpl( |
47 GlobalState* global_state, | 47 GlobalState* global_state, |
48 mojo::ApplicationImpl* app, | 48 mojo::ApplicationImpl* app, |
49 mojo::InterfaceRequest<mojo::ContentHandler> request, | 49 mojo::InterfaceRequest<mojo::ContentHandler> request, |
50 test_runner::WebTestInterfaces* test_interfaces, | 50 test_runner::WebTestInterfaces* test_interfaces, |
51 WebTestDelegateImpl* test_delegate) | 51 WebTestDelegateImpl* test_delegate) |
52 : ContentHandlerImpl(global_state, app, request.Pass()), | 52 : ContentHandlerImpl(global_state, app, request.Pass()), |
53 test_interfaces_(test_interfaces), | 53 test_interfaces_(test_interfaces), |
54 test_delegate_(test_delegate), | 54 test_delegate_(test_delegate), |
55 web_widget_proxy_(nullptr) {} | 55 web_widget_proxy_(nullptr), |
| 56 app_refcount_(app->app_lifetime_helper()->CreateAppRefCount()) {} |
56 | 57 |
57 LayoutTestContentHandlerImpl::~LayoutTestContentHandlerImpl() { | 58 LayoutTestContentHandlerImpl::~LayoutTestContentHandlerImpl() { |
58 } | 59 } |
59 | 60 |
60 void LayoutTestContentHandlerImpl::StartApplication( | 61 void LayoutTestContentHandlerImpl::StartApplication( |
61 mojo::InterfaceRequest<mojo::Application> request, | 62 mojo::InterfaceRequest<mojo::Application> request, |
62 mojo::URLResponsePtr response) { | 63 mojo::URLResponsePtr response, |
| 64 const mojo::Callback<void()>& destruct_callback) { |
63 test_interfaces_->SetTestIsRunning(true); | 65 test_interfaces_->SetTestIsRunning(true); |
64 test_interfaces_->ConfigureForTestWithURL(GURL(), false); | 66 test_interfaces_->ConfigureForTestWithURL(GURL(), false); |
65 | 67 |
66 // HTMLDocumentApplicationDelegate deletes itself. | 68 // HTMLDocumentApplicationDelegate deletes itself. |
67 HTMLDocumentApplicationDelegate* delegate = | 69 HTMLDocumentApplicationDelegate* delegate = |
68 new HTMLDocumentApplicationDelegate( | 70 new HTMLDocumentApplicationDelegate( |
69 request.Pass(), response.Pass(), global_state(), | 71 request.Pass(), response.Pass(), global_state(), |
70 app()->app_lifetime_helper()->CreateAppRefCount()); | 72 app()->app_lifetime_helper()->CreateAppRefCount(), |
| 73 destruct_callback); |
71 | 74 |
72 delegate->set_html_factory(this); | 75 delegate->set_html_factory(this); |
73 } | 76 } |
74 | 77 |
75 HTMLWidgetRootLocal* LayoutTestContentHandlerImpl::CreateHTMLWidgetRootLocal( | 78 HTMLWidgetRootLocal* LayoutTestContentHandlerImpl::CreateHTMLWidgetRootLocal( |
76 HTMLWidgetRootLocal::CreateParams* params) { | 79 HTMLWidgetRootLocal::CreateParams* params) { |
77 web_widget_proxy_ = new WebWidgetProxy(params); | 80 web_widget_proxy_ = new WebWidgetProxy(params); |
78 return web_widget_proxy_; | 81 return web_widget_proxy_; |
79 } | 82 } |
80 | 83 |
(...skipping 17 matching lines...) Expand all Loading... |
98 proxy->set_base_proxy(web_widget_proxy_); | 101 proxy->set_base_proxy(web_widget_proxy_); |
99 test_delegate_->set_test_proxy(web_widget_proxy_); | 102 test_delegate_->set_test_proxy(web_widget_proxy_); |
100 test_interfaces_->SetWebView(web_widget_proxy_->web_view(), | 103 test_interfaces_->SetWebView(web_widget_proxy_->web_view(), |
101 web_widget_proxy_); | 104 web_widget_proxy_); |
102 web_widget_proxy_->set_widget(web_widget_proxy_->web_view()); | 105 web_widget_proxy_->set_widget(web_widget_proxy_->web_view()); |
103 test_interfaces_->BindTo(web_widget_proxy_->web_view()->mainFrame()); | 106 test_interfaces_->BindTo(web_widget_proxy_->web_view()->mainFrame()); |
104 return proxy; | 107 return proxy; |
105 } | 108 } |
106 | 109 |
107 } // namespace html_viewer | 110 } // namespace html_viewer |
OLD | NEW |