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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 129 // Needed on android, as the window does not get the focus otherwise. |
| 130 #if defined(OS_ANDROID) |
130 root_->SetFocus(); | 131 root_->SetFocus(); |
| 132 #endif |
131 root_->AddObserver(this); | 133 root_->AddObserver(this); |
132 } | 134 } |
133 | 135 |
134 void DocumentView::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { | 136 void DocumentView::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { |
135 // TODO(aa): Need to figure out how shutdown works. | 137 // TODO(aa): Need to figure out how shutdown works. |
136 } | 138 } |
137 | 139 |
138 void DocumentView::Load(mojo::URLResponsePtr response) { | 140 void DocumentView::Load(mojo::URLResponsePtr response) { |
139 web_view_ = blink::WebView::create(this); | 141 web_view_ = blink::WebView::create(this); |
140 ConfigureSettings(web_view_->settings()); | 142 ConfigureSettings(web_view_->settings()); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 void DocumentView::StartDebuggerInspectorBackend() { | 322 void DocumentView::StartDebuggerInspectorBackend() { |
321 if (!inspector_backend_) { | 323 if (!inspector_backend_) { |
322 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); | 324 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); |
323 inspector_backend_.reset( | 325 inspector_backend_.reset( |
324 new inspector::InspectorBackendMojo(inspector_host_.get())); | 326 new inspector::InspectorBackendMojo(inspector_host_.get())); |
325 } | 327 } |
326 inspector_backend_->Connect(); | 328 inspector_backend_->Connect(); |
327 } | 329 } |
328 | 330 |
329 } // namespace sky | 331 } // namespace sky |
OLD | NEW |