Skip to content

Commit

Permalink
Drop patch for profile_io_data.cc and use chromium_src instead
Browse files Browse the repository at this point in the history
The idea of this patch was simply to make sure that the brave://
scheme gets considered by ProfileIOData::IsHandledProtocol() along
with other schemes, but we can achieve the same goal just using
chromium_src overrides, so let's do that instead.

Fixes brave/brave-browser#14238
  • Loading branch information
mariospr committed Feb 22, 2021
1 parent 64c9115 commit 0a7a69b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 12 deletions.
23 changes: 23 additions & 0 deletions chromium_src/chrome/browser/profiles/profile_io_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@
* 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/profiles/profile_io_data.h"
#include "brave/common/url_constants.h"

#define IsHandledProtocol IsHandledProtocol_ChromiumImpl
#define IsHandledURL IsHandledURL_ChromiumImpl
#include "../../../../../chrome/browser/profiles/profile_io_data.cc"
#undef IsHandledURL
#undef IsHandledProtocol

bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
if (scheme == kBraveUIScheme)
return true;
return IsHandledProtocol_ChromiumImpl(scheme);
}

// We need to provide our own version of IsHandledURL() as well to make sure
// that we get our own version of IsHandledProtocol() called when invoked via
// IsHandledURL(). Otherwise the old version will still be called since the
// renaming of IsHandledProtocol above does also modify the call point.
bool ProfileIOData::IsHandledURL(const GURL& url) {
if (!url.is_valid()) {
// We handle error cases.
return true;
}
return IsHandledProtocol(url.scheme());
}
25 changes: 25 additions & 0 deletions chromium_src/chrome/browser/profiles/profile_io_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* Copyright (c) 2021 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/. */

#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_

#include <string>
#include "url/gurl.h"

#define IsHandledProtocol \
IsHandledProtocol_ChromiumImpl(const std::string& scheme); \
static bool IsHandledProtocol

#define IsHandledURL \
IsHandledURL_ChromiumImpl(const GURL& url); \
static bool IsHandledURL

#include "../../../../../chrome/browser/profiles/profile_io_data.h"

#undef IsHandledURL
#undef IsHandledProtocol

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
12 changes: 0 additions & 12 deletions patches/chrome-browser-profiles-profile_io_data.cc.patch

This file was deleted.

0 comments on commit 0a7a69b

Please sign in to comment.