Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: components/html_viewer/layout_test_content_handler_impl.cc

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 30 matching lines...) Expand all
41 test_interfaces_->BindTo(frame); 41 test_interfaces_->BindTo(frame);
42 } 42 }
43 43
44 test_runner::WebTestInterfaces* test_interfaces_; 44 test_runner::WebTestInterfaces* test_interfaces_;
45 45
46 DISALLOW_COPY_AND_ASSIGN(TestHTMLFrame); 46 DISALLOW_COPY_AND_ASSIGN(TestHTMLFrame);
47 }; 47 };
48 48
49 LayoutTestContentHandlerImpl::LayoutTestContentHandlerImpl( 49 LayoutTestContentHandlerImpl::LayoutTestContentHandlerImpl(
50 GlobalState* global_state, 50 GlobalState* global_state,
51 mojo::ApplicationImpl* app, 51 mojo::Shell* shell,
52 mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request, 52 mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request,
53 test_runner::WebTestInterfaces* test_interfaces, 53 test_runner::WebTestInterfaces* test_interfaces,
54 WebTestDelegateImpl* test_delegate) 54 WebTestDelegateImpl* test_delegate)
55 : ContentHandlerImpl(global_state, app, std::move(request)), 55 : ContentHandlerImpl(global_state, shell, std::move(request)),
56 test_interfaces_(test_interfaces), 56 test_interfaces_(test_interfaces),
57 test_delegate_(test_delegate), 57 test_delegate_(test_delegate),
58 web_widget_proxy_(nullptr), 58 web_widget_proxy_(nullptr),
59 app_refcount_(app->app_lifetime_helper()->CreateAppRefCount()) {} 59 app_refcount_(shell->CreateAppRefCount()) {}
60 60
61 LayoutTestContentHandlerImpl::~LayoutTestContentHandlerImpl() { 61 LayoutTestContentHandlerImpl::~LayoutTestContentHandlerImpl() {
62 } 62 }
63 63
64 void LayoutTestContentHandlerImpl::StartApplication( 64 void LayoutTestContentHandlerImpl::StartApplication(
65 mojo::ApplicationRequest request, 65 mojo::ApplicationRequest request,
66 mojo::URLResponsePtr response, 66 mojo::URLResponsePtr response,
67 const mojo::Callback<void()>& destruct_callback) { 67 const mojo::Callback<void()>& destruct_callback) {
68 test_interfaces_->SetTestIsRunning(true); 68 test_interfaces_->SetTestIsRunning(true);
69 test_interfaces_->ConfigureForTestWithURL(GURL(), false); 69 test_interfaces_->ConfigureForTestWithURL(GURL(), false);
70 70
71 // HTMLDocumentApplicationDelegate deletes itself. 71 // HTMLDocumentApplicationDelegate deletes itself.
72 HTMLDocumentApplicationDelegate* delegate = 72 HTMLDocumentApplicationDelegate* delegate =
73 new HTMLDocumentApplicationDelegate( 73 new HTMLDocumentApplicationDelegate(
74 std::move(request), std::move(response), global_state(), 74 std::move(request), std::move(response), global_state(),
75 app()->app_lifetime_helper()->CreateAppRefCount(), destruct_callback); 75 shell()->CreateAppRefCount(), destruct_callback);
76 76
77 delegate->set_html_factory(this); 77 delegate->set_html_factory(this);
78 } 78 }
79 79
80 HTMLWidgetRootLocal* LayoutTestContentHandlerImpl::CreateHTMLWidgetRootLocal( 80 HTMLWidgetRootLocal* LayoutTestContentHandlerImpl::CreateHTMLWidgetRootLocal(
81 HTMLWidgetRootLocal::CreateParams* params) { 81 HTMLWidgetRootLocal::CreateParams* params) {
82 web_widget_proxy_ = new WebWidgetProxy(params); 82 web_widget_proxy_ = new WebWidgetProxy(params);
83 return web_widget_proxy_; 83 return web_widget_proxy_;
84 } 84 }
85 85
(...skipping 17 matching lines...) Expand all
103 proxy->set_base_proxy(web_widget_proxy_); 103 proxy->set_base_proxy(web_widget_proxy_);
104 test_delegate_->set_test_proxy(web_widget_proxy_); 104 test_delegate_->set_test_proxy(web_widget_proxy_);
105 test_interfaces_->SetWebView(web_widget_proxy_->web_view(), 105 test_interfaces_->SetWebView(web_widget_proxy_->web_view(),
106 web_widget_proxy_); 106 web_widget_proxy_);
107 web_widget_proxy_->set_widget(web_widget_proxy_->web_view()); 107 web_widget_proxy_->set_widget(web_widget_proxy_->web_view());
108 test_interfaces_->BindTo(web_widget_proxy_->web_view()->mainFrame()); 108 test_interfaces_->BindTo(web_widget_proxy_->web_view()->mainFrame());
109 return proxy; 109 return proxy;
110 } 110 }
111 111
112 } // namespace html_viewer 112 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/layout_test_content_handler_impl.h ('k') | components/html_viewer/layout_test_html_viewer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698