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" | |
30 #include "skia/ext/refptr.h" | 29 #include "skia/ext/refptr.h" |
31 #include "third_party/WebKit/public/platform/Platform.h" | 30 #include "third_party/WebKit/public/platform/Platform.h" |
32 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" | 31 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" |
33 #include "third_party/WebKit/public/platform/WebSize.h" | 32 #include "third_party/WebKit/public/platform/WebSize.h" |
34 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 33 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
35 #include "third_party/WebKit/public/web/WebDocument.h" | 34 #include "third_party/WebKit/public/web/WebDocument.h" |
36 #include "third_party/WebKit/public/web/WebElement.h" | 35 #include "third_party/WebKit/public/web/WebElement.h" |
37 #include "third_party/WebKit/public/web/WebInputEvent.h" | 36 #include "third_party/WebKit/public/web/WebInputEvent.h" |
38 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 37 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
39 #include "third_party/WebKit/public/web/WebRemoteFrame.h" | 38 #include "third_party/WebKit/public/web/WebRemoteFrame.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 blink::WebSize(size_in_dips.width(), size_in_dips.height())); | 240 blink::WebSize(size_in_dips.width(), size_in_dips.height())); |
242 web_layer_tree_view_impl_->setViewportSize(size_in_pixels); | 241 web_layer_tree_view_impl_->setViewportSize(size_in_pixels); |
243 } | 242 } |
244 | 243 |
245 void HTMLDocument::InitSetupAndLoadIfNecessary() { | 244 void HTMLDocument::InitSetupAndLoadIfNecessary() { |
246 DCHECK(root_); | 245 DCHECK(root_); |
247 if (root_->viewport_metrics().device_pixel_ratio == 0.f) | 246 if (root_->viewport_metrics().device_pixel_ratio == 0.f) |
248 return; | 247 return; |
249 | 248 |
250 if (!web_view_) { | 249 if (!web_view_) { |
251 setup_->InitIfNecessary( | 250 setup_->InitIfNecessary(gfx::Size(root_->viewport_metrics().size->width, |
252 root_->viewport_metrics().size_in_pixels.To<gfx::Size>(), | 251 root_->viewport_metrics().size->height), |
253 root_->viewport_metrics().device_pixel_ratio); | 252 root_->viewport_metrics().device_pixel_ratio); |
254 Load(response_.Pass()); | 253 Load(response_.Pass()); |
255 } | 254 } |
256 | 255 |
257 UpdateWebviewSizeFromViewSize(); | 256 UpdateWebviewSizeFromViewSize(); |
258 web_layer_tree_view_impl_->set_view(root_); | 257 web_layer_tree_view_impl_->set_view(root_); |
259 } | 258 } |
260 | 259 |
261 blink::WebStorageNamespace* HTMLDocument::createSessionStorageNamespace() { | 260 blink::WebStorageNamespace* HTMLDocument::createSessionStorageNamespace() { |
262 return new WebStorageNamespaceImpl(); | 261 return new WebStorageNamespaceImpl(); |
263 } | 262 } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 touch_handler_->OnTouchEvent(*event); | 427 touch_handler_->OnTouchEvent(*event); |
429 return; | 428 return; |
430 } | 429 } |
431 scoped_ptr<blink::WebInputEvent> web_event = | 430 scoped_ptr<blink::WebInputEvent> web_event = |
432 event.To<scoped_ptr<blink::WebInputEvent>>(); | 431 event.To<scoped_ptr<blink::WebInputEvent>>(); |
433 if (web_event) | 432 if (web_event) |
434 web_view_->handleInputEvent(*web_event); | 433 web_view_->handleInputEvent(*web_event); |
435 } | 434 } |
436 | 435 |
437 } // namespace html_viewer | 436 } // namespace html_viewer |
OLD | NEW |