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

Unified Diff: content/common/compositor_util.cc

Issue 2285083004: Refactor renderer LayerTreeSettings generating code to common. (Closed)
Patch Set: Rename function. 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
Index: content/common/compositor_util.cc
diff --git a/content/common/compositor_util.cc b/content/common/compositor_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..684a8ac5de215b44f4f1ac589a8a4af08d1cdb4c
--- /dev/null
+++ b/content/common/compositor_util.cc
@@ -0,0 +1,34 @@
+// 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/compositor_util.h"
+
+#include "base/strings/string_number_conversions.h"
+#include "cc/base/switches.h"
+
+namespace content {
+
+// static
+void CompositorUtil::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

Powered by Google App Engine
This is Rietveld 408576698