-
Notifications
You must be signed in to change notification settings - Fork 965
[iOS] Use Chromium web embedder (CWVWebView
)
#24657
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5f0ac98
use CWVWebView embedder in iOS
kylehickinson dd55b75
Fix Javascript crashes. Fix SSL-Pinning page not displaying correctly…
Brandon-T 89f4a05
Add new download alert
Brandon-T d4d011b
ensure the OTR browser is recreated when OTR browser state is destroyed
kylehickinson f8f8a9e
Chromium 131 build fixes
kylehickinson 63923fa
Fix building unit tests
kylehickinson 14e871b
Fix crash when updating back/forward status
kylehickinson eeab70c
[wip] fix back/forward navs for https upgrades
kylehickinson 26b183d
replace notreached with dcheck
kylehickinson 775031c
Chromium 132 build fixes
kylehickinson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,2 @@ | ||
# Common linting false posititives from Obj-C syntax in headers | ||
filter=-readability/casting,-whitespace/parens,-whitespace/operators |
This file contains hidden or 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,4 @@ | ||
include_rules = [ | ||
"+brave/components/https_upgrade_exceptions/browser", | ||
"+brave/ios/browser/application_context", | ||
] |
33 changes: 33 additions & 0 deletions
33
chromium_src/ios/chrome/browser/https_upgrades/model/https_only_mode_upgrade_tab_helper.mm
This file contains hidden or 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 @@ | ||
// Copyright (c) 2024 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/https_upgrade_exceptions/browser/https_upgrade_exceptions_service.h" | ||
#include "brave/ios/browser/application_context/brave_application_context_impl.h" | ||
#import "ios/chrome/browser/shared/model/prefs/pref_names.h" | ||
#import "ios/components/security_interstitials/https_only_mode/feature.h" | ||
#import "ios/components/security_interstitials/https_only_mode/https_upgrade_service.h" | ||
#include "net/base/features.h" | ||
#include "net/base/url_util.h" | ||
|
||
namespace { | ||
bool CanUpgradeToHTTPS(const GURL& url) { | ||
// FIXME: Move this impl out of the chromium_src override | ||
BraveApplicationContextImpl* braveContext = | ||
static_cast<BraveApplicationContextImpl*>(GetApplicationContext()); | ||
return braveContext->https_upgrade_exceptions_service()->CanUpgradeToHTTPS( | ||
url); | ||
} | ||
} // namespace | ||
|
||
// Add checks for Brave-by-default feature flag, standard HTTPS upgrades pref | ||
// and the brave https upgrade exception list when determining if the navigation | ||
// should be upgraded | ||
#define kHttpsUpgrades kHttpsUpgrades) && \ | ||
!base::FeatureList::IsEnabled(net::features::kBraveHttpsByDefault) && \ | ||
!(prefs_ && prefs_->GetBoolean(prefs::kHttpsUpgradesEnabled) | ||
#define IsLocalhost IsLocalhost(url) || !CanUpgradeToHTTPS | ||
#include "src/ios/chrome/browser/https_upgrades/model/https_only_mode_upgrade_tab_helper.mm" | ||
#undef IsLocalhost | ||
#undef kHttpsUpgrades |
This file contains hidden or 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 hidden or 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
16 changes: 16 additions & 0 deletions
16
chromium_src/ios/chrome/browser/shared/model/prefs/pref_names.h
This file contains hidden or 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,16 @@ | ||
// Copyright (c) 2024 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_IOS_CHROME_BROWSER_SHARED_MODEL_PREFS_PREF_NAMES_H_ | ||
#define BRAVE_CHROMIUM_SRC_IOS_CHROME_BROWSER_SHARED_MODEL_PREFS_PREF_NAMES_H_ | ||
|
||
#include "src/ios/chrome/browser/shared/model/prefs/pref_names.h" // IWYU pragma: export | ||
|
||
namespace prefs { | ||
// A boolean specifying whether HTTPS Upgrades are enabled. | ||
inline constexpr char kHttpsUpgradesEnabled[] = "ios.https_upgrades_enabled"; | ||
} // namespace prefs | ||
|
||
#endif // BRAVE_CHROMIUM_SRC_IOS_CHROME_BROWSER_SHARED_MODEL_PREFS_PREF_NAMES_H_ |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
we normally wouldn't put this kind of stuff in a chromium_src override, but it appears that we're doing that quite a bit already in ios. We shouldn't use chromium_src overrides as a replacement for brave code that should go under ios. So for instance above in
BraveRegisterBrowserStatePrefs
should really go inios/brave/browser/shared/model/prefs/browser_prefs.mm
and same here.