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

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: Rebase and address review issues 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/web_layer_tree_view_impl.h" 10 #include "components/html_viewer/web_layer_tree_view_impl.h"
10 #include "components/html_viewer/web_storage_namespace_impl.h" 11 #include "components/html_viewer/web_storage_namespace_impl.h"
11 #include "components/mus/public/cpp/view.h" 12 #include "components/mus/public/cpp/view.h"
12 #include "mojo/application/public/cpp/application_impl.h" 13 #include "mojo/application/public/cpp/application_impl.h"
13 #include "third_party/WebKit/public/web/WebFrameWidget.h" 14 #include "third_party/WebKit/public/web/WebFrameWidget.h"
14 #include "third_party/WebKit/public/web/WebSettings.h" 15 #include "third_party/WebKit/public/web/WebSettings.h"
15 #include "third_party/WebKit/public/web/WebView.h" 16 #include "third_party/WebKit/public/web/WebView.h"
16 #include "ui/gfx/geometry/dip_util.h" 17 #include "ui/gfx/geometry/dip_util.h"
17 18
18 namespace html_viewer { 19 namespace html_viewer {
19 namespace { 20 namespace {
20 21
22 const char kDisableWebGLSwitch[] = "disable-webgl";
23
21 scoped_ptr<WebLayerTreeViewImpl> CreateWebLayerTreeView( 24 scoped_ptr<WebLayerTreeViewImpl> CreateWebLayerTreeView(
22 GlobalState* global_state) { 25 GlobalState* global_state) {
23 return make_scoped_ptr(new WebLayerTreeViewImpl( 26 return make_scoped_ptr(new WebLayerTreeViewImpl(
24 global_state->compositor_thread(), 27 global_state->compositor_thread(),
25 global_state->gpu_memory_buffer_manager(), 28 global_state->gpu_memory_buffer_manager(),
26 global_state->raster_thread_helper()->task_graph_runner())); 29 global_state->raster_thread_helper()->task_graph_runner()));
27 } 30 }
28 31
29 void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, 32 void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view,
30 mojo::ApplicationImpl* app, 33 mojo::ApplicationImpl* app,
(...skipping 17 matching lines...) Expand all
48 blink::WebSize(size_in_dips.width(), size_in_dips.height())); 51 blink::WebSize(size_in_dips.width(), size_in_dips.height()));
49 web_layer_tree_view->setViewportSize(size_in_pixels); 52 web_layer_tree_view->setViewportSize(size_in_pixels);
50 } 53 }
51 54
52 void ConfigureSettings(blink::WebSettings* settings) { 55 void ConfigureSettings(blink::WebSettings* settings) {
53 settings->setCookieEnabled(true); 56 settings->setCookieEnabled(true);
54 settings->setDefaultFixedFontSize(13); 57 settings->setDefaultFixedFontSize(13);
55 settings->setDefaultFontSize(16); 58 settings->setDefaultFontSize(16);
56 settings->setLoadsImagesAutomatically(true); 59 settings->setLoadsImagesAutomatically(true);
57 settings->setJavaScriptEnabled(true); 60 settings->setJavaScriptEnabled(true);
61
62 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
63 settings->setExperimentalWebGLEnabled(
64 !command_line->HasSwitch(kDisableWebGLSwitch));
58 } 65 }
59 66
60 } // namespace 67 } // namespace
61 68
62 // HTMLWidgetRootRemote ------------------------------------------------------- 69 // HTMLWidgetRootRemote -------------------------------------------------------
63 70
64 HTMLWidgetRootRemote::HTMLWidgetRootRemote() 71 HTMLWidgetRootRemote::HTMLWidgetRootRemote()
65 : web_view_(blink::WebView::create(nullptr)) { 72 : web_view_(blink::WebView::create(nullptr)) {
66 ConfigureSettings(web_view_->settings()); 73 ConfigureSettings(web_view_->settings());
67 } 74 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 203
197 void HTMLWidgetLocalRoot::didUpdateTextOfFocusedElementByNonUserInput() { 204 void HTMLWidgetLocalRoot::didUpdateTextOfFocusedElementByNonUserInput() {
198 ime_controller_->DidUpdateTextOfFocusedElementByNonUserInput(); 205 ime_controller_->DidUpdateTextOfFocusedElementByNonUserInput();
199 } 206 }
200 207
201 void HTMLWidgetLocalRoot::showImeIfNeeded() { 208 void HTMLWidgetLocalRoot::showImeIfNeeded() {
202 ime_controller_->ShowImeIfNeeded(); 209 ime_controller_->ShowImeIfNeeded();
203 } 210 }
204 211
205 } // namespace html_viewer 212 } // namespace html_viewer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698