| 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_oopif.h" | 5 #include "components/html_viewer/html_document_oopif.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "components/devtools_service/public/cpp/switches.h" | 13 #include "components/devtools_service/public/cpp/switches.h" |
| 14 #include "components/html_viewer/blink_url_request_type_converters.h" | 14 #include "components/html_viewer/blink_url_request_type_converters.h" |
| 15 #include "components/html_viewer/devtools_agent_impl.h" | 15 #include "components/html_viewer/devtools_agent_impl.h" |
| 16 #include "components/html_viewer/document_resource_waiter.h" | 16 #include "components/html_viewer/document_resource_waiter.h" |
| 17 #include "components/html_viewer/frame.h" | |
| 18 #include "components/html_viewer/frame_tree_manager.h" | |
| 19 #include "components/html_viewer/global_state.h" | 17 #include "components/html_viewer/global_state.h" |
| 18 #include "components/html_viewer/html_frame.h" |
| 19 #include "components/html_viewer/html_frame_tree_manager.h" |
| 20 #include "components/html_viewer/test_html_viewer_impl.h" | 20 #include "components/html_viewer/test_html_viewer_impl.h" |
| 21 #include "components/html_viewer/web_url_loader_impl.h" | 21 #include "components/html_viewer/web_url_loader_impl.h" |
| 22 #include "components/view_manager/ids.h" | 22 #include "components/view_manager/ids.h" |
| 23 #include "components/view_manager/public/cpp/view.h" | 23 #include "components/view_manager/public/cpp/view.h" |
| 24 #include "components/view_manager/public/cpp/view_manager.h" | 24 #include "components/view_manager/public/cpp/view_manager.h" |
| 25 #include "mojo/application/public/cpp/application_impl.h" | 25 #include "mojo/application/public/cpp/application_impl.h" |
| 26 #include "mojo/application/public/cpp/connect.h" | 26 #include "mojo/application/public/cpp/connect.h" |
| 27 #include "mojo/application/public/interfaces/shell.mojom.h" | 27 #include "mojo/application/public/interfaces/shell.mojom.h" |
| 28 #include "mojo/converters/geometry/geometry_type_converters.h" | 28 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 29 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 29 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 mandoline::FrameTreeServerPtr frame_tree_server; | 132 mandoline::FrameTreeServerPtr frame_tree_server; |
| 133 mojo::Array<mandoline::FrameDataPtr> frame_data; | 133 mojo::Array<mandoline::FrameDataPtr> frame_data; |
| 134 mojo::URLResponsePtr response; | 134 mojo::URLResponsePtr response; |
| 135 resource_waiter_->Release(&frame_tree_client_request, &frame_tree_server, | 135 resource_waiter_->Release(&frame_tree_client_request, &frame_tree_server, |
| 136 &frame_data, &response); | 136 &frame_data, &response); |
| 137 resource_waiter_.reset(); | 137 resource_waiter_.reset(); |
| 138 | 138 |
| 139 view->RemoveObserver(this); | 139 view->RemoveObserver(this); |
| 140 | 140 |
| 141 frame_tree_manager_.reset( | 141 frame_tree_manager_.reset( |
| 142 new FrameTreeManager(global_state_, html_document_app_, connection_, | 142 new HTMLFrameTreeManager(global_state_, html_document_app_, connection_, |
| 143 view->id(), frame_tree_server.Pass())); | 143 view->id(), frame_tree_server.Pass())); |
| 144 frame_tree_manager_->set_delegate(this); | 144 frame_tree_manager_->set_delegate(this); |
| 145 frame_tree_manager_binding_.reset( | 145 frame_tree_manager_binding_.reset( |
| 146 new mojo::Binding<mandoline::FrameTreeClient>( | 146 new mojo::Binding<mandoline::FrameTreeClient>( |
| 147 frame_tree_manager_.get(), frame_tree_client_request.Pass())); | 147 frame_tree_manager_.get(), frame_tree_client_request.Pass())); |
| 148 frame_tree_manager_->Init(view, frame_data.Pass()); | 148 frame_tree_manager_->Init(view, frame_data.Pass()); |
| 149 | 149 |
| 150 // TODO(yzshen): http://crbug.com/498986 Creating DevToolsAgentImpl instances | 150 // TODO(yzshen): http://crbug.com/498986 Creating DevToolsAgentImpl instances |
| 151 // causes html_viewer_apptests flakiness currently. Before we fix that we | 151 // causes html_viewer_apptests flakiness currently. Before we fix that we |
| 152 // cannot enable remote debugging (which is required by Telemetry tests) on | 152 // cannot enable remote debugging (which is required by Telemetry tests) on |
| 153 // the bots. | 153 // the bots. |
| 154 if (EnableRemoteDebugging()) { | 154 if (EnableRemoteDebugging()) { |
| 155 Frame* frame = frame_tree_manager_->GetLocalFrame(); | 155 HTMLFrame* frame = frame_tree_manager_->GetLocalFrame(); |
| 156 if (!frame->parent()) { | 156 if (!frame->parent()) { |
| 157 devtools_agent_.reset(new DevToolsAgentImpl( | 157 devtools_agent_.reset(new DevToolsAgentImpl( |
| 158 frame->web_frame()->toWebLocalFrame(), html_document_app_->shell())); | 158 frame->web_frame()->toWebLocalFrame(), html_document_app_->shell())); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 WebURLRequestExtraData* extra_data = new WebURLRequestExtraData; | 162 WebURLRequestExtraData* extra_data = new WebURLRequestExtraData; |
| 163 extra_data->synthetic_response = response.Pass(); | 163 extra_data->synthetic_response = response.Pass(); |
| 164 | 164 |
| 165 const GURL url(extra_data->synthetic_response->url); | 165 const GURL url(extra_data->synthetic_response->url); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 void HTMLDocumentOOPIF::OnViewDestroyed(View* view) { | 202 void HTMLDocumentOOPIF::OnViewDestroyed(View* view) { |
| 203 resource_waiter_->root()->RemoveObserver(this); | 203 resource_waiter_->root()->RemoveObserver(this); |
| 204 resource_waiter_->set_root(nullptr); | 204 resource_waiter_->set_root(nullptr); |
| 205 } | 205 } |
| 206 | 206 |
| 207 bool HTMLDocumentOOPIF::ShouldNavigateLocallyInMainFrame() { | 207 bool HTMLDocumentOOPIF::ShouldNavigateLocallyInMainFrame() { |
| 208 return devtools_agent_ && devtools_agent_->handling_page_navigate_request(); | 208 return devtools_agent_ && devtools_agent_->handling_page_navigate_request(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void HTMLDocumentOOPIF::OnFrameDidFinishLoad(Frame* frame) { | 211 void HTMLDocumentOOPIF::OnFrameDidFinishLoad(HTMLFrame* frame) { |
| 212 // TODO(msw): Notify AxProvider clients of updates on child frame loads. | 212 // TODO(msw): Notify AxProvider clients of updates on child frame loads. |
| 213 if (frame_tree_manager_ && | 213 if (frame_tree_manager_ && |
| 214 frame != frame_tree_manager_->GetLocalFrame()) { | 214 frame != frame_tree_manager_->GetLocalFrame()) { |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 | 217 |
| 218 did_finish_local_frame_load_ = true; | 218 did_finish_local_frame_load_ = true; |
| 219 scoped_ptr<BeforeLoadCache> before_load_cache = before_load_cache_.Pass(); | 219 scoped_ptr<BeforeLoadCache> before_load_cache = before_load_cache_.Pass(); |
| 220 if (!before_load_cache) | 220 if (!before_load_cache) |
| 221 return; | 221 return; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 mojo::ApplicationConnection* connection, | 262 mojo::ApplicationConnection* connection, |
| 263 mojo::InterfaceRequest<mandoline::FrameTreeClient> request) { | 263 mojo::InterfaceRequest<mandoline::FrameTreeClient> request) { |
| 264 if (frame_tree_manager_.get() || frame_tree_manager_binding_.get()) { | 264 if (frame_tree_manager_.get() || frame_tree_manager_binding_.get()) { |
| 265 DVLOG(1) << "Request for FrameTreeClient after one already vended."; | 265 DVLOG(1) << "Request for FrameTreeClient after one already vended."; |
| 266 return; | 266 return; |
| 267 } | 267 } |
| 268 resource_waiter_->Bind(request.Pass()); | 268 resource_waiter_->Bind(request.Pass()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace html_viewer | 271 } // namespace html_viewer |
| OLD | NEW |