Brave handles the web views frame while scrolling on the Swift side so we need to return true for the `IsSmoothScrollingSupported` web client method so that it doesn't automatically inset the web view by the safe area Chromium change: commit 0b9166658b79a5f788860e3e215165d8d26d73b1 Author: Gauthier Ambard <gambard@chromium.org> Date: Mon Mar 9 08:40:04 2026 -0700 [iOS] Replace use of SmoothScrolling flag with the provider This is how it is supposed to be used. Make sure to move all the uses of the smooth scrolling flag at the same time to have a state where half the app is using the flag and the other app the provider. Also, updates the test to ensure they only run when the provider is returning true. The download manager test is updated as the tap was failing. Bug: 483998779 Change-Id: Ic81a977ecbc0ebc131c49bd992511a97eb916abb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7648409 Reviewed-by: Aliona Dangla <alionadangla@chromium.org> Commit-Queue: Gauthier Ambard <gambard@chromium.org> Cr-Commit-Position: refs/heads/main@{#1596357}
72 lines
2.7 KiB
Objective-C
72 lines
2.7 KiB
Objective-C
// Copyright (c) 2020 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_IOS_BROWSER_WEB_BRAVE_WEB_CLIENT_H_
|
|
#define BRAVE_IOS_BROWSER_WEB_BRAVE_WEB_CLIENT_H_
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "ios/chrome/browser/web/model/chrome_web_client.h"
|
|
|
|
@class WKWebViewConfiguration;
|
|
|
|
class BraveWebClient : public ChromeWebClient {
|
|
public:
|
|
BraveWebClient();
|
|
BraveWebClient(const BraveWebClient&) = delete;
|
|
BraveWebClient& operator=(const BraveWebClient&) = delete;
|
|
~BraveWebClient() override;
|
|
|
|
void SetLegacyUserAgent(const std::string& user_agent);
|
|
|
|
// WebClient implementation.
|
|
std::unique_ptr<web::WebMainParts> CreateWebMainParts() override;
|
|
std::string GetUserAgent(web::UserAgentType type) const override;
|
|
|
|
void AddAdditionalSchemes(Schemes* schemes) const override;
|
|
bool IsAppSpecificURL(const GURL& url) const override;
|
|
|
|
std::vector<web::JavaScriptFeature*> GetJavaScriptFeatures(
|
|
web::BrowserState* browser_state) const override;
|
|
|
|
bool EnableLongPressUIContextMenu() const override;
|
|
bool EnableWebInspector(web::BrowserState* browser_state) const override;
|
|
|
|
void PostBrowserURLRewriterCreation(
|
|
web::BrowserURLRewriter* rewriter) override;
|
|
|
|
bool IsInsecureFormWarningEnabled(
|
|
web::BrowserState* browser_state) const override;
|
|
void BuildEditMenu(web::WebState* web_state,
|
|
id<UIMenuBuilder>) const override;
|
|
|
|
bool ShouldBlockJavaScript(web::WebState* web_state,
|
|
NSURLRequest* request) override;
|
|
NSString* GetUserAgentForRequest(web::WebState* web_state,
|
|
web::UserAgentType user_agent_type,
|
|
NSURLRequest* request) override;
|
|
bool ShouldBlockUniversalLinks(web::WebState* web_state,
|
|
NSURLRequest* request) override;
|
|
|
|
bool CanRunOpenPanel(web::WebState* web_state) const override
|
|
API_AVAILABLE(ios(18.4));
|
|
void RunOpenPanel(web::WebState* web_state,
|
|
WKOpenPanelParameters* parameters,
|
|
WKFrameInfo* frame,
|
|
base::OnceCallback<void(NSArray<NSURL*>*)> completion)
|
|
const override API_AVAILABLE(ios(18.4));
|
|
|
|
void DidResetConfiguration(web::BrowserState* browser_state,
|
|
WKWebViewConfiguration* configuration) override;
|
|
bool IsSmoothScrollingSupported() const override;
|
|
|
|
private:
|
|
std::string legacy_user_agent_;
|
|
};
|
|
|
|
#endif // BRAVE_IOS_BROWSER_WEB_BRAVE_WEB_CLIENT_H_
|