| 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 "mojo/examples/html_viewer/html_document_view.h" | 5 #include "mojo/examples/html_viewer/html_document_view.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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 node->SetActiveView(view_); | 97 node->SetActiveView(view_); |
| 98 view_->SetColor(SK_ColorCYAN); // Dummy background color. | 98 view_->SetColor(SK_ColorCYAN); // Dummy background color. |
| 99 | 99 |
| 100 web_view_ = blink::WebView::create(this); | 100 web_view_ = blink::WebView::create(this); |
| 101 ConfigureSettings(web_view_->settings()); | 101 ConfigureSettings(web_view_->settings()); |
| 102 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); | 102 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); |
| 103 | 103 |
| 104 web_view_->resize(gfx::Size(node->bounds().size())); | 104 web_view_->resize(gfx::Size(node->bounds().size())); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void HTMLDocumentView::Load(URLResponsePtr response, | 107 void HTMLDocumentView::Load(URLResponsePtr response) { |
| 108 ScopedDataPipeConsumerHandle response_body_stream) { | |
| 109 DCHECK(web_view_); | 108 DCHECK(web_view_); |
| 110 | 109 |
| 111 GURL url(response->url); | 110 GURL url(response->url); |
| 112 | 111 |
| 113 WebURLRequestExtraData* extra_data = new WebURLRequestExtraData; | 112 WebURLRequestExtraData* extra_data = new WebURLRequestExtraData; |
| 114 extra_data->synthetic_response = response.Pass(); | 113 extra_data->synthetic_response = response.Pass(); |
| 115 extra_data->synthetic_response_body_stream = response_body_stream.Pass(); | |
| 116 | 114 |
| 117 blink::WebURLRequest web_request; | 115 blink::WebURLRequest web_request; |
| 118 web_request.initialize(); | 116 web_request.initialize(); |
| 119 web_request.setURL(url); | 117 web_request.setURL(url); |
| 120 web_request.setExtraData(extra_data); | 118 web_request.setExtraData(extra_data); |
| 121 | 119 |
| 122 web_view_->mainFrame()->loadRequest(web_request); | 120 web_view_->mainFrame()->loadRequest(web_request); |
| 123 } | 121 } |
| 124 | 122 |
| 125 blink::WebStorageNamespace* HTMLDocumentView::createSessionStorageNamespace() { | 123 blink::WebStorageNamespace* HTMLDocumentView::createSessionStorageNamespace() { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(SkCanvas::NewRaster( | 196 skia::RefPtr<SkCanvas> canvas = skia::AdoptRef(SkCanvas::NewRaster( |
| 199 SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType))); | 197 SkImageInfo::MakeN32(width, height, kOpaque_SkAlphaType))); |
| 200 | 198 |
| 201 web_view_->paint(canvas.get(), gfx::Rect(0, 0, width, height)); | 199 web_view_->paint(canvas.get(), gfx::Rect(0, 0, width, height)); |
| 202 | 200 |
| 203 view_->SetContents(canvas->getDevice()->accessBitmap(false)); | 201 view_->SetContents(canvas->getDevice()->accessBitmap(false)); |
| 204 } | 202 } |
| 205 | 203 |
| 206 } // namespace examples | 204 } // namespace examples |
| 207 } // namespace mojo | 205 } // namespace mojo |
| OLD | NEW |