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

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

Issue 1340983002: Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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
« no previous file with comments | « components/html_viewer/html_widget.h ('k') | components/html_viewer/ime_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/command_line.h"
8 #include "components/html_viewer/global_state.h" 8 #include "components/html_viewer/global_state.h"
9 #include "components/html_viewer/ime_controller.h" 9 #include "components/html_viewer/ime_controller.h"
10 #include "components/html_viewer/stats_collection_controller.h" 10 #include "components/html_viewer/stats_collection_controller.h"
(...skipping 15 matching lines...) Expand all
26 scoped_ptr<WebLayerTreeViewImpl> CreateWebLayerTreeView( 26 scoped_ptr<WebLayerTreeViewImpl> CreateWebLayerTreeView(
27 GlobalState* global_state) { 27 GlobalState* global_state) {
28 return make_scoped_ptr(new WebLayerTreeViewImpl( 28 return make_scoped_ptr(new WebLayerTreeViewImpl(
29 global_state->compositor_thread(), 29 global_state->compositor_thread(),
30 global_state->gpu_memory_buffer_manager(), 30 global_state->gpu_memory_buffer_manager(),
31 global_state->raster_thread_helper()->task_graph_runner())); 31 global_state->raster_thread_helper()->task_graph_runner()));
32 } 32 }
33 33
34 void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, 34 void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view,
35 mojo::ApplicationImpl* app, 35 mojo::ApplicationImpl* app,
36 mojo::View* view, 36 mus::View* view,
37 blink::WebWidget* widget) { 37 blink::WebWidget* widget) {
38 DCHECK(view); 38 DCHECK(view);
39 mojo::URLRequestPtr request(mojo::URLRequest::New()); 39 mojo::URLRequestPtr request(mojo::URLRequest::New());
40 request->url = mojo::String::From("mojo:mus"); 40 request->url = mojo::String::From("mojo:mus");
41 mojo::GpuPtr gpu_service; 41 mojo::GpuPtr gpu_service;
42 app->ConnectToService(request.Pass(), &gpu_service); 42 app->ConnectToService(request.Pass(), &gpu_service);
43 web_layer_tree_view->Initialize(gpu_service.Pass(), view, widget); 43 web_layer_tree_view->Initialize(gpu_service.Pass(), view, widget);
44 } 44 }
45 45
46 void UpdateWebViewSizeFromViewSize(mojo::View* view, 46 void UpdateWebViewSizeFromViewSize(mus::View* view,
47 blink::WebWidget* web_widget, 47 blink::WebWidget* web_widget,
48 WebLayerTreeViewImpl* web_layer_tree_view) { 48 WebLayerTreeViewImpl* web_layer_tree_view) {
49 const gfx::Size size_in_pixels(view->bounds().width, view->bounds().height); 49 const gfx::Size size_in_pixels(view->bounds().width, view->bounds().height);
50 const gfx::Size size_in_dips = gfx::ConvertSizeToDIP( 50 const gfx::Size size_in_dips = gfx::ConvertSizeToDIP(
51 view->viewport_metrics().device_pixel_ratio, size_in_pixels); 51 view->viewport_metrics().device_pixel_ratio, size_in_pixels);
52 web_widget->resize( 52 web_widget->resize(
53 blink::WebSize(size_in_dips.width(), size_in_dips.height())); 53 blink::WebSize(size_in_dips.width(), size_in_dips.height()));
54 web_layer_tree_view->setViewportSize(size_in_pixels); 54 web_layer_tree_view->setViewportSize(size_in_pixels);
55 } 55 }
56 56
(...skipping 17 matching lines...) Expand all
74 : web_view_(blink::WebView::create(nullptr)) { 74 : web_view_(blink::WebView::create(nullptr)) {
75 ConfigureSettings(web_view_->settings()); 75 ConfigureSettings(web_view_->settings());
76 } 76 }
77 77
78 HTMLWidgetRootRemote::~HTMLWidgetRootRemote() {} 78 HTMLWidgetRootRemote::~HTMLWidgetRootRemote() {}
79 79
80 blink::WebWidget* HTMLWidgetRootRemote::GetWidget() { 80 blink::WebWidget* HTMLWidgetRootRemote::GetWidget() {
81 return web_view_; 81 return web_view_;
82 } 82 }
83 83
84 void HTMLWidgetRootRemote::OnViewBoundsChanged(mojo::View* view) {} 84 void HTMLWidgetRootRemote::OnViewBoundsChanged(mus::View* view) {}
85 85
86 // HTMLWidgetRootLocal -------------------------------------------------------- 86 // HTMLWidgetRootLocal --------------------------------------------------------
87 87
88 HTMLWidgetRootLocal::CreateParams::CreateParams(mojo::ApplicationImpl* app, 88 HTMLWidgetRootLocal::CreateParams::CreateParams(mojo::ApplicationImpl* app,
89 GlobalState* global_state, 89 GlobalState* global_state,
90 mojo::View* view) 90 mus::View* view)
91 : app(app), global_state(global_state), view(view) {} 91 : app(app), global_state(global_state), view(view) {}
92 92
93 HTMLWidgetRootLocal::CreateParams::~CreateParams() {} 93 HTMLWidgetRootLocal::CreateParams::~CreateParams() {}
94 94
95 HTMLWidgetRootLocal::HTMLWidgetRootLocal(CreateParams* create_params) 95 HTMLWidgetRootLocal::HTMLWidgetRootLocal(CreateParams* create_params)
96 : app_(create_params->app), 96 : app_(create_params->app),
97 global_state_(create_params->global_state), 97 global_state_(create_params->global_state),
98 view_(create_params->view), 98 view_(create_params->view),
99 web_view_(nullptr) { 99 web_view_(nullptr) {
100 web_view_ = blink::WebView::create(this); 100 web_view_ = blink::WebView::create(this);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 void HTMLWidgetRootLocal::showImeIfNeeded() { 155 void HTMLWidgetRootLocal::showImeIfNeeded() {
156 ime_controller_->ShowImeIfNeeded(); 156 ime_controller_->ShowImeIfNeeded();
157 } 157 }
158 158
159 blink::WebWidget* HTMLWidgetRootLocal::GetWidget() { 159 blink::WebWidget* HTMLWidgetRootLocal::GetWidget() {
160 return web_view_; 160 return web_view_;
161 } 161 }
162 162
163 void HTMLWidgetRootLocal::OnViewBoundsChanged(mojo::View* view) { 163 void HTMLWidgetRootLocal::OnViewBoundsChanged(mus::View* view) {
164 UpdateWebViewSizeFromViewSize(view, web_view_, 164 UpdateWebViewSizeFromViewSize(view, web_view_,
165 web_layer_tree_view_impl_.get()); 165 web_layer_tree_view_impl_.get());
166 } 166 }
167 167
168 // HTMLWidgetLocalRoot -------------------------------------------------------- 168 // HTMLWidgetLocalRoot --------------------------------------------------------
169 169
170 HTMLWidgetLocalRoot::HTMLWidgetLocalRoot(mojo::ApplicationImpl* app, 170 HTMLWidgetLocalRoot::HTMLWidgetLocalRoot(mojo::ApplicationImpl* app,
171 GlobalState* global_state, 171 GlobalState* global_state,
172 mojo::View* view, 172 mus::View* view,
173 blink::WebLocalFrame* web_local_frame) 173 blink::WebLocalFrame* web_local_frame)
174 : app_(app), global_state_(global_state), web_frame_widget_(nullptr) { 174 : app_(app), global_state_(global_state), web_frame_widget_(nullptr) {
175 web_frame_widget_ = blink::WebFrameWidget::create(this, web_local_frame); 175 web_frame_widget_ = blink::WebFrameWidget::create(this, web_local_frame);
176 ime_controller_.reset(new ImeController(view, web_frame_widget_)); 176 ime_controller_.reset(new ImeController(view, web_frame_widget_));
177 // Creating the widget calls initializeLayerTreeView() to create the 177 // Creating the widget calls initializeLayerTreeView() to create the
178 // |web_layer_tree_view_impl_|. As we haven't yet assigned the 178 // |web_layer_tree_view_impl_|. As we haven't yet assigned the
179 // |web_frame_widget_| 179 // |web_frame_widget_|
180 // we have to set it here. 180 // we have to set it here.
181 if (web_layer_tree_view_impl_) { 181 if (web_layer_tree_view_impl_) {
182 InitializeWebLayerTreeView(web_layer_tree_view_impl_.get(), app_, view, 182 InitializeWebLayerTreeView(web_layer_tree_view_impl_.get(), app_, view,
183 web_frame_widget_); 183 web_frame_widget_);
184 UpdateWebViewSizeFromViewSize(view, web_frame_widget_, 184 UpdateWebViewSizeFromViewSize(view, web_frame_widget_,
185 web_layer_tree_view_impl_.get()); 185 web_layer_tree_view_impl_.get());
186 } 186 }
187 } 187 }
188 188
189 HTMLWidgetLocalRoot::~HTMLWidgetLocalRoot() {} 189 HTMLWidgetLocalRoot::~HTMLWidgetLocalRoot() {}
190 190
191 blink::WebWidget* HTMLWidgetLocalRoot::GetWidget() { 191 blink::WebWidget* HTMLWidgetLocalRoot::GetWidget() {
192 return web_frame_widget_; 192 return web_frame_widget_;
193 } 193 }
194 194
195 void HTMLWidgetLocalRoot::OnViewBoundsChanged(mojo::View* view) { 195 void HTMLWidgetLocalRoot::OnViewBoundsChanged(mus::View* view) {
196 UpdateWebViewSizeFromViewSize(view, web_frame_widget_, 196 UpdateWebViewSizeFromViewSize(view, web_frame_widget_,
197 web_layer_tree_view_impl_.get()); 197 web_layer_tree_view_impl_.get());
198 } 198 }
199 199
200 void HTMLWidgetLocalRoot::initializeLayerTreeView() { 200 void HTMLWidgetLocalRoot::initializeLayerTreeView() {
201 web_layer_tree_view_impl_ = CreateWebLayerTreeView(global_state_); 201 web_layer_tree_view_impl_ = CreateWebLayerTreeView(global_state_);
202 } 202 }
203 203
204 blink::WebLayerTreeView* HTMLWidgetLocalRoot::layerTreeView() { 204 blink::WebLayerTreeView* HTMLWidgetLocalRoot::layerTreeView() {
205 return web_layer_tree_view_impl_.get(); 205 return web_layer_tree_view_impl_.get();
(...skipping 11 matching lines...) Expand all
217 217
218 void HTMLWidgetLocalRoot::didUpdateTextOfFocusedElementByNonUserInput() { 218 void HTMLWidgetLocalRoot::didUpdateTextOfFocusedElementByNonUserInput() {
219 ime_controller_->DidUpdateTextOfFocusedElementByNonUserInput(); 219 ime_controller_->DidUpdateTextOfFocusedElementByNonUserInput();
220 } 220 }
221 221
222 void HTMLWidgetLocalRoot::showImeIfNeeded() { 222 void HTMLWidgetLocalRoot::showImeIfNeeded() {
223 ime_controller_->ShowImeIfNeeded(); 223 ime_controller_->ShowImeIfNeeded();
224 } 224 }
225 225
226 } // namespace html_viewer 226 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/html_widget.h ('k') | components/html_viewer/ime_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698