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: content/renderer/gpu/render_widget_compositor.cc

Issue 714003002: Allow changing top controls height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years 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 | « content/renderer/gpu/render_widget_compositor.h ('k') | content/renderer/render_view_impl.cc » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" 5 #include "content/renderer/gpu/render_widget_compositor.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 settings.can_use_lcd_text = render_thread->is_lcd_text_enabled(); 234 settings.can_use_lcd_text = render_thread->is_lcd_text_enabled();
235 settings.use_distance_field_text = 235 settings.use_distance_field_text =
236 render_thread->is_distance_field_text_enabled(); 236 render_thread->is_distance_field_text_enabled();
237 settings.use_zero_copy = render_thread->is_zero_copy_enabled(); 237 settings.use_zero_copy = render_thread->is_zero_copy_enabled();
238 settings.use_one_copy = render_thread->is_one_copy_enabled(); 238 settings.use_one_copy = render_thread->is_one_copy_enabled();
239 settings.use_image_external = render_thread->use_image_external(); 239 settings.use_image_external = render_thread->use_image_external();
240 } 240 }
241 241
242 settings.calculate_top_controls_position = 242 settings.calculate_top_controls_position =
243 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); 243 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation);
244 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) {
245 std::string controls_height_str =
246 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight);
247 double controls_height;
248 if (base::StringToDouble(controls_height_str, &controls_height) &&
249 controls_height > 0)
250 settings.top_controls_height = controls_height;
251 }
252
253 if (settings.calculate_top_controls_position &&
254 settings.top_controls_height <= 0) {
255 DCHECK(false)
256 << "Top controls repositioning enabled without valid height set.";
257 settings.calculate_top_controls_position = false;
258 }
259
260 if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) { 244 if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) {
261 std::string top_threshold_str = 245 std::string top_threshold_str =
262 cmd->GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold); 246 cmd->GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold);
263 double show_threshold; 247 double show_threshold;
264 if (base::StringToDouble(top_threshold_str, &show_threshold) && 248 if (base::StringToDouble(top_threshold_str, &show_threshold) &&
265 show_threshold >= 0.f && show_threshold <= 1.f) 249 show_threshold >= 0.f && show_threshold <= 1.f)
266 settings.top_controls_show_threshold = show_threshold; 250 settings.top_controls_show_threshold = show_threshold;
267 } 251 }
268 252
269 if (cmd->HasSwitch(cc::switches::kTopControlsHideThreshold)) { 253 if (cmd->HasSwitch(cc::switches::kTopControlsHideThreshold)) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 440
457 void RenderWidgetCompositor::UpdateTopControlsState( 441 void RenderWidgetCompositor::UpdateTopControlsState(
458 cc::TopControlsState constraints, 442 cc::TopControlsState constraints,
459 cc::TopControlsState current, 443 cc::TopControlsState current,
460 bool animate) { 444 bool animate) {
461 layer_tree_host_->UpdateTopControlsState(constraints, 445 layer_tree_host_->UpdateTopControlsState(constraints,
462 current, 446 current,
463 animate); 447 animate);
464 } 448 }
465 449
466 void RenderWidgetCompositor::SetTopControlsLayoutHeight(float height) { 450 void RenderWidgetCompositor::SetTopControlsShrinkBlinkSize(bool shrink) {
467 layer_tree_host_->SetTopControlsLayoutHeight(height); 451 layer_tree_host_->SetTopControlsShrinkBlinkSize(shrink);
452 }
453
454 void RenderWidgetCompositor::SetTopControlsHeight(float height) {
455 layer_tree_host_->SetTopControlsHeight(height);
468 } 456 }
469 457
470 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { 458 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) {
471 layer_tree_host_->SetNeedsRedrawRect(damage_rect); 459 layer_tree_host_->SetNeedsRedrawRect(damage_rect);
472 } 460 }
473 461
474 void RenderWidgetCompositor::SetNeedsForcedRedraw() { 462 void RenderWidgetCompositor::SetNeedsForcedRedraw() {
475 layer_tree_host_->SetNextCommitForcesRedraw(); 463 layer_tree_host_->SetNextCommitForcesRedraw();
476 setNeedsAnimate(); 464 setNeedsAnimate();
477 } 465 }
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 widget_->OnSwapBuffersAborted(); 893 widget_->OnSwapBuffersAborted();
906 } 894 }
907 895
908 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { 896 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() {
909 cc::ContextProvider* provider = 897 cc::ContextProvider* provider =
910 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 898 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
911 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); 899 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM();
912 } 900 }
913 901
914 } // namespace content 902 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698