Skip to content

Commit

Permalink
Rename methods and variables to be more accurate
Browse files Browse the repository at this point in the history
b/325626249

Change-Id: I30353d0559453a62793e3724c0152d2cadf97e64
  • Loading branch information
TyHolc committed Aug 15, 2024
1 parent 390c760 commit 8e46293
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 63 deletions.
26 changes: 13 additions & 13 deletions chrome/updater/configurator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ int Configurator::UpdateDelay() const {

std::vector<GURL> Configurator::UpdateUrl() const {
#if !defined(COBALT_BUILD_TYPE_GOLD)
if (allow_self_signed_builds_ && !custom_update_server_.empty()) {
return std::vector<GURL>{GURL(custom_update_server_)};
if (allow_self_signed_packages_ && !update_server_url_.empty()) {
return std::vector<GURL>{GURL(update_server_url_)};
}
#endif // !defined(COBALT_BUILD_TYPE_GOLD)
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
Expand Down Expand Up @@ -349,23 +349,23 @@ void Configurator::SetUseCompressedUpdates(bool use_compressed_updates) {
use_compressed_updates_.store(use_compressed_updates);
}

bool Configurator::GetAllowSelfSignedBuilds() const {
return allow_self_signed_builds_.load();
bool Configurator::GetAllowSelfSignedPackages() const {
return allow_self_signed_packages_.load();
}

void Configurator::SetAllowSelfSignedBuilds(bool allow_self_signed_builds) {
allow_self_signed_builds_.store(allow_self_signed_builds);
void Configurator::SetAllowSelfSignedPackages(bool allow_self_signed_packages) {
allow_self_signed_packages_.store(allow_self_signed_packages);
}

std::string Configurator::GetCustomUpdateServer() const {
base::AutoLock auto_lock(const_cast<base::Lock&>(custom_update_server_lock_));
return custom_update_server_;
std::string Configurator::GetUpdateServerUrl() const {
base::AutoLock auto_lock(const_cast<base::Lock&>(update_server_url_lock_));
return update_server_url_;
}

void Configurator::SetCustomUpdateServer(const std::string& custom_update_server) {
LOG(INFO) << "Configurator::SetCustomUpdateServer custom_update_server=" << custom_update_server;
base::AutoLock auto_lock(custom_update_server_lock_);
custom_update_server_ = custom_update_server;
void Configurator::SetUpdateServerUrl(const std::string& update_server_url) {
LOG(INFO) << "Configurator::SetUpdateServerUrl update_server_url=" << update_server_url;
base::AutoLock auto_lock(update_server_url_lock_);
update_server_url_ = update_server_url;
}

} // namespace updater
Expand Down
14 changes: 7 additions & 7 deletions chrome/updater/configurator.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ class Configurator : public update_client::Configurator {
static std::string GetAppGuidHelper(const std::string& updater_channel,
const std::string& version);

bool GetAllowSelfSignedBuilds() const override;
void SetAllowSelfSignedBuilds(bool allow_self_signed_builds) override;
bool GetAllowSelfSignedPackages() const override;
void SetAllowSelfSignedPackages(bool allow_self_signed_packages) override;

std::string GetCustomUpdateServer() const override;
void SetCustomUpdateServer(const std::string& custom_update_server) override;
std::string GetUpdateServerUrl() const override;
void SetUpdateServerUrl(const std::string& update_server_url) override;

private:
friend class base::RefCountedThreadSafe<Configurator>;
Expand All @@ -121,9 +121,9 @@ class Configurator : public update_client::Configurator {
uint64_t min_free_space_bytes_ = 48 * 1024 * 1024;
base::Lock min_free_space_bytes_lock_;
std::atomic_bool use_compressed_updates_;
std::atomic_bool allow_self_signed_builds_;
std::string custom_update_server_;
base::Lock custom_update_server_lock_;
std::atomic_bool allow_self_signed_packages_;
std::string update_server_url_;
base::Lock update_server_url_lock_;

DISALLOW_COPY_AND_ASSIGN(Configurator);
};
Expand Down
50 changes: 25 additions & 25 deletions chrome/updater/updater_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,16 @@ void UpdaterModule::Update() {
}

#if defined(COBALT_BUILD_TYPE_GOLD)
bool skipVerifyPublicKeyHash = false;
bool skip_verify_public_key_hash = false;
#else // defined(COBALT_BUILD_TYPE_GOLD)
bool skipVerifyPublicKeyHash = GetAllowSelfSignedBuilds();
bool skip_verify_public_key_hash = GetAllowSelfSignedPackages();
#endif // defined(COBALT_BUILD_TYPE_GOLD)

update_client_->Update(
app_ids,
base::BindOnce(
[](base::Version manifest_version,
bool skipVerifyPublicKeyHash,
bool skip_verify_public_key_hash,
const std::vector<std::string>& ids)
-> std::vector<base::Optional<update_client::CrxComponent>> {
update_client::CrxComponent component;
Expand All @@ -286,15 +286,15 @@ void UpdaterModule::Update() {
component.pk_hash.assign(std::begin(kCobaltPublicKeyHash),
std::end(kCobaltPublicKeyHash));
#if !defined(COBALT_BUILD_TYPE_GOLD)
if (skipVerifyPublicKeyHash) {
if (skip_verify_public_key_hash) {
component.pk_hash.clear();
}
#endif // !defined(COBALT_BUILD_TYPE_GOLD)
component.requires_network_encryption = true;
component.crx_format_requirement = crx_file::VerifierFormat::CRX3;
return {component};
},
manifest_version, skipVerifyPublicKeyHash),
manifest_version, skip_verify_public_key_hash),
false,
base::BindOnce(
[](base::OnceClosure closure, update_client::Error error) {
Expand Down Expand Up @@ -444,54 +444,54 @@ void UpdaterModule::SetUseCompressedUpdates(bool use_compressed_updates) {
config->SetUseCompressedUpdates(use_compressed_updates);
}

bool UpdaterModule::GetAllowSelfSignedBuilds() const {
LOG(INFO) << "UpdaterModule::GetAllowSelfSignedBuilds";
bool UpdaterModule::GetAllowSelfSignedPackages() const {
LOG(INFO) << "UpdaterModule::GetAllowSelfSignedPackages";
auto config = updater_configurator_;
if (!config) {
LOG(ERROR) << "UpdaterModule::GetAllowSelfSignedBuilds: missing configurator";
LOG(ERROR) << "UpdaterModule::GetAllowSelfSignedPackages: missing configurator";
return false;
}

bool allow_self_signed_builds = config->GetAllowSelfSignedBuilds();
LOG(INFO) << "UpdaterModule::GetAllowSelfSignedBuilds allow_self_signed_builds="
bool allow_self_signed_builds = config->GetAllowSelfSignedPackages();
LOG(INFO) << "UpdaterModule::GetAllowSelfSignedPackages allow_self_signed_builds="
<< allow_self_signed_builds;
return allow_self_signed_builds;
}

void UpdaterModule::SetAllowSelfSignedBuilds(bool allow_self_signed_builds) {
LOG(INFO) << "UpdaterModule::SetAllowSelfSignedBuilds";
void UpdaterModule::SetAllowSelfSignedPackages(bool allow_self_signed_builds) {
LOG(INFO) << "UpdaterModule::SetAllowSelfSignedPackages";
auto config = updater_configurator_;
if (!config) {
LOG(ERROR) << "UpdaterModule::SetAllowSelfSignedBuilds: missing configurator";
LOG(ERROR) << "UpdaterModule::SetAllowSelfSignedPackages: missing configurator";
return;
}

config->SetAllowSelfSignedBuilds(allow_self_signed_builds);
config->SetAllowSelfSignedPackages(allow_self_signed_builds);
}

std::string UpdaterModule::GetCustomUpdateServer() const {
LOG(INFO) << "UpdaterModule::GetCustomUpdateServer";
std::string UpdaterModule::GetUpdateServerUrl() const {
LOG(INFO) << "UpdaterModule::GetUpdateServerUrl";
auto config = updater_configurator_;
if (!config) {
LOG(ERROR) << "UpdaterModule::GetCustomUpdateServer: missing configurator";
LOG(ERROR) << "UpdaterModule::GetUpdateServerUrl: missing configurator";
return "";
}

std::string custom_update_server = config->GetCustomUpdateServer();
LOG(INFO) << "UpdaterModule::GetCustomUpdateServer custom_update_server="
<< custom_update_server;
return custom_update_server;
std::string update_server_url = config->GetUpdateServerUrl();
LOG(INFO) << "UpdaterModule::GetUpdateServerUrl update_server_url="
<< update_server_url;
return update_server_url;
}

void UpdaterModule::SetCustomUpdateServer(const std::string& custom_update_server) {
LOG(INFO) << "UpdaterModule::SetCustomUpdateServer";
void UpdaterModule::SetUpdateServerUrl(const std::string& update_server_url) {
LOG(INFO) << "UpdaterModule::SetUpdateServerUrl";
auto config = updater_configurator_;
if(!config) {
LOG(ERROR) << "UpdaterModule::SetCustomUpdateServer: missing configurator";
LOG(ERROR) << "UpdaterModule::SetUpdateServerUrl: missing configurator";
return;
}

config->SetCustomUpdateServer(custom_update_server);
config->SetUpdateServerUrl(update_server_url);
}

} // namespace updater
Expand Down
8 changes: 4 additions & 4 deletions chrome/updater/updater_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ class UpdaterModule {
bool GetUseCompressedUpdates() const;
void SetUseCompressedUpdates(bool use_compressed_updates);

bool GetAllowSelfSignedBuilds() const;
void SetAllowSelfSignedBuilds(bool allow_self_signed_builds);
bool GetAllowSelfSignedPackages() const;
void SetAllowSelfSignedPackages(bool allow_self_signed_packages);

std::string GetCustomUpdateServer() const;
void SetCustomUpdateServer(const std::string& custom_update_server);
std::string GetUpdateServerUrl() const;
void SetUpdateServerUrl(const std::string& update_server_url);

void MarkSuccessful();

Expand Down
12 changes: 6 additions & 6 deletions cobalt/h5vcc/h5vcc_updater.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ void H5vccUpdater::SetUseCompressedUpdates(bool use_compressed_updates) {
return updater_module_->SetUseCompressedUpdates(use_compressed_updates);
}

void H5vccUpdater::SetAllowSelfSignedBuilds(bool allow_self_signed_builds) {
void H5vccUpdater::SetAllowSelfSignedPackages(bool allow_self_signed_packages) {
#if !defined(COBALT_BUILD_TYPE_GOLD)
if (updater_module_) {
updater_module_->SetAllowSelfSignedBuilds(allow_self_signed_builds);
updater_module_->SetAllowSelfSignedPackages(allow_self_signed_packages);
}
#endif // !defined(COBALT_BUILD_TYPE_GOLD)
}

bool H5vccUpdater::GetAllowSelfSignedBuilds() {
bool H5vccUpdater::GetAllowSelfSignedPackages() {
if (updater_module_) {
return updater_module_->GetAllowSelfSignedBuilds();
return updater_module_->GetAllowSelfSignedPackages();
}

return false;
Expand All @@ -110,14 +110,14 @@ bool H5vccUpdater::GetAllowSelfSignedBuilds() {
void H5vccUpdater::SetUpdateServerUrl(const std::string& update_server_url) {
#if !defined(COBALT_BUILD_TYPE_GOLD)
if (updater_module_) {
updater_module_->SetCustomUpdateServer(update_server_url);
updater_module_->SetUpdateServerUrl(update_server_url);
}
#endif // !defined(COBALT_BUILD_TYPE_GOLD)
}

std::string H5vccUpdater::GetUpdateServerUrl() const {
if (updater_module_) {
return updater_module_->GetCustomUpdateServer();
return updater_module_->GetUpdateServerUrl();
}

return "";
Expand Down
4 changes: 2 additions & 2 deletions cobalt/h5vcc/h5vcc_updater.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class H5vccUpdater : public script::Wrappable {
bool GetUseCompressedUpdates() const;
void SetUseCompressedUpdates(bool use_compressed_updates);

void SetAllowSelfSignedBuilds(bool allow_self_signed_builds);
bool GetAllowSelfSignedBuilds();
void SetAllowSelfSignedPackages(bool allow_self_signed_packages);
bool GetAllowSelfSignedPackages();

void SetUpdateServerUrl(const std::string& update_server_url);
std::string GetUpdateServerUrl() const;
Expand Down
4 changes: 2 additions & 2 deletions cobalt/h5vcc/h5vcc_updater.idl
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ interface H5vccUpdater {

// Toggles the ability to load self-signed builds in the updater. This should
// only be used for testing and should not be available in production.
void setAllowSelfSignedBuilds(boolean allow_self_signed_builds);
boolean getAllowSelfSignedBuilds();
void setAllowSelfSignedPackages(boolean allow_self_signed_packages);
boolean getAllowSelfSignedPackages();

// Sets the URL the updater will use for updates. This should only be used for
// testing and should not be available in production.
Expand Down
8 changes: 4 additions & 4 deletions components/update_client/configurator.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ class Configurator : public base::RefCountedThreadSafe<Configurator> {
virtual bool GetUseCompressedUpdates() const = 0;
virtual void SetUseCompressedUpdates(bool use_compressed_updates) = 0;

virtual bool GetAllowSelfSignedBuilds() const = 0;
virtual void SetAllowSelfSignedBuilds(bool allow_self_signed_builds) = 0;
virtual bool GetAllowSelfSignedPackages() const = 0;
virtual void SetAllowSelfSignedPackages(bool allow_self_signed_packages) = 0;

virtual std::string GetCustomUpdateServer() const = 0;
virtual void SetCustomUpdateServer(const std::string& custom_update_server) = 0;
virtual std::string GetUpdateServerUrl() const = 0;
virtual void SetUpdateServerUrl(const std::string& update_server_url) = 0;
#endif

protected:
Expand Down

0 comments on commit 8e46293

Please sign in to comment.