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
Brave url scheme android #1007
Closed
Closed
Brave url scheme android #1007
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
android/chromium_src/components/url_formatter/url_fixer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/. */ | ||
|
||
#define IsEquivalentScheme IsEquivalentScheme_ChromiumImpl | ||
#include "../../../../../../components/url_formatter/url_fixer.cc" | ||
#undef IsEquivalentScheme | ||
|
||
namespace url_formatter { | ||
|
||
namespace { | ||
|
||
const char kBraveUIScheme[] = "brave"; | ||
|
||
bool IsEquivalentScheme_BraveImpl(const std::string& scheme1, | ||
const std::string& scheme2) { | ||
return (scheme1 == kBraveUIScheme && scheme2 == kChromeUIScheme) || | ||
(scheme1 == kChromeUIScheme && scheme2 == kBraveUIScheme) || | ||
(scheme1 == url::kAboutScheme && scheme2 == kBraveUIScheme) || | ||
(scheme1 == kBraveUIScheme && scheme2 == url::kAboutScheme); | ||
} | ||
|
||
} | ||
|
||
bool IsEquivalentScheme(const std::string& scheme1, | ||
const std::string& scheme2) { | ||
if (IsEquivalentScheme_ChromiumImpl(scheme1, scheme2)) { | ||
return true; | ||
} | ||
return IsEquivalentScheme_BraveImpl(scheme1, scheme2); | ||
} | ||
|
||
} // namespace url_formatter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* 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/common/url_constants.h" | ||
#define RegisterContentSchemes RegisterContentSchemes_ChromiumImpl | ||
#include "../../../../../content/common/url_schemes.cc" | ||
#undef RegisterContentSchemes | ||
|
||
namespace { | ||
|
||
void RegisterContentSchemes_BraveImpl(bool lock_schemes) { | ||
url::AddStandardScheme(kBraveUIScheme, url::SCHEME_WITH_HOST); | ||
} | ||
|
||
} | ||
|
||
namespace content { | ||
|
||
void RegisterContentSchemes(bool lock_schemes) { | ||
RegisterContentSchemes_BraveImpl(lock_schemes); | ||
RegisterContentSchemes_ChromiumImpl(lock_schemes); | ||
} | ||
|
||
} // namespace content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
chromium_src/chrome/browser/ui/android/toolbar/toolbar_model_android.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* 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/toolbar/brave_toolbar_model_impl.h" | ||
#define ToolbarModelImpl BraveToolbarModelImpl | ||
#include "../../../../../../../chrome/browser/ui/android/toolbar/toolbar_model_android.cc" | ||
#undef ToolbarModelImpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe you need to compare about and chrome schemes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I need this also, as I need to compare for equality all the pairs from
<brave, chrome, about>
:But
chrome<->about
comparison is already done in IsEquivalentScheme_ChromiumImpl , https://cs.chromium.org/chromium/src/components/url_formatter/url_fixer.cc?type=cs&q=IsEquivalentScheme&g=0&l=683So I used compare
chrome<->about
by invokingIsEquivalentScheme_ChromiumImp
.