| 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 "sky/viewer/document_view.h" | 5 #include "sky/viewer/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/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 blink::WebScreenInfo DocumentView::screenInfo() { | 197 blink::WebScreenInfo DocumentView::screenInfo() { |
| 198 DCHECK(root_); | 198 DCHECK(root_); |
| 199 auto& metrics = root_->viewport_metrics(); | 199 auto& metrics = root_->viewport_metrics(); |
| 200 blink::WebScreenInfo screen; | 200 blink::WebScreenInfo screen; |
| 201 screen.rect = blink::WebRect(0, 0, metrics.size->width, metrics.size->height); | 201 screen.rect = blink::WebRect(0, 0, metrics.size->width, metrics.size->height); |
| 202 screen.availableRect = screen.rect; | 202 screen.availableRect = screen.rect; |
| 203 screen.deviceScaleFactor = metrics.device_pixel_ratio; | 203 screen.deviceScaleFactor = metrics.device_pixel_ratio; |
| 204 return screen; | 204 return screen; |
| 205 } | 205 } |
| 206 | 206 |
| 207 mojo::View* DocumentView::createChildFrame(const blink::WebURL& url) { | 207 mojo::View* DocumentView::createChildFrame() { |
| 208 if (!root_) | 208 if (!root_) |
| 209 return nullptr; | 209 return nullptr; |
| 210 | 210 |
| 211 mojo::View* child = root_->view_manager()->CreateView(); | 211 mojo::View* child = root_->view_manager()->CreateView(); |
| 212 child->SetVisible(true); | 212 child->SetVisible(true); |
| 213 root_->AddChild(child); | 213 root_->AddChild(child); |
| 214 child->Embed(mojo::String::From(url.string().utf8())); | |
| 215 | |
| 216 return child; | 214 return child; |
| 217 } | 215 } |
| 218 | 216 |
| 219 void DocumentView::frameDetached(blink::WebFrame* frame) { | 217 void DocumentView::frameDetached(blink::WebFrame* frame) { |
| 220 // |frame| is invalid after here. | 218 // |frame| is invalid after here. |
| 221 frame->close(); | 219 frame->close(); |
| 222 } | 220 } |
| 223 | 221 |
| 224 float DocumentView::GetDevicePixelRatio() const { | 222 float DocumentView::GetDevicePixelRatio() const { |
| 225 if (root_) | 223 if (root_) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 void DocumentView::StartDebuggerInspectorBackend() { | 316 void DocumentView::StartDebuggerInspectorBackend() { |
| 319 if (!inspector_backend_) { | 317 if (!inspector_backend_) { |
| 320 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); | 318 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); |
| 321 inspector_backend_.reset( | 319 inspector_backend_.reset( |
| 322 new inspector::InspectorBackendMojo(inspector_host_.get())); | 320 new inspector::InspectorBackendMojo(inspector_host_.get())); |
| 323 } | 321 } |
| 324 inspector_backend_->Connect(); | 322 inspector_backend_->Connect(); |
| 325 } | 323 } |
| 326 | 324 |
| 327 } // namespace sky | 325 } // namespace sky |
| OLD | NEW |