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

Unified Diff: content/common/layer_tree_settings_factory.cc

Issue 2285083004: Refactor renderer LayerTreeSettings generating code to common. (Closed)
Patch Set: Fix Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/layer_tree_settings_factory.h ('k') | content/content_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/layer_tree_settings_factory.cc
diff --git a/content/common/layer_tree_settings_factory.cc b/content/common/layer_tree_settings_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c6ebb32d762b4bf86fe22ed3868e5a3e5de0f2f7
--- /dev/null
+++ b/content/common/layer_tree_settings_factory.cc
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/layer_tree_settings_factory.h"
+
+#include "base/strings/string_number_conversions.h"
+#include "cc/base/switches.h"
+
+namespace content {
+
+// static
+void LayerTreeSettingsFactory::SetTopControlsSettings(
+ cc::LayerTreeSettings& settings,
+ const base::CommandLine& cmd) {
+ if (cmd.HasSwitch(cc::switches::kTopControlsShowThreshold)) {
+ std::string top_threshold_str =
+ cmd.GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold);
+ double show_threshold;
+ if (base::StringToDouble(top_threshold_str, &show_threshold) &&
+ show_threshold >= 0.f && show_threshold <= 1.f)
+ settings.top_controls_show_threshold = show_threshold;
+ }
+
+ if (cmd.HasSwitch(cc::switches::kTopControlsHideThreshold)) {
+ std::string top_threshold_str =
+ cmd.GetSwitchValueASCII(cc::switches::kTopControlsHideThreshold);
+ double hide_threshold;
+ if (base::StringToDouble(top_threshold_str, &hide_threshold) &&
+ hide_threshold >= 0.f && hide_threshold <= 1.f)
+ settings.top_controls_hide_threshold = hide_threshold;
+ }
+}
+
+} // namespace content
« no previous file with comments | « content/common/layer_tree_settings_factory.h ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698