Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: components/html_viewer/html_widget.cc

Issue 1338433002: Mandoline: Add WebGL support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gn check issue Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
7 #include "components/html_viewer/global_state.h" 8 #include "components/html_viewer/global_state.h"
8 #include "components/html_viewer/ime_controller.h" 9 #include "components/html_viewer/ime_controller.h"
9 #include "components/html_viewer/stats_collection_controller.h" 10 #include "components/html_viewer/stats_collection_controller.h"
10 #include "components/html_viewer/web_layer_tree_view_impl.h" 11 #include "components/html_viewer/web_layer_tree_view_impl.h"
11 #include "components/html_viewer/web_storage_namespace_impl.h" 12 #include "components/html_viewer/web_storage_namespace_impl.h"
12 #include "components/mus/public/cpp/view.h" 13 #include "components/mus/public/cpp/view.h"
13 #include "mojo/application/public/cpp/application_impl.h" 14 #include "mojo/application/public/cpp/application_impl.h"
14 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" 15 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
15 #include "third_party/WebKit/public/web/WebFrameWidget.h" 16 #include "third_party/WebKit/public/web/WebFrameWidget.h"
16 #include "third_party/WebKit/public/web/WebSettings.h" 17 #include "third_party/WebKit/public/web/WebSettings.h"
17 #include "third_party/WebKit/public/web/WebView.h" 18 #include "third_party/WebKit/public/web/WebView.h"
18 #include "ui/gfx/geometry/dip_util.h" 19 #include "ui/gfx/geometry/dip_util.h"
19 20
20 namespace html_viewer { 21 namespace html_viewer {
21 namespace { 22 namespace {
22 23
24 const char kDisableWebGLSwitch[] = "disable-webgl";
25
23 scoped_ptr<WebLayerTreeViewImpl> CreateWebLayerTreeView( 26 scoped_ptr<WebLayerTreeViewImpl> CreateWebLayerTreeView(
24 GlobalState* global_state) { 27 GlobalState* global_state) {
25 return make_scoped_ptr(new WebLayerTreeViewImpl( 28 return make_scoped_ptr(new WebLayerTreeViewImpl(
26 global_state->compositor_thread(), 29 global_state->compositor_thread(),
27 global_state->gpu_memory_buffer_manager(), 30 global_state->gpu_memory_buffer_manager(),
28 global_state->raster_thread_helper()->task_graph_runner())); 31 global_state->raster_thread_helper()->task_graph_runner()));
29 } 32 }
30 33
31 void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, 34 void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view,
32 mojo::ApplicationImpl* app, 35 mojo::ApplicationImpl* app,
(...skipping 17 matching lines...) Expand all
50 blink::WebSize(size_in_dips.width(), size_in_dips.height())); 53 blink::WebSize(size_in_dips.width(), size_in_dips.height()));
51 web_layer_tree_view->setViewportSize(size_in_pixels); 54 web_layer_tree_view->setViewportSize(size_in_pixels);
52 } 55 }
53 56
54 void ConfigureSettings(blink::WebSettings* settings) { 57 void ConfigureSettings(blink::WebSettings* settings) {
55 settings->setCookieEnabled(true); 58 settings->setCookieEnabled(true);
56 settings->setDefaultFixedFontSize(13); 59 settings->setDefaultFixedFontSize(13);
57 settings->setDefaultFontSize(16); 60 settings->setDefaultFontSize(16);
58 settings->setLoadsImagesAutomatically(true); 61 settings->setLoadsImagesAutomatically(true);
59 settings->setJavaScriptEnabled(true); 62 settings->setJavaScriptEnabled(true);
63
64 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
65 settings->setExperimentalWebGLEnabled(
66 !command_line->HasSwitch(kDisableWebGLSwitch));
60 } 67 }
61 68
62 } // namespace 69 } // namespace
63 70
64 // HTMLWidgetRootRemote ------------------------------------------------------- 71 // HTMLWidgetRootRemote -------------------------------------------------------
65 72
66 HTMLWidgetRootRemote::HTMLWidgetRootRemote() 73 HTMLWidgetRootRemote::HTMLWidgetRootRemote()
67 : web_view_(blink::WebView::create(nullptr)) { 74 : web_view_(blink::WebView::create(nullptr)) {
68 ConfigureSettings(web_view_->settings()); 75 ConfigureSettings(web_view_->settings());
69 } 76 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 217
211 void HTMLWidgetLocalRoot::didUpdateTextOfFocusedElementByNonUserInput() { 218 void HTMLWidgetLocalRoot::didUpdateTextOfFocusedElementByNonUserInput() {
212 ime_controller_->DidUpdateTextOfFocusedElementByNonUserInput(); 219 ime_controller_->DidUpdateTextOfFocusedElementByNonUserInput();
213 } 220 }
214 221
215 void HTMLWidgetLocalRoot::showImeIfNeeded() { 222 void HTMLWidgetLocalRoot::showImeIfNeeded() {
216 ime_controller_->ShowImeIfNeeded(); 223 ime_controller_->ShowImeIfNeeded();
217 } 224 }
218 225
219 } // namespace html_viewer 226 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/blink_platform_impl.cc ('k') | components/html_viewer/web_graphics_context_3d_command_buffer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698