| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 Load(response_.Pass()); | 119 Load(response_.Pass()); |
| 120 | 120 |
| 121 auto& bounds = root_->bounds(); | 121 auto& bounds = root_->bounds(); |
| 122 float device_pixel_ratio = GetDevicePixelRatio(); | 122 float device_pixel_ratio = GetDevicePixelRatio(); |
| 123 web_view_->resize(blink::WebSize(bounds.width / device_pixel_ratio, | 123 web_view_->resize(blink::WebSize(bounds.width / device_pixel_ratio, |
| 124 bounds.height / device_pixel_ratio)); | 124 bounds.height / device_pixel_ratio)); |
| 125 | 125 |
| 126 // TODO(abarth): We should ask the view whether it is focused instead of | 126 // TODO(abarth): We should ask the view whether it is focused instead of |
| 127 // assuming that we're focused. | 127 // assuming that we're focused. |
| 128 web_view_->setFocus(true); | 128 web_view_->setFocus(true); |
| 129 // Needed on android, as the window does not get the focus otherwise. | |
| 130 root_->SetFocus(); | |
| 131 root_->AddObserver(this); | 129 root_->AddObserver(this); |
| 132 } | 130 } |
| 133 | 131 |
| 134 void DocumentView::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { | 132 void DocumentView::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { |
| 135 // TODO(aa): Need to figure out how shutdown works. | 133 // TODO(aa): Need to figure out how shutdown works. |
| 136 } | 134 } |
| 137 | 135 |
| 138 void DocumentView::Load(mojo::URLResponsePtr response) { | 136 void DocumentView::Load(mojo::URLResponsePtr response) { |
| 139 web_view_ = blink::WebView::create(this); | 137 web_view_ = blink::WebView::create(this); |
| 140 ConfigureSettings(web_view_->settings()); | 138 ConfigureSettings(web_view_->settings()); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 void DocumentView::StartDebuggerInspectorBackend() { | 318 void DocumentView::StartDebuggerInspectorBackend() { |
| 321 if (!inspector_backend_) { | 319 if (!inspector_backend_) { |
| 322 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); | 320 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); |
| 323 inspector_backend_.reset( | 321 inspector_backend_.reset( |
| 324 new inspector::InspectorBackendMojo(inspector_host_.get())); | 322 new inspector::InspectorBackendMojo(inspector_host_.get())); |
| 325 } | 323 } |
| 326 inspector_backend_->Connect(); | 324 inspector_backend_->Connect(); |
| 327 } | 325 } |
| 328 | 326 |
| 329 } // namespace sky | 327 } // namespace sky |
| OLD | NEW |