Skip to content

Commit

Permalink
Address Web Discovery feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
DJAndries committed Oct 30, 2024
1 parent 5b90bd3 commit 8b00999
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion components/web_discovery/browser/credential_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "brave/components/web_discovery/browser/util.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
Expand Down Expand Up @@ -239,7 +240,7 @@ bool CredentialManager::ProcessJoinResponse(
auto& url_loader = join_url_loaders_[date];
auto* response_info = url_loader->ResponseInfo();
if (!response_body || !response_info ||
response_info->headers->response_code() != 200) {
response_info->headers->response_code() != net::HttpStatusCode::HTTP_OK) {
VLOG(1) << "Failed to fetch credentials for " << date;
return false;
}
Expand Down
9 changes: 6 additions & 3 deletions components/web_discovery/browser/server_config_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "brave/components/web_discovery/browser/pref_names.h"
#include "brave/components/web_discovery/browser/util.h"
#include "components/prefs/pref_service.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
Expand Down Expand Up @@ -332,8 +333,10 @@ void ServerConfigLoader::OnConfigResponsesDownloaded(
auto* quorum_response_info = quorum_config_url_loader_->ResponseInfo();
if (!collector_response_body || !quorum_response_body ||
!collector_response_info || !quorum_response_info ||
collector_response_info->headers->response_code() != 200 ||
quorum_response_info->headers->response_code() != 200) {
collector_response_info->headers->response_code() !=
net::HttpStatusCode::HTTP_OK ||
quorum_response_info->headers->response_code() !=
net::HttpStatusCode::HTTP_OK) {
VLOG(1) << "Failed to download one or more server configs";
OnConfigResponsesProcessed(nullptr);
return;
Expand Down Expand Up @@ -438,7 +441,7 @@ void ServerConfigLoader::OnPatternsResponse(
std::optional<std::string> response_body) {
auto* response_info = patterns_url_loader_->ResponseInfo();
if (!response_body || !response_info ||
response_info->headers->response_code() != 200) {
response_info->headers->response_code() != net::HttpStatusCode::HTTP_OK) {
VLOG(1) << "Failed to retrieve patterns file";
HandlePatternsStatus(false);
return;
Expand Down

0 comments on commit 8b00999

Please sign in to comment.