Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes a dozen patches in favour of chromium_src override #468

Merged
merged 11 commits into from
Sep 19, 2018
Merged
2 changes: 2 additions & 0 deletions browser/extensions/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ source_set("extensions") {
"brave_extension_management.h",
"brave_extension_provider.cc",
"brave_extension_provider.h",
"brave_extension_service.cc",
"brave_extension_service.h",
"brave_tor_client_updater.cc",
"brave_tor_client_updater.h",
"brave_webstore_inline_installer.cc",
Expand Down
44 changes: 44 additions & 0 deletions browser/extensions/brave_extension_service.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* 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/extensions/brave_extension_service.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_service.h"
#include "chrome/browser/profiles/profile.h"

namespace extensions {

BraveExtensionService::BraveExtensionService(Profile* profile,
const base::CommandLine* command_line,
const base::FilePath& install_directory,
ExtensionPrefs* extension_prefs,
Blacklist* blacklist,
bool autoupdate_enabled,
bool extensions_enabled,
OneShotEvent* ready) :
ExtensionService(profile, command_line, install_directory, extension_prefs,
blacklist, autoupdate_enabled, extensions_enabled, ready) {
}

BraveExtensionService::~BraveExtensionService() {
}

void BraveExtensionService::AddComponentExtension(const Extension* extension) {
ExtensionService::AddComponentExtension(extension);

// ContentSettingsStore::RegisterExtension is only called for default components
// on the first run with a fresh profile. All restarts of the browser after that do not call it.
// This causes ContentSettingsStore's `entries_` to never insert the component ID
// and then ContentSettingsStore::GetValueMap always returns nullptr.
// I don't think Chromium is affected by this simply because they don't use content settings
// from default component extensions.
extension_prefs_->OnExtensionInstalled(extension, Extension::ENABLED,
syncer::StringOrdinal(),
extensions::kInstallFlagNone,
std::string(),
base::nullopt);
extensions::ContentSettingsService::Get(profile_)->OnExtensionPrefsLoaded(
extension->id(), extension_prefs_);
}

} // namespace extensions
33 changes: 33 additions & 0 deletions browser/extensions/brave_extension_service.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* 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/. */

#ifndef BRAVE_BROWSER_EXTENSIONS_BRAVE_EXTENSION_SERVICE_H_
#define BRAVE_BROWSER_EXTENSIONS_BRAVE_EXTENSION_SERVICE_H_

#include "chrome/browser/extensions/extension_service.h"

namespace extensions {

class BraveExtensionService : public ExtensionService {
public:
// Constructor stores pointers to |profile| and |extension_prefs| but
// ownership remains at caller.
BraveExtensionService(Profile* profile,
const base::CommandLine* command_line,
const base::FilePath& install_directory,
ExtensionPrefs* extension_prefs,
Blacklist* blacklist,
bool autoupdate_enabled,
bool extensions_enabled,
OneShotEvent* ready);
~BraveExtensionService() override;

void AddComponentExtension(const Extension* extension) override;

DISALLOW_COPY_AND_ASSIGN(BraveExtensionService);
};

} // namespace extensions

#endif // BRAVE_BROWSER_EXTENSIONS_BRAVE_EXTENSION_SERVICE_H_
4 changes: 4 additions & 0 deletions browser/ui/brave_browser_command_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ bool IsBraveCommands(int id) {
}
}

namespace chrome {

BraveBrowserCommandController::BraveBrowserCommandController(Browser* browser)
: BrowserCommandController(browser),
browser_(browser),
Expand Down Expand Up @@ -119,3 +121,5 @@ bool BraveBrowserCommandController::ExecuteBraveCommandWithDisposition(

return true;
}

} // namespace chrome
5 changes: 5 additions & 0 deletions browser/ui/brave_browser_command_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

#include "chrome/browser/ui/browser_command_controller.h"

// This namespace is needed for a chromium_src override
namespace chrome {

class BraveBrowserCommandController : public chrome::BrowserCommandController {
public:
explicit BraveBrowserCommandController(Browser* browser);
Expand Down Expand Up @@ -37,4 +40,6 @@ class BraveBrowserCommandController : public chrome::BrowserCommandController {
DISALLOW_COPY_AND_ASSIGN(BraveBrowserCommandController);
};

} // namespace chrome

#endif // BRAVE_BROWSER_UI_BRAVE_BROWSER_COMMAND_CONTROLLER_H_
11 changes: 11 additions & 0 deletions chromium_src/chrome/app/chrome_command_ids.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* 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/. */

#ifndef BRAVE_CHROMIUM_SRC_CHROME_APP_CHROME_COMMAND_IDS_H_
#define BRAVE_CHROMIUM_SRC_CHROME_APP_CHROME_COMMAND_IDS_H_

#include "brave/app/brave_command_ids.h"
#include "../../../../chrome/app/chrome_command_ids.h"

#endif // BRAVE_CHROMIUM_SRC_CHROME_APP_CHROME_COMMAND_IDS_H_
9 changes: 9 additions & 0 deletions chromium_src/chrome/app/chrome_main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* 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/app/brave_main_delegate.h"

#define ChromeMainDelegate BraveMainDelegate
#include "../../../../chrome/app/chrome_main.cc"
#undef ChromeMainDelegate
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* 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_scheme_classifier.h"
#include "brave/components/omnibox/browser/brave_autocomplete_controller.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
#include "components/omnibox/browser/autocomplete_classifier.h"
#include "components/omnibox/browser/autocomplete_controller.h"

#define AutocompleteController BraveAutocompleteController
#define ChromeAutocompleteSchemeClassifier BraveAutocompleteSchemeClassifier
#include "../../../../../chrome/browser/autocomplete/autocomplete_classifier_factory.cc"
#undef ChromeAutocompleteSchemeClassifier
#undef AutocompleteController
9 changes: 9 additions & 0 deletions chromium_src/chrome/browser/browser_process_impl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* 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/components/brave_shields/browser/brave_resource_dispatcher_host_delegate.h"

#define ChromeResourceDispatcherHostDelegate BraveResourceDispatcherHostDelegate
#include "../../../../chrome/browser/browser_process_impl.cc"
#undef ChromeResourceDispatcherHostDelegate
11 changes: 11 additions & 0 deletions chromium_src/chrome/browser/extensions/extension_service.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* 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/extensions/brave_component_loader.h"
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/extension_service.h"

#define ComponentLoader BraveComponentLoader
#include "../../../../../chrome/browser/extensions/extension_service.cc"
#undef ComponentLoader
11 changes: 11 additions & 0 deletions chromium_src/chrome/browser/extensions/extension_system_impl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* 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/extensions/brave_extension_service.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/update_install_gate.h"

#define ExtensionService BraveExtensionService
#include "../../../../../chrome/browser/extensions/extension_system_impl.cc"
#undef ExtensionService
9 changes: 9 additions & 0 deletions chromium_src/chrome/browser/io_thread.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* 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/net/brave_system_network_delegate.h"

#define ChromeNetworkDelegate BraveSystemNetworkDelegate
#include "../../../../chrome/browser/io_thread.cc"
#undef ChromeNetworkDelegate
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* 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/components/omnibox/browser/brave_autocomplete_controller.h"
#include "components/omnibox/browser/autocomplete_controller.h"

#define AutocompleteController BraveAutocompleteController
#include "../../../../../../../chrome/browser/ui/app_list/search/omnibox_provider.cc"
#undef AutocompleteController
14 changes: 14 additions & 0 deletions chromium_src/chrome/browser/ui/browser.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* 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 "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
#include "brave/browser/ui/brave_browser_content_setting_bubble_model_delegate.h"
#include "brave/browser/ui/brave_browser_command_controller.h"

#define BrowserContentSettingBubbleModelDelegate BraveBrowserContentSettingBubbleModelDelegate
#define BrowserCommandController BraveBrowserCommandController
#include "../../../../../chrome/browser/ui/browser.cc"
#undef BrowserContentSettingBubbleModelDelegate
#undef BrowserCommandController
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* 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/components/omnibox/browser/brave_autocomplete_controller.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
#include "components/omnibox/browser/autocomplete_controller.h"

#define AutocompleteController BraveAutocompleteController
#include "../../../../../../../chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc"
#undef AutocompleteController
10 changes: 10 additions & 0 deletions chromium_src/components/omnibox/browser/omnibox_controller.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* 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/components/omnibox/browser/brave_autocomplete_controller.h"
#include "components/omnibox/browser/autocomplete_controller.h"

#define AutocompleteController BraveAutocompleteController
#include "../../../../../../../components/omnibox/browser/omnibox_controller.cc"
#undef AutocompleteController
15 changes: 0 additions & 15 deletions patches/chrome-app-chrome_command_ids.h.patch

This file was deleted.

21 changes: 0 additions & 21 deletions patches/chrome-app-chrome_main.cc.patch

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions patches/chrome-browser-browser_process_impl.cc.patch

This file was deleted.

Loading