Skip to content

Commit 3dc3465

Browse files
committed
Upgrade to 74.0.3729.75
1 parent 69a6588 commit 3dc3465

38 files changed

Lines changed: 228 additions & 273 deletions

File tree

app/brave_main_delegate.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "chrome/common/chrome_switches.h"
2727
#include "components/autofill/core/common/autofill_features.h"
2828
#include "components/password_manager/core/common/password_manager_features.h"
29+
#include "components/sync/driver/sync_driver_switches.h"
2930
#include "components/unified_consent/feature.h"
3031
#include "content/public/common/content_features.h"
3132
#include "extensions/common/extension_features.h"
@@ -145,6 +146,9 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) {
145146
autofill::features::kAutofillServerCommunication.name,
146147
features::kAudioServiceOutOfProcess.name,
147148
features::kDefaultEnableOopRasterization.name,
149+
// TODO(darkdh): remove this when USS bookmarks is mature
150+
// 84919fdb99b162030a1113d5990667885b774064
151+
switches::kSyncUSSBookmarks.name,
148152
network::features::kNetworkService.name,
149153
unified_consent::kUnifiedConsent.name,
150154
};

browser/extensions/api/brave_sync_api.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace api {
2222
namespace {
2323

2424
ProfileSyncService* GetProfileSyncService(BrowserContext* browser_context) {
25-
return ProfileSyncServiceFactory::GetForProfile(
25+
return ProfileSyncServiceFactory::GetAsProfileSyncServiceForProfile(
2626
Profile::FromBrowserContext(browser_context));
2727
}
2828

browser/ui/webui/sync/sync_ui.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void SyncUIDOMHandler::Init() {
121121
Profile* profile = Profile::FromWebUI(web_ui());
122122
sync_service_ =
123123
static_cast<brave_sync::BraveSyncService*>(
124-
ProfileSyncServiceFactory::GetForProfile(profile));
124+
ProfileSyncServiceFactory::GetAsProfileSyncServiceForProfile(profile));
125125
if (sync_service_)
126126
sync_service_->AddObserver(this);
127127
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#include "chrome/browser/bookmarks/chrome_bookmark_client.h"
22
#include "brave/browser/bookmarks/brave_bookmark_client.h"
3-
#define ChromeBookmarkClient BraveBookmarkClient
3+
// Stop loading old Brave permanent nodes, GetEntityForBookmarkNode will fail
4+
// see 9645795920481e2a80613a72aeddba1a65490dac
5+
// #define ChromeBookmarkClient BraveBookmarkClient
46
#include "../../../../../../chrome/browser/bookmarks/bookmark_model_factory.cc"

chromium_src/components/browser_sync/profile_sync_service.cc

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ syncer::SyncCredentials GetDummyCredentials();
66
AccountInfo GetDummyAccountInfo();
77
}
88
}
9-
namespace syncer {
10-
const int64_t kBraveDefaultShortPollIntervalSeconds = 60;
11-
const int64_t kBraveDefaultLongPollIntervalSeconds = 90;
12-
}
9+
10+
// For use_transport_only_mode
11+
#define IsSyncFeatureEnabled IsBraveSyncEnabled
1312
#include "../../../../components/browser_sync/profile_sync_service.cc"
1413

1514
#include "base/bind.h"
@@ -22,12 +21,18 @@ const int64_t kBraveDefaultLongPollIntervalSeconds = 90;
2221
#include "brave/components/brave_sync/sync_devices.h"
2322
#include "brave/components/brave_sync/tools.h"
2423
#include "brave/components/brave_sync/values_conv.h"
24+
#include "chrome/browser/sync/chrome_sync_client.h"
2525
#include "components/bookmarks/browser/bookmark_model.h"
2626
#include "components/sync/engine_impl/syncer.h"
2727
#include "content/public/browser/browser_thread.h"
2828
#include "net/base/network_interfaces.h"
2929
#include "ui/base/models/tree_node_iterator.h"
3030

31+
namespace syncer {
32+
const int64_t kBraveDefaultShortPollIntervalSeconds = 60;
33+
const int64_t kBraveDefaultLongPollIntervalSeconds = 90;
34+
}
35+
3136
namespace browser_sync {
3237

3338
using brave_sync::GetRecordsCallback;
@@ -484,9 +489,6 @@ void ProfileSyncService::OnSaveInitData(const Uint8Array& seed,
484489

485490
brave_sync_configured_ = true;
486491

487-
user_settings_->SetChosenDataTypes(false, syncer::ModelTypeSet());
488-
OnSetSyncBookmarks(true);
489-
490492
brave_sync_initializing_ = false;
491493
}
492494

@@ -504,6 +506,8 @@ void ProfileSyncService::OnSyncReady() {
504506
DCHECK(false == brave_sync_initialized_);
505507
brave_sync_initialized_ = true;
506508

509+
user_settings_->SetChosenDataTypes(false, syncer::ModelTypeSet());
510+
OnSetSyncBookmarks(true);
507511
user_settings_->SetSyncRequested(true);
508512
}
509513

@@ -524,7 +528,9 @@ void ProfileSyncService::OnGetExistingObjects(
524528
std::make_unique<SyncRecordAndExistingList>();
525529
CreateResolveList(
526530
*records.get(), records_and_existing_objects.get(),
527-
sync_client_->GetBookmarkModel(),
531+
// TODO(darkdh): find another way to obtain bookmark model
532+
// change introduced in 83b9663e3814ef7e53af5009d10033b89955db44
533+
static_cast<ChromeSyncClient*>(sync_client_.get())->GetBookmarkModel(),
528534
brave_sync_prefs_.get());
529535
GetBraveSyncClient()->SendResolveSyncRecords(
530536
category_name, std::move(records_and_existing_objects));
@@ -764,6 +770,15 @@ void ProfileSyncService::BraveEngineParamsInit(
764770
params->poll_sync_cycle_delegate_function =
765771
base::BindRepeating(&ProfileSyncService::OnPollSyncCycle,
766772
sync_enabled_weak_factory_.GetWeakPtr());
773+
774+
params->credentials = GetDummyCredentials();
775+
776+
sync_prefs_.SetShortPollInterval(
777+
base::TimeDelta::FromSeconds(
778+
syncer::kBraveDefaultShortPollIntervalSeconds));
779+
sync_prefs_.SetLongPollInterval(
780+
base::TimeDelta::FromSeconds(
781+
syncer::kBraveDefaultLongPollIntervalSeconds));
767782
}
768783

769784
void ProfileSyncService::OnNudgeSyncCycle(

chromium_src/components/sync/driver/glue/sync_backend_host_core.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ namespace syncer {
77
void SyncBackendHostCore::OnNudgeSyncCycle(
88
brave_sync::RecordsListPtr records_list) {
99
host_.Call(FROM_HERE,
10-
&SyncBackendHostImpl::HandleNudgeSyncCycle,
10+
&SyncEngineImpl::HandleNudgeSyncCycle,
1111
base::Passed(&records_list));
1212
}
1313

1414
void SyncBackendHostCore::OnPollSyncCycle(GetRecordsCallback cb,
1515
base::WaitableEvent* wevent) {
1616
host_.Call(FROM_HERE,
17-
&SyncBackendHostImpl::HandlePollSyncCycle, cb, wevent);
17+
&SyncEngineImpl::HandlePollSyncCycle, cb, wevent);
1818
}
1919

2020
void SyncBackendHostCore::DoDispatchGetRecordsCallback(

chromium_src/components/sync/driver/glue/sync_backend_host_impl.cc renamed to chromium_src/components/sync/driver/glue/sync_engine_impl.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
#include "../../../../../../components/sync/driver/glue/sync_backend_host_impl.cc"
1+
#include "../../../../../../components/sync/driver/glue/sync_engine_impl.cc"
22

33
#include "brave/components/brave_sync/jslib_messages.h"
44

55
namespace syncer {
66

7-
void SyncBackendHostImpl::HandleNudgeSyncCycle(
7+
void SyncEngineImpl::HandleNudgeSyncCycle(
88
brave_sync::RecordsListPtr records_list) {
99
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
1010
DCHECK(nudge_sync_cycle_delegate_function_);
1111
nudge_sync_cycle_delegate_function_.Run(std::move(records_list));
1212
}
1313

14-
void SyncBackendHostImpl::HandlePollSyncCycle(
14+
void SyncEngineImpl::HandlePollSyncCycle(
1515
GetRecordsCallback cb,
1616
base::WaitableEvent* wevent) {
1717
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
1818
DCHECK(poll_sync_cycle_delegate_function_);
1919
poll_sync_cycle_delegate_function_.Run(cb, wevent);
2020
}
2121

22-
void SyncBackendHostImpl::DispatchGetRecordsCallback(
22+
void SyncEngineImpl::DispatchGetRecordsCallback(
2323
GetRecordsCallback cb, std::unique_ptr<RecordsList> records) {
2424
sync_task_runner_->PostTask(
2525
FROM_HERE,

chromium_src/components/sync/driver/glue/sync_backend_host_impl.h renamed to chromium_src/components/sync/driver/glue/sync_engine_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ namespace syncer {
33
using brave_sync::GetRecordsCallback;
44
using brave_sync::RecordsList;
55
} // namespace syncer
6-
#include "../../../../../../components/sync/driver/glue/sync_backend_host_impl.h"
6+
#include "../../../../../../components/sync/driver/glue/sync_engine_impl.h"

chromium_src/components/sync/engine_impl/get_updates_processor.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ namespace {
2222
using brave_sync::jslib::Bookmark;
2323
using brave_sync::jslib::SyncRecord;
2424
using syncable::Id;
25-
static const char kBookmarkBarTag[] = "bookmark_bar";
26-
static const char kOtherBookmarksTag[] = "other_bookmarks";
25+
static const char kBookmarkBarFolderServerTag[] = "bookmark_bar";
2726
static const char kBookmarkBarFolderName[] = "Bookmark Bar";
27+
static const char kOtherBookmarksFolderServerTag[] = "other_bookmarks";
2828
static const char kOtherBookmarksFolderName[] = "Other Bookmarks";
29+
static const char kSyncedBookmarksFolderServerTag[] = "synced_bookmarks";
30+
static const char kSyncedBookmarksFolderName[] = "Synced Bookmarks";
2931
// The parent tag for children of the root entity. Entities with this parent are
3032
// referred to as top level enities.
3133
static const char kRootParentTag[] = "0";
@@ -145,9 +147,9 @@ void AddBookmarkNode(sync_pb::SyncEntity* entity, const SyncRecord* record) {
145147
if (!bookmark_record.parentFolderObjectId.empty())
146148
entity->set_parent_id_string(bookmark_record.parentFolderObjectId);
147149
else if (!bookmark_record.hideInToolbar)
148-
entity->set_parent_id_string(std::string(kBookmarkBarTag));
150+
entity->set_parent_id_string(std::string(kBookmarkBarFolderServerTag));
149151
else
150-
entity->set_parent_id_string(std::string(kOtherBookmarksTag));
152+
entity->set_parent_id_string(std::string(kOtherBookmarksFolderServerTag));
151153
entity->set_non_unique_name(bookmark_record.site.title);
152154
entity->set_folder(bookmark_record.isFolder);
153155

@@ -181,9 +183,13 @@ void ConstructUpdateResponse(sync_pb::GetUpdatesResponse* gu_response,
181183
if (type == BOOKMARKS) {
182184
google::protobuf::RepeatedPtrField<sync_pb::SyncEntity> entities;
183185
AddRootForType(entities.Add(), BOOKMARKS);
184-
AddPermanentNode(entities.Add(), kBookmarkBarFolderName, kBookmarkBarTag);
186+
AddPermanentNode(entities.Add(), kBookmarkBarFolderName,
187+
kBookmarkBarFolderServerTag);
185188
AddPermanentNode(entities.Add(), kOtherBookmarksFolderName,
186-
kOtherBookmarksTag);
189+
kOtherBookmarksFolderServerTag);
190+
// required since 84f01c4c006cf89941138f3591db129a5b3cde54
191+
AddPermanentNode(entities.Add(), kSyncedBookmarksFolderName,
192+
kSyncedBookmarksFolderServerTag);
187193
if (records) {
188194
for (const auto& record : *records.get()) {
189195
AddBookmarkNode(entities.Add(), record.get());

chromium_src/components/sync/engine_impl/sync_scheduler_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void SyncSchedulerImpl::SetNudgeAndPollDelegate(
2525

2626
void SyncSchedulerImpl::TryBraveSyncCycleJob() {
2727
SyncCycle cycle(cycle_context_, this);
28-
if (mode_ != CONFIGURATION_MODE && mode_ != CLEAR_SERVER_DATA_MODE) {
28+
if (mode_ != CONFIGURATION_MODE) {
2929
syncer_->DownloadBraveRecords(&cycle);
3030
}
3131
}

0 commit comments

Comments
 (0)