[go: nahoru, domu]

Updater: Mechanical refactor of external constants code.

This refactor prepares for building a copy of the updater binary without
external_constants_override.

This moves the current implementation of CreateExternalConstants into
the .cc file containing the override code. Eventually, the production
binary will not link that .cc file; it will instead link a different one
that is added in this CL (but not currently linked).

Also, a few unused branding macros were eliminated.

There is no behavior difference in this CL.

Bug: 1218109
Change-Id: I60b27b81b5dd6b8ea6042faa4831b536f26e2d75
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2950721
Commit-Queue: Joshua Pawlicki <waffles@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Auto-Submit: Joshua Pawlicki <waffles@chromium.org>
Reviewed-by: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#891269}
diff --git a/chrome/updater/external_constants_default.cc b/chrome/updater/external_constants_default.cc
new file mode 100644
index 0000000..6364930
--- /dev/null
+++ b/chrome/updater/external_constants_default.cc
@@ -0,0 +1,40 @@
+// Copyright 2021 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 "chrome/updater/external_constants_default.h"
+
+#include "chrome/updater/constants.h"
+#include "chrome/updater/external_constants.h"
+#include "chrome/updater/updater_branding.h"
+#include "url/gurl.h"
+
+namespace updater {
+namespace {
+
+class DefaultExternalConstants : public ExternalConstants {
+ public:
+  DefaultExternalConstants() : ExternalConstants(nullptr) {}
+  ~DefaultExternalConstants() override = default;
+
+  // Overrides of ExternalConstants:
+  std::vector<GURL> UpdateURL() const override {
+    return std::vector<GURL>{GURL(UPDATE_CHECK_URL)};
+  }
+
+  bool UseCUP() const override { return true; }
+
+  double InitialDelay() const override { return kInitialDelay; }
+
+  int ServerKeepAliveSeconds() const override {
+    return kServerKeepAliveSeconds;
+  }
+};
+
+}  // namespace
+
+std::unique_ptr<ExternalConstants> CreateDefaultExternalConstants() {
+  return std::make_unique<DefaultExternalConstants>();
+}
+
+}  // namespace updater