Skip to content

Commit

Permalink
Enable History datatype for Sync (#20329)
Browse files Browse the repository at this point in the history
* Reverted PR#16705 (Sync all history)

* Reverted PR#16478 (Display history sync diagnostic info)

* Reverted PR#20071 (Disable history sync datatype to fallback to typed urls datatype)

* Added overrides for HistoryModelTypeController and HistoryDeleteDirectivesModelTypeController to work
when encrypt everything option is on

* Add patch to sync history delete directives and history entities together

* Added unit test for LowPriorityUserTypes

* Enable encryption of history sync entities

* Added test for precondition state of history datatype controllers

* Modified: clean out HistoryDeleteDirectiveSpecifics::UrlDirective::url field, as it is unencrypted

* Added test to ensure we don't send url at HistoryDeleteDirectiveSpecifics::UrlDirective

* Modified ModelTypeTest.EncryptableUserTypes test to check History type

* Removed 'path_excludes' for the files removed in the current PR

---------

Co-authored-by: Darnell Andries <[email protected]>
  • Loading branch information
2 people authored and emerick committed Oct 25, 2023
1 parent 6b4bcf2 commit 5229870
Show file tree
Hide file tree
Showing 36 changed files with 380 additions and 481 deletions.
17 changes: 0 additions & 17 deletions browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -854,30 +854,13 @@
kOsDesktop | kOsAndroid, \
FEATURE_VALUE_TYPE(translate::kTranslate), \
}, \
{ \
"brave-sync-history-diagnostics", \
"Enable Brave Sync History Diagnostics", \
"Brave Sync History Diagnostics flag displays additional sync " \
"related information on History page", \
kOsAll, \
FEATURE_VALUE_TYPE( \
brave_sync::features::kBraveSyncHistoryDiagnostics), \
}, \
{ \
"restrict-event-source-pool", \
"Restrict Event Source Pool", \
"Limits simultaneous active WebSockets connections per eTLD+1", \
kOsAll, \
FEATURE_VALUE_TYPE(blink::features::kRestrictEventSourcePool), \
}, \
{ \
"brave-sync-send-all-history", \
"Send All History to Brave Sync", \
"With Send All History flag all sync entries are sent to Sync " \
"server including transitions of link, bookmark, reload, etc", \
kOsAll, \
FEATURE_VALUE_TYPE(brave_sync::features::kBraveSyncSendAllHistory), \
}, \
{ \
"brave-copy-clean-link-by-default", \
"Override default copy hotkey with copy clean link", \
Expand Down
1 change: 0 additions & 1 deletion build/config/brave_build.gni
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import("//brave/components/content_settings/core/browser/sources.gni")
import("//brave/components/omnibox/browser/sources.gni")
import("//brave/components/search_engines/sources.gni")
import("//brave/components/sync/service/sources.gni")
import("//brave/components/sync/sources.gni")
import("//brave/components/sync_device_info/sources.gni")
import("//brave/components/update_client/sources.gni")
import("//brave/installer/linux/sources.gni")
Expand Down
4 changes: 4 additions & 0 deletions chromium_src/components/browser_sync/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include_rules = [
"+brave/components/history/core/browser/sync/brave_history_delete_directives_model_type_controller.h",
"+brave/components/history/core/browser/sync/brave_history_model_type_controller.h",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Copyright (c) 2023 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */

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

#define HistoryDeleteDirectivesModelTypeController \
BraveHistoryDeleteDirectivesModelTypeController

#define HistoryModelTypeController BraveHistoryModelTypeController

#include "src/components/browser_sync/sync_api_component_factory_impl.cc"

#undef HistoryModelTypeController
#undef HistoryDeleteDirectivesModelTypeController
89 changes: 0 additions & 89 deletions chromium_src/components/history/core/browser/history_backend.cc

This file was deleted.

13 changes: 0 additions & 13 deletions chromium_src/components/history/core/browser/history_backend.h

This file was deleted.

3 changes: 3 additions & 0 deletions chromium_src/components/history/core/browser/sync/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include_rules = [
"+src/components/history/core/browser/sync/delete_directive_handler_unittest.cc",
]

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Copyright (c) 2023 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */

#include "components/history/core/browser/sync/delete_directive_handler.h"

#define CreateUrlDeleteDirective CreateUrlDeleteDirective_ChromiumImpl
#include "src/components/history/core/browser/sync/delete_directive_handler.cc"
#undef CreateUrlDeleteDirective

namespace history {

bool DeleteDirectiveHandler::CreateUrlDeleteDirective(const GURL& url) {
return false;
}

} // namespace history
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Copyright (c) 2023 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_DELETE_DIRECTIVE_HANDLER_H_
#define BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_DELETE_DIRECTIVE_HANDLER_H_

#define CreateTimeRangeDeleteDirective \
CreateUrlDeleteDirective_ChromiumImpl(const GURL& url); \
bool CreateTimeRangeDeleteDirective

#include "src/components/history/core/browser/sync/delete_directive_handler.h" // IWYU pragma: export

#undef CreateTimeRangeDeleteDirective

#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_HISTORY_CORE_BROWSER_SYNC_DELETE_DIRECTIVE_HANDLER_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Copyright (c) 2023 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */

#include "src/components/history/core/browser/sync/delete_directive_handler_unittest.cc"

namespace history {
namespace {

TEST_F(HistoryDeleteDirectiveHandlerTest,
BraveCreateUrlDeleteDirectiveReturnsFalse) {
EXPECT_FALSE(handler()->CreateUrlDeleteDirective(GURL("https://brave.com")));
}

} // namespace
} // namespace history

This file was deleted.

Loading

0 comments on commit 5229870

Please sign in to comment.