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 |