Skip to content

Commit

Permalink
Account for new HistoryModelTypeController function signature
Browse files Browse the repository at this point in the history
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/5f7858ba874b7339f9fdadd1b54f3a13e23ab0f4

commit 5f7858ba874b7339f9fdadd1b54f3a13e23ab0f4
Author: Marc Treib <[email protected]>
Date:   Mon Sep 11 15:42:55 2023 +0000

    History Sync cleanup: Simplify HistoryModelTypeController

    This controller used to be used for both HISTORY and TYPED_URLS.
    Now TYPED_URLS is gone, allowing for some simplification.

    Bug: 1365291
  • Loading branch information
emerick authored and cdesouza-chromium committed Oct 23, 2023
1 parent 300344e commit a58caef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@

#include "brave/components/history/core/browser/sync/brave_history_model_type_controller.h"

#include "base/feature_list.h"
#include "components/sync/base/features.h"

namespace history {

BraveHistoryModelTypeController::BraveHistoryModelTypeController(
syncer::ModelType model_type,
syncer::SyncService* sync_service,
signin::IdentityManager* identity_manager,
HistoryService* history_service,
PrefService* pref_service)
: HistoryModelTypeController(model_type,
sync_service,
: HistoryModelTypeController(sync_service,
identity_manager,
history_service,
pref_service) {}
Expand All @@ -26,16 +21,6 @@ BraveHistoryModelTypeController::~BraveHistoryModelTypeController() = default;

syncer::DataTypeController::PreconditionState
BraveHistoryModelTypeController::GetPreconditionState() const {
if (!base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType)) {
DCHECK_EQ(type(), syncer::TYPED_URLS);
return HistoryModelTypeController::GetPreconditionState();
}

// If the History feature flag is enabled, HISTORY replaces TYPED_URLS.
if (type() == syncer::TYPED_URLS) {
return PreconditionState::kMustStopAndClearData;
}
DCHECK_EQ(type(), syncer::HISTORY);
return PreconditionState::kPreconditionsMet;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class HistoryService;

class BraveHistoryModelTypeController : public HistoryModelTypeController {
public:
BraveHistoryModelTypeController(syncer::ModelType model_type,
syncer::SyncService* sync_service,
BraveHistoryModelTypeController(syncer::SyncService* sync_service,
signin::IdentityManager* identity_manager,
HistoryService* history_service,
PrefService* pref_service);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ TEST_F(BraveSyncServiceImplTest, HistoryPreconditions) {

auto history_model_type_controller =
std::make_unique<history::BraveHistoryModelTypeController>(
HISTORY, brave_sync_service_impl(), identity_manager(), nullptr,
brave_sync_service_impl(), identity_manager(), nullptr,
pref_service());

auto history_precondition_state =
Expand Down

0 comments on commit a58caef

Please sign in to comment.