Skip to content

Commit

Permalink
Move updater to match Chromium
Browse files Browse the repository at this point in the history
Issue: 326748668
Reviewed-on: #3311
  • Loading branch information
dahlstrom-g authored May 22, 2024
2 parents 9263496 + d057d40 commit cddc2d7
Show file tree
Hide file tree
Showing 120 changed files with 183 additions and 142 deletions.
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ files: |
exclude: |
(?x)^(
(
cobalt/updater|
glimp/include|
internal/kokoro/third-party|
internal/starboard/shared/playstation/glimp/shaders|
Expand Down Expand Up @@ -141,7 +140,6 @@ repos:
cobalt/math/|
cobalt/media/|
cobalt/streams/|
cobalt/updater/|
cobalt/webdriver/screencast/|
cobalt/websocket/|
components/crx_file/|
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions cobalt/updater/BUILD.gn → chrome/updater/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ static_library("updater") {
"updater_constants.h",
"updater_module.cc",
"updater_module.h",
"utils.cc",
"utils.h",
"util.cc",
"util.h",
]

deps = [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
62 changes: 43 additions & 19 deletions cobalt/updater/configurator.cc → chrome/updater/configurator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cobalt/updater/configurator.h"
#include "chrome/updater/configurator.h"

#include <set>
#include <utility>
#include "base/command_line.h"
#include "base/version.h"
#include "chrome/updater/network_fetcher.h"
#include "chrome/updater/patcher.h"
#include "chrome/updater/prefs.h"
#include "chrome/updater/unzipper.h"
#include "chrome/updater/updater_constants.h"
#include "cobalt/browser/switches.h"
#include "cobalt/script/javascript_engine.h"
#include "cobalt/updater/network_fetcher.h"
#include "cobalt/updater/patcher.h"
#include "cobalt/updater/prefs.h"
#include "cobalt/updater/unzipper.h"
#include "cobalt/updater/updater_constants.h"
#include "cobalt/version.h"
#include "components/prefs/pref_service.h"
#include "components/update_client/network.h"
Expand Down Expand Up @@ -82,24 +82,34 @@ Configurator::Configurator(network::NetworkModule* network_module)
}
Configurator::~Configurator() { LOG(INFO) << "Configurator::~Configurator"; }

int Configurator::InitialDelay() const { return 0; }
int Configurator::InitialDelay() const {
return 0;
}

int Configurator::NextCheckDelay() const { return 5 * kDelayOneHour; }
int Configurator::NextCheckDelay() const {
return 5 * kDelayOneHour;
}

int Configurator::OnDemandDelay() const { return 0; }
int Configurator::OnDemandDelay() const {
return 0;
}

int Configurator::UpdateDelay() const { return 0; }
int Configurator::UpdateDelay() const {
return 0;
}

std::vector<GURL> Configurator::UpdateUrl() const {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
browser::switches::kUseQAUpdateServer)) {
return std::vector<GURL>{GURL(kUpdaterJSONDefaultUrlQA)};
} else {
return std::vector<GURL>{GURL(kUpdaterJSONDefaultUrl)};
return std::vector<GURL>{GURL(kUpdaterJSONDefaultUrl)};
}
}

std::vector<GURL> Configurator::PingUrl() const { return UpdateUrl(); }
std::vector<GURL> Configurator::PingUrl() const {
return UpdateUrl();
}

std::string Configurator::GetProdId() const { return "cobalt"; }

Expand All @@ -113,7 +123,9 @@ base::Version Configurator::GetBrowserVersion() const {
return base::Version("");
}

std::string Configurator::GetBrand() const { return {}; }
std::string Configurator::GetBrand() const {
return {};
}

std::string Configurator::GetLang() const {
const char* locale_id = SbSystemGetLocaleId();
Expand Down Expand Up @@ -186,7 +198,9 @@ base::flat_map<std::string, std::string> Configurator::ExtraRequestParams()
return params;
}

std::string Configurator::GetDownloadPreference() const { return {}; }
std::string Configurator::GetDownloadPreference() const {
return {};
}

scoped_refptr<update_client::NetworkFetcherFactory>
Configurator::GetNetworkFetcherFactory() {
Expand All @@ -202,11 +216,17 @@ scoped_refptr<update_client::PatcherFactory> Configurator::GetPatcherFactory() {
return patch_factory_;
}

bool Configurator::EnabledDeltas() const { return false; }
bool Configurator::EnabledDeltas() const {
return false;
}

bool Configurator::EnabledComponentUpdates() const { return false; }
bool Configurator::EnabledComponentUpdates() const {
return false;
}

bool Configurator::EnabledBackgroundDownloader() const { return false; }
bool Configurator::EnabledBackgroundDownloader() const {
return false;
}

// TODO: enable cup signing
bool Configurator::EnabledCupSigning() const { return false; }
Expand All @@ -220,9 +240,13 @@ update_client::ActivityDataService* Configurator::GetActivityDataService()
return nullptr;
}

bool Configurator::IsPerUserInstall() const { return true; }
bool Configurator::IsPerUserInstall() const {
return true;
}

std::vector<uint8_t> Configurator::GetRunActionKeyHash() const { return {}; }
std::vector<uint8_t> Configurator::GetRunActionKeyHash() const {
return {};
}

std::string Configurator::GetAppGuidHelper(const std::string& updater_channel,
const std::string& version) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COBALT_UPDATER_CONFIGURATOR_H_
#define COBALT_UPDATER_CONFIGURATOR_H_
#ifndef CHROME_UPDATER_CONFIGURATOR_H_
#define CHROME_UPDATER_CONFIGURATOR_H_

#include <stdint.h>

Expand Down Expand Up @@ -123,4 +123,4 @@ class Configurator : public update_client::Configurator {
} // namespace updater
} // namespace cobalt

#endif // COBALT_UPDATER_CONFIGURATOR_H_
#endif // CHROME_UPDATER_CONFIGURATOR_H_
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "cobalt/updater/configurator.h"
#include "chrome/updater/configurator.h"

#include "testing/gtest/include/gtest/gtest.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cobalt/updater/crash_client.h"
#include "chrome/updater/crash_client.h"

#include <algorithm>
#include <vector>
Expand All @@ -13,7 +13,7 @@
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "cobalt/updater/utils.h"
#include "chrome/updater/util.h"
#include "third_party/crashpad/crashpad/client/crash_report_database.h"
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
#include "third_party/crashpad/crashpad/client/prune_crash_reports.h"
Expand All @@ -37,7 +37,6 @@ int __cdecl HandleWinProcException(EXCEPTION_POINTERS* exception_pointers) {

} // namespace

namespace cobalt {
namespace updater {

CrashClient::CrashClient() = default;
Expand All @@ -56,7 +55,7 @@ bool CrashClient::InitializeDatabaseOnly() {
base::PathService::Get(base::FILE_EXE, &handler_path);

base::FilePath database_path;
if (!CreateProductDirectory(&database_path)) {
if (!GetProductDirectory(&database_path)) {
LOG(ERROR) << "Failed to get the database path.";
return false;
}
Expand All @@ -73,7 +72,8 @@ bool CrashClient::InitializeDatabaseOnly() {
bool CrashClient::InitializeCrashReporting() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

if (!InitializeDatabaseOnly()) return false;
if (!InitializeDatabaseOnly())
return false;

#if defined(OS_WIN)
// Catch exceptions thrown from a window procedure.
Expand Down Expand Up @@ -157,4 +157,3 @@ bool CrashClient::IsUploadEnabled() {
}

} // namespace updater
} // namespace cobalt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COBALT_UPDATER_CRASH_CLIENT_H_
#define COBALT_UPDATER_CRASH_CLIENT_H_
#ifndef CHROME_UPDATER_CRASH_CLIENT_H_
#define CHROME_UPDATER_CRASH_CLIENT_H_

#include <memory>
#include <string>
Expand All @@ -20,7 +20,6 @@ namespace crashpad {
class CrashReportDatabase;
} // namespace crashpad

namespace cobalt {
namespace updater {

// This class manages interaction with the crash reporter.
Expand Down Expand Up @@ -57,6 +56,5 @@ class CrashClient {
};

} // namespace updater
} // namespace cobalt

#endif // COBALT_UPDATER_CRASH_CLIENT_H_
#endif // CHROME_UPDATER_CRASH_CLIENT_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cobalt/updater/crash_reporter.h"
#include "chrome/updater/crash_reporter.h"

#include <map>
#include <memory>
Expand All @@ -17,11 +17,11 @@
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "cobalt/updater/updater_constants.h"
// #include "cobalt/updater/updater_version.h"
#include "cobalt/updater/utils.h"
// #include "third_party/crashpad/crashpad/client/crashpad_client.h"
// #include "third_party/crashpad/crashpad/handler/handler_main.h"
#include "chrome/updater/updater_constants.h"
#include "chrome/updater/updater_version.h"
#include "chrome/updater/util.h"
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
#include "third_party/crashpad/crashpad/handler/handler_main.h"

namespace {

Expand Down Expand Up @@ -50,7 +50,6 @@ void RemoveSwitchIfExisting(const char* switch_to_remove,

} // namespace

namespace cobalt {
namespace updater {

void StartCrashReporter(const std::string& version) {
Expand All @@ -62,7 +61,7 @@ void StartCrashReporter(const std::string& version) {
base::PathService::Get(base::FILE_EXE, &handler_path);

base::FilePath database_path;
if (!CreateProductDirectory(&database_path)) {
if (!GetProductDirectory(&database_path)) {
LOG(DFATAL) << "Failed to get the database path.";
return;
}
Expand Down Expand Up @@ -145,4 +144,3 @@ void UseCrashReporter(const base::string16& ipc_pipe_name) {
#endif // OS_WIN

} // namespace updater
} // namespace cobalt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COBALT_UPDATER_CRASH_REPORTER_H_
#define COBALT_UPDATER_CRASH_REPORTER_H_
#ifndef CHROME_UPDATER_CRASH_REPORTER_H_
#define CHROME_UPDATER_CRASH_REPORTER_H_

#include <string>

#include "base/strings/string16.h"
#include "build/build_config.h"

namespace cobalt {
namespace updater {

// Starts a new instance of this executable running as the crash reporter
// process.
void StartCrashReporter(const std::string& version);

// Runs the crash reporter task runner within the current process. On return,
// Runs the crash reporter message loop within the current process. On return,
// the current process should exit.
int CrashReporterMain();

Expand All @@ -35,6 +34,5 @@ void UseCrashReporter(const base::string16& ipc_pipe_name);
#endif // OS_WIN

} // namespace updater
} // namespace cobalt

#endif // COBALT_UPDATER_CRASH_REPORTER_H_
#endif // CHROME_UPDATER_CRASH_REPORTER_H_
File renamed without changes.
Loading

0 comments on commit cddc2d7

Please sign in to comment.