| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 263 } |
| 264 | 264 |
| 265 mojo::Shell* DocumentView::Shell() { | 265 mojo::Shell* DocumentView::Shell() { |
| 266 return shell_; | 266 return shell_; |
| 267 } | 267 } |
| 268 | 268 |
| 269 void DocumentView::OnViewBoundsChanged(mojo::View* view, | 269 void DocumentView::OnViewBoundsChanged(mojo::View* view, |
| 270 const mojo::Rect& old_bounds, | 270 const mojo::Rect& old_bounds, |
| 271 const mojo::Rect& new_bounds) { | 271 const mojo::Rect& new_bounds) { |
| 272 DCHECK_EQ(view, root_); | 272 DCHECK_EQ(view, root_); |
| 273 gfx::Size size = new_bounds.To<gfx::Rect>().size(); | 273 float device_pixel_ratio = GetDevicePixelRatio(); |
| 274 web_view_->resize(size); | 274 web_view_->resize(blink::WebSize(new_bounds.width / device_pixel_ratio, |
| 275 new_bounds.height / device_pixel_ratio)); |
| 275 } | 276 } |
| 276 | 277 |
| 277 void DocumentView::OnViewFocusChanged(mojo::View* gained_focus, | 278 void DocumentView::OnViewFocusChanged(mojo::View* gained_focus, |
| 278 mojo::View* lost_focus) { | 279 mojo::View* lost_focus) { |
| 279 if (root_ == lost_focus) { | 280 if (root_ == lost_focus) { |
| 280 web_view_->setFocus(false); | 281 web_view_->setFocus(false); |
| 281 } else if (root_ == gained_focus) { | 282 } else if (root_ == gained_focus) { |
| 282 web_view_->setFocus(true); | 283 web_view_->setFocus(true); |
| 283 } | 284 } |
| 284 } | 285 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 void DocumentView::StartDebuggerInspectorBackend() { | 319 void DocumentView::StartDebuggerInspectorBackend() { |
| 319 if (!inspector_backend_) { | 320 if (!inspector_backend_) { |
| 320 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); | 321 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); |
| 321 inspector_backend_.reset( | 322 inspector_backend_.reset( |
| 322 new inspector::InspectorBackendMojo(inspector_host_.get())); | 323 new inspector::InspectorBackendMojo(inspector_host_.get())); |
| 323 } | 324 } |
| 324 inspector_backend_->Connect(); | 325 inspector_backend_->Connect(); |
| 325 } | 326 } |
| 326 | 327 |
| 327 } // namespace sky | 328 } // namespace sky |
| OLD | NEW |