Chromium Code Reviews| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 WeakBindToRequest(new AxProviderImpl(web_view_), &request)); | 176 WeakBindToRequest(new AxProviderImpl(web_view_), &request)); |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 void HTMLDocument::Load(URLResponsePtr response) { | 180 void HTMLDocument::Load(URLResponsePtr response) { |
| 181 DCHECK(!web_view_); | 181 DCHECK(!web_view_); |
| 182 web_view_ = blink::WebView::create(this); | 182 web_view_ = blink::WebView::create(this); |
| 183 touch_handler_.reset(new TouchHandler(web_view_)); | 183 touch_handler_.reset(new TouchHandler(web_view_)); |
| 184 web_layer_tree_view_impl_->set_widget(web_view_); | 184 web_layer_tree_view_impl_->set_widget(web_view_); |
| 185 ConfigureSettings(web_view_->settings()); | 185 ConfigureSettings(web_view_->settings()); |
| 186 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); | 186 web_view_->setMainFrame( |
| 187 blink::WebLocalFrame::create(WebTreeScopeType::Document, this)); | |
|
dcheng
2015/05/18 23:27:27
I plan on adding assertions, but basically, a main
| |
| 187 | 188 |
| 188 GURL url(response->url); | 189 GURL url(response->url); |
| 189 | 190 |
| 190 WebURLRequestExtraData* extra_data = new WebURLRequestExtraData; | 191 WebURLRequestExtraData* extra_data = new WebURLRequestExtraData; |
| 191 extra_data->synthetic_response = response.Pass(); | 192 extra_data->synthetic_response = response.Pass(); |
| 192 | 193 |
| 193 blink::WebURLRequest web_request; | 194 blink::WebURLRequest web_request; |
| 194 web_request.initialize(); | 195 web_request.initialize(); |
| 195 web_request.setURL(url); | 196 web_request.setURL(url); |
| 196 web_request.setExtraData(extra_data); | 197 web_request.setExtraData(extra_data); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 setup_->web_media_player_factory() | 270 setup_->web_media_player_factory() |
| 270 ? setup_->web_media_player_factory()->CreateMediaPlayer( | 271 ? setup_->web_media_player_factory()->CreateMediaPlayer( |
| 271 frame, url, client, GetMediaPermission(), GetCdmFactory(), | 272 frame, url, client, GetMediaPermission(), GetCdmFactory(), |
| 272 initial_cdm, shell_) | 273 initial_cdm, shell_) |
| 273 : nullptr; | 274 : nullptr; |
| 274 return player; | 275 return player; |
| 275 } | 276 } |
| 276 | 277 |
| 277 blink::WebFrame* HTMLDocument::createChildFrame( | 278 blink::WebFrame* HTMLDocument::createChildFrame( |
| 278 blink::WebLocalFrame* parent, | 279 blink::WebLocalFrame* parent, |
| 280 blink::WebTreeScopeType scope, | |
| 279 const blink::WebString& frameName, | 281 const blink::WebString& frameName, |
| 280 blink::WebSandboxFlags sandboxFlags) { | 282 blink::WebSandboxFlags sandboxFlags) { |
| 281 blink::WebLocalFrame* web_frame = blink::WebLocalFrame::create(this); | 283 blink::WebLocalFrame* web_frame = blink::WebLocalFrame::create(scope, this); |
| 282 parent->appendChild(web_frame); | 284 parent->appendChild(web_frame); |
| 283 return web_frame; | 285 return web_frame; |
| 284 } | 286 } |
| 285 | 287 |
| 286 void HTMLDocument::frameDetached(blink::WebFrame* frame) { | 288 void HTMLDocument::frameDetached(blink::WebFrame* frame) { |
| 287 if (frame->parent()) | 289 if (frame->parent()) |
| 288 frame->parent()->removeChild(frame); | 290 frame->parent()->removeChild(frame); |
| 289 | 291 |
| 290 // |frame| is invalid after here. | 292 // |frame| is invalid after here. |
| 291 frame->close(); | 293 frame->close(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 return media_permission_.get(); | 403 return media_permission_.get(); |
| 402 } | 404 } |
| 403 | 405 |
| 404 media::CdmFactory* HTMLDocument::GetCdmFactory() { | 406 media::CdmFactory* HTMLDocument::GetCdmFactory() { |
| 405 if (!cdm_factory_) | 407 if (!cdm_factory_) |
| 406 cdm_factory_.reset(new media::DefaultCdmFactory()); | 408 cdm_factory_.reset(new media::DefaultCdmFactory()); |
| 407 return cdm_factory_.get(); | 409 return cdm_factory_.get(); |
| 408 } | 410 } |
| 409 | 411 |
| 410 } // namespace html_viewer | 412 } // namespace html_viewer |
| OLD | NEW |