OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.h" | 5 #include "components/html_viewer/html_document.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 void HTMLDocument::TransferableState::Move(TransferableState* other) { | 88 void HTMLDocument::TransferableState::Move(TransferableState* other) { |
89 owns_window_tree_connection = other->owns_window_tree_connection; | 89 owns_window_tree_connection = other->owns_window_tree_connection; |
90 root = other->root; | 90 root = other->root; |
91 window_tree_delegate_impl = std::move(other->window_tree_delegate_impl); | 91 window_tree_delegate_impl = std::move(other->window_tree_delegate_impl); |
92 | 92 |
93 other->root = nullptr; | 93 other->root = nullptr; |
94 other->owns_window_tree_connection = false; | 94 other->owns_window_tree_connection = false; |
95 } | 95 } |
96 | 96 |
97 HTMLDocument::HTMLDocument(mojo::ApplicationImpl* html_document_app, | 97 HTMLDocument::HTMLDocument(mojo::Shell* html_document_shell, |
98 mojo::ApplicationConnection* connection, | 98 mojo::ApplicationConnection* connection, |
99 mojo::URLResponsePtr response, | 99 mojo::URLResponsePtr response, |
100 GlobalState* global_state, | 100 GlobalState* global_state, |
101 const DeleteCallback& delete_callback, | 101 const DeleteCallback& delete_callback, |
102 HTMLFactory* factory) | 102 HTMLFactory* factory) |
103 : app_refcount_(html_document_app->app_lifetime_helper() | 103 : app_refcount_(html_document_shell->CreateAppRefCount()), |
104 ->CreateAppRefCount()), | 104 html_document_shell_(html_document_shell), |
105 html_document_app_(html_document_app), | |
106 connection_(connection), | 105 connection_(connection), |
107 global_state_(global_state), | 106 global_state_(global_state), |
108 frame_(nullptr), | 107 frame_(nullptr), |
109 delete_callback_(delete_callback), | 108 delete_callback_(delete_callback), |
110 factory_(factory) { | 109 factory_(factory) { |
111 connection->AddService<web_view::mojom::FrameClient>(this); | 110 connection->AddService<web_view::mojom::FrameClient>(this); |
112 connection->AddService<AxProvider>(this); | 111 connection->AddService<AxProvider>(this); |
113 connection->AddService<mus::mojom::WindowTreeClient>(this); | 112 connection->AddService<mus::mojom::WindowTreeClient>(this); |
114 connection->AddService<devtools_service::DevToolsAgent>(this); | 113 connection->AddService<devtools_service::DevToolsAgent>(this); |
115 if (IsTestInterfaceEnabled()) | 114 if (IsTestInterfaceEnabled()) |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 ax_providers_.insert(new AxProviderImpl( | 223 ax_providers_.insert(new AxProviderImpl( |
225 frame_->frame_tree_manager()->GetWebView(), std::move(*it))); | 224 frame_->frame_tree_manager()->GetWebView(), std::move(*it))); |
226 } | 225 } |
227 for (auto it : before_load_cache->test_interface_requests) { | 226 for (auto it : before_load_cache->test_interface_requests) { |
228 CHECK(IsTestInterfaceEnabled()); | 227 CHECK(IsTestInterfaceEnabled()); |
229 test_html_viewers_.push_back(new TestHTMLViewerImpl( | 228 test_html_viewers_.push_back(new TestHTMLViewerImpl( |
230 frame_->web_frame()->toWebLocalFrame(), std::move(*it))); | 229 frame_->web_frame()->toWebLocalFrame(), std::move(*it))); |
231 } | 230 } |
232 } | 231 } |
233 | 232 |
234 mojo::ApplicationImpl* HTMLDocument::GetApp() { | 233 mojo::Shell* HTMLDocument::GetShell() { |
235 return html_document_app_; | 234 return html_document_shell_; |
236 } | 235 } |
237 | 236 |
238 HTMLFactory* HTMLDocument::GetHTMLFactory() { | 237 HTMLFactory* HTMLDocument::GetHTMLFactory() { |
239 return factory_; | 238 return factory_; |
240 } | 239 } |
241 | 240 |
242 void HTMLDocument::OnFrameSwappedToRemote() { | 241 void HTMLDocument::OnFrameSwappedToRemote() { |
243 // When the frame becomes remote HTMLDocument is no longer needed. | 242 // When the frame becomes remote HTMLDocument is no longer needed. |
244 frame_ = nullptr; | 243 frame_ = nullptr; |
245 Destroy(); | 244 Destroy(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 DCHECK(!transferable_state_.window_tree_delegate_impl); | 324 DCHECK(!transferable_state_.window_tree_delegate_impl); |
326 transferable_state_.window_tree_delegate_impl.reset( | 325 transferable_state_.window_tree_delegate_impl.reset( |
327 new WindowTreeDelegateImpl(this)); | 326 new WindowTreeDelegateImpl(this)); |
328 transferable_state_.owns_window_tree_connection = true; | 327 transferable_state_.owns_window_tree_connection = true; |
329 mus::WindowTreeConnection::Create( | 328 mus::WindowTreeConnection::Create( |
330 transferable_state_.window_tree_delegate_impl.get(), std::move(request), | 329 transferable_state_.window_tree_delegate_impl.get(), std::move(request), |
331 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); | 330 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); |
332 } | 331 } |
333 | 332 |
334 } // namespace html_viewer | 333 } // namespace html_viewer |
OLD | NEW |