| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_widget.h" | 5 #include "components/html_viewer/html_widget.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | |
| 8 #include "components/html_viewer/global_state.h" | 7 #include "components/html_viewer/global_state.h" |
| 9 #include "components/html_viewer/ime_controller.h" | 8 #include "components/html_viewer/ime_controller.h" |
| 10 #include "components/html_viewer/stats_collection_controller.h" | 9 #include "components/html_viewer/stats_collection_controller.h" |
| 11 #include "components/html_viewer/web_layer_tree_view_impl.h" | 10 #include "components/html_viewer/web_layer_tree_view_impl.h" |
| 12 #include "components/html_viewer/web_storage_namespace_impl.h" | 11 #include "components/html_viewer/web_storage_namespace_impl.h" |
| 13 #include "components/mus/public/cpp/view.h" | 12 #include "components/mus/public/cpp/view.h" |
| 14 #include "mojo/application/public/cpp/application_impl.h" | 13 #include "mojo/application/public/cpp/application_impl.h" |
| 15 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | 14 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" |
| 16 #include "third_party/WebKit/public/web/WebFrameWidget.h" | 15 #include "third_party/WebKit/public/web/WebFrameWidget.h" |
| 17 #include "third_party/WebKit/public/web/WebSettings.h" | 16 #include "third_party/WebKit/public/web/WebSettings.h" |
| 18 #include "third_party/WebKit/public/web/WebView.h" | 17 #include "third_party/WebKit/public/web/WebView.h" |
| 19 #include "ui/gfx/geometry/dip_util.h" | 18 #include "ui/gfx/geometry/dip_util.h" |
| 20 | 19 |
| 21 namespace html_viewer { | 20 namespace html_viewer { |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 const char kDisableWebGLSwitch[] = "disable-webgl"; | |
| 25 | |
| 26 scoped_ptr<WebLayerTreeViewImpl> CreateWebLayerTreeView( | 23 scoped_ptr<WebLayerTreeViewImpl> CreateWebLayerTreeView( |
| 27 GlobalState* global_state) { | 24 GlobalState* global_state) { |
| 28 return make_scoped_ptr(new WebLayerTreeViewImpl( | 25 return make_scoped_ptr(new WebLayerTreeViewImpl( |
| 29 global_state->compositor_thread(), | 26 global_state->compositor_thread(), |
| 30 global_state->gpu_memory_buffer_manager(), | 27 global_state->gpu_memory_buffer_manager(), |
| 31 global_state->raster_thread_helper()->task_graph_runner())); | 28 global_state->raster_thread_helper()->task_graph_runner())); |
| 32 } | 29 } |
| 33 | 30 |
| 34 void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, | 31 void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, |
| 35 mojo::ApplicationImpl* app, | 32 mojo::ApplicationImpl* app, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 53 blink::WebSize(size_in_dips.width(), size_in_dips.height())); | 50 blink::WebSize(size_in_dips.width(), size_in_dips.height())); |
| 54 web_layer_tree_view->setViewportSize(size_in_pixels); | 51 web_layer_tree_view->setViewportSize(size_in_pixels); |
| 55 } | 52 } |
| 56 | 53 |
| 57 void ConfigureSettings(blink::WebSettings* settings) { | 54 void ConfigureSettings(blink::WebSettings* settings) { |
| 58 settings->setCookieEnabled(true); | 55 settings->setCookieEnabled(true); |
| 59 settings->setDefaultFixedFontSize(13); | 56 settings->setDefaultFixedFontSize(13); |
| 60 settings->setDefaultFontSize(16); | 57 settings->setDefaultFontSize(16); |
| 61 settings->setLoadsImagesAutomatically(true); | 58 settings->setLoadsImagesAutomatically(true); |
| 62 settings->setJavaScriptEnabled(true); | 59 settings->setJavaScriptEnabled(true); |
| 63 | |
| 64 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 65 settings->setExperimentalWebGLEnabled( | |
| 66 !command_line->HasSwitch(kDisableWebGLSwitch)); | |
| 67 } | 60 } |
| 68 | 61 |
| 69 } // namespace | 62 } // namespace |
| 70 | 63 |
| 71 // HTMLWidgetRootRemote ------------------------------------------------------- | 64 // HTMLWidgetRootRemote ------------------------------------------------------- |
| 72 | 65 |
| 73 HTMLWidgetRootRemote::HTMLWidgetRootRemote() | 66 HTMLWidgetRootRemote::HTMLWidgetRootRemote() |
| 74 : web_view_(blink::WebView::create(nullptr)) { | 67 : web_view_(blink::WebView::create(nullptr)) { |
| 75 ConfigureSettings(web_view_->settings()); | 68 ConfigureSettings(web_view_->settings()); |
| 76 } | 69 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 210 |
| 218 void HTMLWidgetLocalRoot::didUpdateTextOfFocusedElementByNonUserInput() { | 211 void HTMLWidgetLocalRoot::didUpdateTextOfFocusedElementByNonUserInput() { |
| 219 ime_controller_->DidUpdateTextOfFocusedElementByNonUserInput(); | 212 ime_controller_->DidUpdateTextOfFocusedElementByNonUserInput(); |
| 220 } | 213 } |
| 221 | 214 |
| 222 void HTMLWidgetLocalRoot::showImeIfNeeded() { | 215 void HTMLWidgetLocalRoot::showImeIfNeeded() { |
| 223 ime_controller_->ShowImeIfNeeded(); | 216 ime_controller_->ShowImeIfNeeded(); |
| 224 } | 217 } |
| 225 | 218 |
| 226 } // namespace html_viewer | 219 } // namespace html_viewer |
| OLD | NEW |