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 "components/html_viewer/html_document.h" | 5 #include "components/html_viewer/html_document.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
15 #include "components/html_viewer/blink_input_events_type_converters.h" | 15 #include "components/html_viewer/blink_input_events_type_converters.h" |
16 #include "components/html_viewer/blink_url_request_type_converters.h" | 16 #include "components/html_viewer/blink_url_request_type_converters.h" |
17 #include "components/html_viewer/media_factory.h" | 17 #include "components/html_viewer/media_factory.h" |
18 #include "components/html_viewer/setup.h" | 18 #include "components/html_viewer/setup.h" |
19 #include "components/html_viewer/web_layer_tree_view_impl.h" | 19 #include "components/html_viewer/web_layer_tree_view_impl.h" |
20 #include "components/html_viewer/web_storage_namespace_impl.h" | 20 #include "components/html_viewer/web_storage_namespace_impl.h" |
21 #include "components/html_viewer/web_url_loader_impl.h" | 21 #include "components/html_viewer/web_url_loader_impl.h" |
22 #include "components/view_manager/public/cpp/view.h" | 22 #include "components/view_manager/public/cpp/view.h" |
23 #include "components/view_manager/public/cpp/view_manager.h" | 23 #include "components/view_manager/public/cpp/view_manager.h" |
24 #include "components/view_manager/public/cpp/view_property.h" | 24 #include "components/view_manager/public/cpp/view_property.h" |
25 #include "components/view_manager/public/interfaces/surfaces.mojom.h" | 25 #include "components/view_manager/public/interfaces/surfaces.mojom.h" |
26 #include "mojo/application/public/cpp/application_impl.h" | 26 #include "mojo/application/public/cpp/application_impl.h" |
27 #include "mojo/application/public/cpp/connect.h" | 27 #include "mojo/application/public/cpp/connect.h" |
28 #include "mojo/application/public/interfaces/shell.mojom.h" | 28 #include "mojo/application/public/interfaces/shell.mojom.h" |
| 29 #include "mojo/converters/geometry/geometry_type_converters.h" |
29 #include "skia/ext/refptr.h" | 30 #include "skia/ext/refptr.h" |
30 #include "third_party/WebKit/public/platform/Platform.h" | 31 #include "third_party/WebKit/public/platform/Platform.h" |
31 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" | 32 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" |
32 #include "third_party/WebKit/public/platform/WebSize.h" | 33 #include "third_party/WebKit/public/platform/WebSize.h" |
33 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 34 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
34 #include "third_party/WebKit/public/web/WebDocument.h" | 35 #include "third_party/WebKit/public/web/WebDocument.h" |
35 #include "third_party/WebKit/public/web/WebElement.h" | 36 #include "third_party/WebKit/public/web/WebElement.h" |
36 #include "third_party/WebKit/public/web/WebInputEvent.h" | 37 #include "third_party/WebKit/public/web/WebInputEvent.h" |
37 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 38 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
38 #include "third_party/WebKit/public/web/WebRemoteFrame.h" | 39 #include "third_party/WebKit/public/web/WebRemoteFrame.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 blink::WebSize(size_in_dips.width(), size_in_dips.height())); | 241 blink::WebSize(size_in_dips.width(), size_in_dips.height())); |
241 web_layer_tree_view_impl_->setViewportSize(size_in_pixels); | 242 web_layer_tree_view_impl_->setViewportSize(size_in_pixels); |
242 } | 243 } |
243 | 244 |
244 void HTMLDocument::InitSetupAndLoadIfNecessary() { | 245 void HTMLDocument::InitSetupAndLoadIfNecessary() { |
245 DCHECK(root_); | 246 DCHECK(root_); |
246 if (root_->viewport_metrics().device_pixel_ratio == 0.f) | 247 if (root_->viewport_metrics().device_pixel_ratio == 0.f) |
247 return; | 248 return; |
248 | 249 |
249 if (!web_view_) { | 250 if (!web_view_) { |
250 setup_->InitIfNecessary(gfx::Size(root_->viewport_metrics().size->width, | 251 setup_->InitIfNecessary( |
251 root_->viewport_metrics().size->height), | 252 root_->viewport_metrics().size_in_pixels.To<gfx::Size>(), |
252 root_->viewport_metrics().device_pixel_ratio); | 253 root_->viewport_metrics().device_pixel_ratio); |
253 Load(response_.Pass()); | 254 Load(response_.Pass()); |
254 } | 255 } |
255 | 256 |
256 UpdateWebviewSizeFromViewSize(); | 257 UpdateWebviewSizeFromViewSize(); |
257 web_layer_tree_view_impl_->set_view(root_); | 258 web_layer_tree_view_impl_->set_view(root_); |
258 } | 259 } |
259 | 260 |
260 blink::WebStorageNamespace* HTMLDocument::createSessionStorageNamespace() { | 261 blink::WebStorageNamespace* HTMLDocument::createSessionStorageNamespace() { |
261 return new WebStorageNamespaceImpl(); | 262 return new WebStorageNamespaceImpl(); |
262 } | 263 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 touch_handler_->OnTouchEvent(*event); | 428 touch_handler_->OnTouchEvent(*event); |
428 return; | 429 return; |
429 } | 430 } |
430 scoped_ptr<blink::WebInputEvent> web_event = | 431 scoped_ptr<blink::WebInputEvent> web_event = |
431 event.To<scoped_ptr<blink::WebInputEvent>>(); | 432 event.To<scoped_ptr<blink::WebInputEvent>>(); |
432 if (web_event) | 433 if (web_event) |
433 web_view_->handleInputEvent(*web_event); | 434 web_view_->handleInputEvent(*web_event); |
434 } | 435 } |
435 | 436 |
436 } // namespace html_viewer | 437 } // namespace html_viewer |
OLD | NEW |