| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 WeakBindToRequest(new AxProviderImpl(web_view_), &request)); | 165 WeakBindToRequest(new AxProviderImpl(web_view_), &request)); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 void HTMLDocument::Load(URLResponsePtr response) { | 169 void HTMLDocument::Load(URLResponsePtr response) { |
| 170 DCHECK(!web_view_); | 170 DCHECK(!web_view_); |
| 171 web_view_ = blink::WebView::create(this); | 171 web_view_ = blink::WebView::create(this); |
| 172 touch_handler_.reset(new TouchHandler(web_view_)); | 172 touch_handler_.reset(new TouchHandler(web_view_)); |
| 173 web_layer_tree_view_impl_->set_widget(web_view_); | 173 web_layer_tree_view_impl_->set_widget(web_view_); |
| 174 ConfigureSettings(web_view_->settings()); | 174 ConfigureSettings(web_view_->settings()); |
| 175 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); | 175 web_view_->setMainFrame( |
| 176 blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this)); |
| 176 | 177 |
| 177 GURL url(response->url); | 178 GURL url(response->url); |
| 178 | 179 |
| 179 WebURLRequestExtraData* extra_data = new WebURLRequestExtraData; | 180 WebURLRequestExtraData* extra_data = new WebURLRequestExtraData; |
| 180 extra_data->synthetic_response = response.Pass(); | 181 extra_data->synthetic_response = response.Pass(); |
| 181 | 182 |
| 182 blink::WebURLRequest web_request; | 183 blink::WebURLRequest web_request; |
| 183 web_request.initialize(); | 184 web_request.initialize(); |
| 184 web_request.setURL(url); | 185 web_request.setURL(url); |
| 185 web_request.setExtraData(extra_data); | 186 web_request.setExtraData(extra_data); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 setup_->web_media_player_factory() | 263 setup_->web_media_player_factory() |
| 263 ? setup_->web_media_player_factory()->CreateMediaPlayer( | 264 ? setup_->web_media_player_factory()->CreateMediaPlayer( |
| 264 frame, url, client, GetMediaPermission(), GetCdmFactory(), | 265 frame, url, client, GetMediaPermission(), GetCdmFactory(), |
| 265 initial_cdm, shell_) | 266 initial_cdm, shell_) |
| 266 : nullptr; | 267 : nullptr; |
| 267 return player; | 268 return player; |
| 268 } | 269 } |
| 269 | 270 |
| 270 blink::WebFrame* HTMLDocument::createChildFrame( | 271 blink::WebFrame* HTMLDocument::createChildFrame( |
| 271 blink::WebLocalFrame* parent, | 272 blink::WebLocalFrame* parent, |
| 273 blink::WebTreeScopeType scope, |
| 272 const blink::WebString& frameName, | 274 const blink::WebString& frameName, |
| 273 blink::WebSandboxFlags sandboxFlags) { | 275 blink::WebSandboxFlags sandboxFlags) { |
| 274 blink::WebLocalFrame* web_frame = blink::WebLocalFrame::create(this); | 276 blink::WebLocalFrame* web_frame = blink::WebLocalFrame::create(scope, this); |
| 275 parent->appendChild(web_frame); | 277 parent->appendChild(web_frame); |
| 276 return web_frame; | 278 return web_frame; |
| 277 } | 279 } |
| 278 | 280 |
| 279 void HTMLDocument::frameDetached(blink::WebFrame* frame) { | 281 void HTMLDocument::frameDetached(blink::WebFrame* frame) { |
| 280 if (frame->parent()) | 282 if (frame->parent()) |
| 281 frame->parent()->removeChild(frame); | 283 frame->parent()->removeChild(frame); |
| 282 | 284 |
| 283 // |frame| is invalid after here. | 285 // |frame| is invalid after here. |
| 284 frame->close(); | 286 frame->close(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 return media_permission_.get(); | 397 return media_permission_.get(); |
| 396 } | 398 } |
| 397 | 399 |
| 398 media::CdmFactory* HTMLDocument::GetCdmFactory() { | 400 media::CdmFactory* HTMLDocument::GetCdmFactory() { |
| 399 if (!cdm_factory_) | 401 if (!cdm_factory_) |
| 400 cdm_factory_.reset(new media::DefaultCdmFactory()); | 402 cdm_factory_.reset(new media::DefaultCdmFactory()); |
| 401 return cdm_factory_.get(); | 403 return cdm_factory_.get(); |
| 402 } | 404 } |
| 403 | 405 |
| 404 } // namespace html_viewer | 406 } // namespace html_viewer |
| OLD | NEW |