Skip to content

Commit

Permalink
Merge pull request #2010 from brave/brave-syncer
Browse files Browse the repository at this point in the history
Brave syncer
  • Loading branch information
darkdh committed Aug 23, 2019
1 parent 6452148 commit 56c2a47
Show file tree
Hide file tree
Showing 113 changed files with 4,684 additions and 4,769 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ deps = {
"vendor/bip39wally-core-native": "https://github.com/brave-intl/bip39wally-core-native.git@13bb40a215248cfbdd87d0a6b425c8397402e9e6",
"vendor/bat-native-anonize": "https://github.com/brave-intl/bat-native-anonize.git@e3742ba3e8942eea9e4755d91532491871bd3116",
"vendor/bat-native-tweetnacl": "https://github.com/brave-intl/bat-native-tweetnacl.git@1b4362968c8f22720bfb75af6f506d4ecc0f3116",
"components/brave_sync/extension/brave-sync": "https://github.com/brave/sync.git@e97e9e912552cd789cb2c1b1f327c77b32175317",
"components/brave_sync/extension/brave-sync": "https://github.com/brave/sync.git@91a68fdebc8962ca409045177438671f06a3c26a",
"components/brave_sync/extension/brave-crypto": "https://github.com/brave/crypto@0231e65ba211b152d742278319c545a83cb13fc0",
"vendor/bat-native-usermodel": "https://github.com/brave-intl/bat-native-usermodel.git@a82acda22d8cb255d86ee28734efb8ad886e9a49",
"vendor/challenge_bypass_ristretto_ffi": "https://github.com/brave-intl/challenge-bypass-ristretto-ffi.git@f88d942ddfaf61a4a6703355a77c4ef71bc95c35",
Expand Down
2 changes: 0 additions & 2 deletions browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ source_set("browser_process") {
"autocomplete/brave_autocomplete_provider_client.h",
"autocomplete/brave_autocomplete_scheme_classifier.cc",
"autocomplete/brave_autocomplete_scheme_classifier.h",
"bookmarks/brave_bookmark_client.cc",
"bookmarks/brave_bookmark_client.h",
"brave_browser_main_extra_parts.cc",
"brave_browser_main_extra_parts.h",
"brave_browser_main_parts.cc",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* Copyright (c) 2019 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 http://mozilla.org/MPL/2.0/. */

#include "brave/browser/autocomplete/brave_autocomplete_provider_client.h"

#include <memory>
#include <utility>
#include <vector>

#include "base/strings/utf_string_conversions.h"
#include "brave/common/webui_url_constants.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/testing_profile.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/test/fake_service_worker_context.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"

class BraveAutocompleteProviderClientUnitTest : public testing::Test {
public:
void SetUp() override {
profile_ = std::make_unique<TestingProfile>();
profile_ = CreateProfile();
client_ =
std::make_unique<BraveAutocompleteProviderClient>(profile_.get());
}
Expand All @@ -26,14 +33,24 @@ class BraveAutocompleteProviderClientUnitTest : public testing::Test {
return it != v.end();
}

protected:
private:
std::unique_ptr<TestingProfile> CreateProfile() {
TestingProfile::Builder builder;
auto prefs =
std::make_unique<sync_preferences::TestingPrefServiceSyncable>();
RegisterUserProfilePrefs(prefs->registry());
builder.SetPrefService(std::move(prefs));
return builder.Build();
}

content::TestBrowserThreadBundle test_browser_thread_bundle_;
std::unique_ptr<TestingProfile> profile_;
std::unique_ptr<BraveAutocompleteProviderClient> client_;
};

TEST_F(BraveAutocompleteProviderClientUnitTest,
SyncURLSuggestedNotSyncInternal) {
ASSERT_FALSE(BuiltinExists(base::ASCIIToUTF16(chrome::kChromeUISyncInternalsHost)));
ASSERT_FALSE(
BuiltinExists(base::ASCIIToUTF16(chrome::kChromeUISyncInternalsHost)));
ASSERT_TRUE(BuiltinExists(base::ASCIIToUTF16(kBraveUISyncHost)));
}
1 change: 0 additions & 1 deletion browser/autoplay/autoplay_permission_context_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "base/bind.h"
#include "base/macros.h"
#include "brave/common/pref_names.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/permissions/permission_request_id.h"
#include "chrome/browser/permissions/permission_request_manager.h"
Expand Down
40 changes: 0 additions & 40 deletions browser/bookmarks/brave_bookmark_client.cc

This file was deleted.

25 changes: 0 additions & 25 deletions browser/bookmarks/brave_bookmark_client.h

This file was deleted.

9 changes: 7 additions & 2 deletions browser/brave_content_browser_client_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "brave/common/pref_names.h"
#include "brave/components/brave_rewards/browser/buildflags/buildflags.h"
#include "brave/components/brave_shields/common/brave_shield_constants.h"
#include "brave/components/brave_sync/buildflags/buildflags.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/extension_service.h"
Expand Down Expand Up @@ -151,9 +152,11 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, CanLoadCustomBravePages) {
std::vector<std::string> pages {
"adblock",
#if BUILDFLAG(BRAVE_REWARDS_ENABLED)
"rewards",
"rewards",
#endif
#if BUILDFLAG(ENABLE_BRAVE_SYNC)
chrome::kChromeUISyncHost,
#endif
chrome::kChromeUISyncHost,
};

std::vector<std::string> schemes {
Expand Down Expand Up @@ -205,6 +208,7 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, CanLoadAboutHost) {
}
}

#if BUILDFLAG(ENABLE_BRAVE_SYNC)
IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest,
RewriteChromeSyncInternals) {
std::vector<std::string> schemes {
Expand All @@ -230,6 +234,7 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest,
"chrome://sync/");
}
}
#endif

IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest,
RewriteWelcomeWin10Host) {
Expand Down
3 changes: 3 additions & 0 deletions browser/brave_profile_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "brave/common/pref_names.h"
#include "brave/components/brave_shields/browser/brave_shields_web_contents_observer.h"
#include "brave/components/brave_sync/brave_sync_prefs.h"
#include "brave/components/brave_webtorrent/browser/buildflags/buildflags.h"
#include "chrome/browser/net/prediction_options.h"
#include "chrome/browser/prefs/session_startup_pref.h"
Expand Down Expand Up @@ -40,6 +41,8 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(kLocationBarIsWide, false);
registry->RegisterBooleanPref(kHideBraveRewardsButton, false);

brave_sync::prefs::Prefs::RegisterProfilePrefs(registry);

registry->RegisterBooleanPref(kWidevineOptedIn, false);
registry->RegisterBooleanPref(kAskWidevineInstall, true);
#if BUILDFLAG(BUNDLE_WIDEVINE_CDM)
Expand Down
2 changes: 0 additions & 2 deletions browser/browser_context_keyed_service_factories.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
#include "brave/browser/tor/tor_profile_service_factory.h"
#include "brave/components/brave_ads/browser/ads_service_factory.h"
#include "brave/components/brave_rewards/browser/rewards_service_factory.h"
#include "brave/components/brave_sync/brave_sync_service_factory.h"

namespace brave {

void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
brave_ads::AdsServiceFactory::GetInstance();
brave_rewards::RewardsServiceFactory::GetInstance();
brave_sync::BraveSyncServiceFactory::GetInstance();
greaselion::GreaselionServiceFactory::GetInstance();
TorProfileServiceFactory::GetInstance();
SearchEngineProviderServiceFactory::GetInstance();
Expand Down
38 changes: 22 additions & 16 deletions browser/extensions/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import("//brave/components/brave_rewards/browser/buildflags/buildflags.gni")
import("//brave/components/brave_sync/buildflags/buildflags.gni")
import("//brave/components/brave_wallet/browser/buildflags/buildflags.gni")
import("//brave/components/brave_webtorrent/browser/buildflags/buildflags.gni")
import("//build/config/features.gni")
Expand All @@ -9,28 +10,22 @@ declare_args() {

source_set("extensions") {
sources = [
"api/rewards_notifications_api.cc",
"api/rewards_notifications_api.h",
"api/brave_extensions_api_client.cc",
"api/brave_extensions_api_client.h",
"api/brave_rewards_api.cc",
"api/brave_rewards_api.h",
"api/brave_shields_api.cc",
"api/brave_shields_api.h",
"api/brave_sync_api.cc",
"api/brave_sync_api.h",
"api/brave_sync_event_router.cc",
"api/brave_sync_event_router.h",
"api/brave_theme_api.cc",
"api/brave_theme_api.h",
"api/rewards_notifications_api.cc",
"api/rewards_notifications_api.h",
"api/settings_private/brave_prefs_util.cc",
"api/settings_private/brave_prefs_util.h",
"brave_component_extension_resource_manager.cc",
"brave_component_extension_resource_manager.h",
"brave_component_loader.cc",
"brave_component_loader.h",
"brave_extensions_browser_api_provider.cc",
"brave_extensions_browser_api_provider.h",
"brave_extension_install_prompt.cc",
"brave_extension_install_prompt.h",
"brave_extension_management.cc",
Expand All @@ -39,12 +34,14 @@ source_set("extensions") {
"brave_extension_provider.h",
"brave_extension_service.cc",
"brave_extension_service.h",
"brave_extensions_browser_api_provider.cc",
"brave_extensions_browser_api_provider.h",
"brave_theme_event_router.cc",
"brave_theme_event_router.h",
"brave_tor_client_updater.cc",
"brave_tor_client_updater.h",
"updater/brave_update_client_config.cc",
"updater/brave_update_client_config.h"
"updater/brave_update_client_config.h",
]

if (brave_wallet_enabled) {
Expand All @@ -63,11 +60,8 @@ source_set("extensions") {
"//brave/common:pref_names",
"//brave/common/extensions/api",
"//brave/components/brave_component_updater/browser",
"//brave/components/brave_extension:static_resources",
"//brave/components/brave_extension:generated_resources",
"//brave/components/brave_sync",
"//brave/components/brave_sync:generated_resources",
"//brave/components/brave_sync:static_resources",
"//brave/components/brave_extension:static_resources",
"//components/prefs",
"//components/update_client:patch_impl",
"//components/update_client:unzip_impl",
Expand All @@ -83,6 +77,20 @@ source_set("extensions") {
"//brave/components/brave_rewards/resources/extension:static_resources",
]
}
if (enable_brave_sync) {
sources += [
"api/brave_sync_api.cc",
"api/brave_sync_api.h",
"api/brave_sync_event_router.cc",
"api/brave_sync_event_router.h",
]

deps += [
"//brave/components/brave_sync",
"//brave/components/brave_sync:generated_resources",
"//brave/components/brave_sync:static_resources",
]
}
if (enable_brave_webtorrent) {
deps += [
"//brave/components/brave_webtorrent:generated_resources",
Expand All @@ -92,7 +100,5 @@ source_set("extensions") {
}

config("infura_config") {
defines = [
"BRAVE_INFURA_PROJECT_ID=\"$brave_infura_project_id\""
]
defines = [ "BRAVE_INFURA_PROJECT_ID=\"$brave_infura_project_id\"" ]
}
Loading

0 comments on commit 56c2a47

Please sign in to comment.