summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/frame/local_frame.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/frame/local_frame.h')
-rw-r--r--chromium/third_party/blink/renderer/core/frame/local_frame.h174
1 files changed, 143 insertions, 31 deletions
diff --git a/chromium/third_party/blink/renderer/core/frame/local_frame.h b/chromium/third_party/blink/renderer/core/frame/local_frame.h
index 10b5a419b62..30763d3fc99 100644
--- a/chromium/third_party/blink/renderer/core/frame/local_frame.h
+++ b/chromium/third_party/blink/renderer/core/frame/local_frame.h
@@ -39,20 +39,24 @@
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/unique_receiver_set.h"
-#include "third_party/blink/public/mojom/ad_tagging/ad_frame.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/frame/frame.mojom-blink.h"
+#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink-forward.h"
+#include "third_party/blink/public/mojom/input/focus_type.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/loader/pause_subresource_loading_handle.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/reporting/reporting.mojom-blink.h"
#include "third_party/blink/public/mojom/web_feature/web_feature.mojom-blink-forward.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/viewport_intersection_state.h"
+#include "third_party/blink/renderer/core/clipboard/raw_system_clipboard.h"
+#include "third_party/blink/renderer/core/clipboard/system_clipboard.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/weak_identifier_map.h"
#include "third_party/blink/renderer/core/editing/forward.h"
#include "third_party/blink/renderer/core/frame/frame.h"
#include "third_party/blink/renderer/core/frame/frame_types.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
+#include "third_party/blink/renderer/core/inspector/inspector_issue.h"
#include "third_party/blink/renderer/core/loader/frame_loader.h"
#include "third_party/blink/renderer/platform/graphics/touch_action.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
@@ -65,8 +69,8 @@ namespace base {
class SingleThreadTaskRunner;
}
-namespace service_manager {
-class InterfaceProvider;
+namespace gfx {
+class Point;
}
namespace blink {
@@ -86,6 +90,7 @@ class FrameConsole;
class FrameOverlay;
// class FrameScheduler;
class FrameSelection;
+class FrameWidget;
class InputMethodController;
class InspectorTraceEvents;
class CoreProbeSink;
@@ -115,7 +120,8 @@ extern template class CORE_EXTERN_TEMPLATE_EXPORT Supplement<LocalFrame>;
class CORE_EXPORT LocalFrame final : public Frame,
public FrameScheduler::Delegate,
public Supplementable<LocalFrame>,
- public mojom::blink::LocalFrame {
+ public mojom::blink::LocalFrame,
+ public mojom::blink::LocalMainFrame {
USING_GARBAGE_COLLECTED_MIXIN(LocalFrame);
public:
@@ -135,10 +141,10 @@ class CORE_EXPORT LocalFrame final : public Frame,
// Frame overrides:
~LocalFrame() override;
- void Trace(blink::Visitor*) override;
- void Navigate(const FrameLoadRequest&, WebFrameLoadType) override;
+ void Trace(Visitor*) override;
+ void Navigate(FrameLoadRequest&, WebFrameLoadType) override;
bool ShouldClose() override;
- SecurityContext* GetSecurityContext() const override;
+ const SecurityContext* GetSecurityContext() const override;
void PrintNavigationErrorMessage(const Frame&, const char* reason);
void PrintNavigationWarning(const String&);
bool DetachDocument() override;
@@ -150,9 +156,10 @@ class CORE_EXPORT LocalFrame final : public Frame,
// subtree, updating the inert bit on all descendant frames.
void SetIsInert(bool) override;
void SetInheritedEffectiveTouchAction(TouchAction) override;
- bool BubbleLogicalScrollFromChildFrame(ScrollDirection direction,
- ScrollGranularity granularity,
- Frame* child) override;
+ bool BubbleLogicalScrollFromChildFrame(
+ mojom::blink::ScrollDirection direction,
+ ScrollGranularity granularity,
+ Frame* child) override;
void DidFocus() override;
void DidChangeThemeColor();
@@ -280,8 +287,6 @@ class CORE_EXPORT LocalFrame final : public Frame,
// navigation at a later time.
bool CanNavigate(const Frame&, const KURL& destination_url = KURL());
- service_manager::InterfaceProvider& GetInterfaceProvider();
-
BrowserInterfaceBrokerProxy& GetBrowserInterfaceBroker();
InterfaceRegistry* GetInterfaceRegistry() { return interface_registry_; }
@@ -301,6 +306,13 @@ class CORE_EXPORT LocalFrame final : public Frame,
LocalFrameClient* Client() const;
+ // Returns the widget for this frame, or from the nearest ancestor which is a
+ // local root. It is never null for frames in ordinary Pages (which means the
+ // Page is inside a WebView), except very early in initialization. For frames
+ // in a non-ordinary Page (without a WebView, such as in unit tests, popups,
+ // devtools), it will always be null.
+ FrameWidget* GetWidgetForLocalRoot();
+
WebContentSettingsClient* GetContentSettingsClient();
PluginData* GetPluginData() const;
@@ -340,14 +352,26 @@ class CORE_EXPORT LocalFrame final : public Frame,
// remote ancestor frames and their respective scroll positions, clips, etc.
void SetViewportIntersectionFromParent(const ViewportIntersectionState&);
+ IntSize GetMainFrameViewportSize() const override;
+ IntPoint GetMainFrameScrollOffset() const override;
+
// See viewport_intersection_state.h for more info on these methods.
- IntPoint RemoteViewportOffset() const {
+ gfx::Point RemoteViewportOffset() const {
return intersection_state_.viewport_offset;
}
IntRect RemoteViewportIntersection() const {
return intersection_state_.viewport_intersection;
}
+ IntRect RemoteMainFrameDocumentIntersection() const {
+ return intersection_state_.main_frame_document_intersection;
+ }
+
+ bool CanSkipStickyFrameTracking() const {
+ return intersection_state_.can_skip_sticky_frame_tracking;
+ }
+
FrameOcclusionState GetOcclusionState() const;
+
bool NeedsOcclusionTracking() const;
// Replaces the initial empty document with a Document suitable for
@@ -367,12 +391,9 @@ class CORE_EXPORT LocalFrame final : public Frame,
// be removed.
bool IsProvisional() const;
- // True if AdTracker heuristics have determined that this frame is an ad.
- // Calculated in the constructor but LocalFrames created on behalf of OOPIF
- // aren't set until just before commit (ReadyToCommitNavigation time) by the
- // embedder.
- bool IsAdSubframe() const;
- bool IsAdRoot() const;
+ // Called in the constructor if AdTracker heuristics have determined that this
+ // frame is an ad; LocalFrames created on behalf of OOPIF aren't set until
+ // just before commit (ReadyToCommitNavigation time) by the embedder.
void SetIsAdSubframe(blink::mojom::AdFrameType ad_frame_type);
// Updates the frame color overlay to match the highlight ad setting.
@@ -397,7 +418,8 @@ class CORE_EXPORT LocalFrame final : public Frame,
const mojo::Remote<mojom::blink::ReportingServiceProxy>& GetReportingService()
const;
- // Returns the frame host ptr.
+ // Returns the frame host ptr. The interface returned is backed by an
+ // associated interface with the legacy Chrome IPC channel.
mojom::blink::LocalFrameHost& GetLocalFrameHostRemote();
// Overlays a color on top of this LocalFrameView if it is associated with
@@ -444,6 +466,8 @@ class CORE_EXPORT LocalFrame final : public Frame,
void FinishedLoading(FrameLoader::NavigationFinishState);
+ void UpdateFaviconURL();
+
using IsCapturingMediaCallback = base::RepeatingCallback<bool()>;
void SetIsCapturingMediaCallback(IsCapturingMediaCallback callback);
bool IsCapturingMedia() const;
@@ -454,18 +478,86 @@ class CORE_EXPORT LocalFrame final : public Frame,
void SetPrescientNetworkingForTesting(
std::unique_ptr<WebPrescientNetworking> prescient_networking);
+ void SetEmbeddingToken(const base::UnguessableToken& embedding_token);
+ const base::Optional<base::UnguessableToken>& GetEmbeddingToken() const;
+
+ void CopyImageAtViewportPoint(const IntPoint& viewport_point);
+ void MediaPlayerActionAtViewportPoint(
+ const IntPoint& viewport_position,
+ const blink::mojom::blink::MediaPlayerActionType type,
+ bool enable);
+
+ // Handle the request as a download. If the request is for a blob: URL,
+ // a BlobURLToken should be provided as |blob_url_token| to ensure the
+ // correct blob gets downloaded.
+ void DownloadURL(
+ const ResourceRequest& request,
+ network::mojom::blink::RedirectMode cross_origin_redirect_behavior);
+ void DownloadURL(
+ const ResourceRequest& request,
+ network::mojom::blink::RedirectMode cross_origin_redirect_behavior,
+ mojo::ScopedMessagePipeHandle blob_url_token);
+
// blink::mojom::LocalFrame overrides:
void GetTextSurroundingSelection(
uint32_t max_length,
GetTextSurroundingSelectionCallback callback) final;
void SendInterventionReport(const String& id, const String& message) final;
+ void SetFrameOwnerProperties(
+ mojom::blink::FrameOwnerPropertiesPtr properties) final;
void NotifyUserActivation() final;
void AddMessageToConsole(mojom::blink::ConsoleMessageLevel level,
const WTF::String& message,
bool discard_duplicates) final;
+ void AddInspectorIssue(mojom::blink::InspectorIssueInfoPtr) final;
void Collapse(bool collapsed) final;
void EnableViewSourceMode() final;
void Focus() final;
+ void ClearFocusedElement() final;
+ void GetResourceSnapshotForWebBundle(
+ mojo::PendingReceiver<
+ data_decoder::mojom::blink::ResourceSnapshotForWebBundle> receiver)
+ final;
+ void CopyImageAt(const gfx::Point& window_point) final;
+ void SaveImageAt(const gfx::Point& window_point) final;
+ void ReportBlinkFeatureUsage(const Vector<mojom::blink::WebFeature>&) final;
+ void RenderFallbackContent() final;
+ void BeforeUnload(bool is_reload, BeforeUnloadCallback callback) final;
+ void MediaPlayerActionAt(
+ const gfx::Point& window_point,
+ blink::mojom::blink::MediaPlayerActionPtr action) final;
+ void AdvanceFocusInForm(mojom::blink::FocusType focus_type) final;
+ void ReportContentSecurityPolicyViolation(
+ network::mojom::blink::CSPViolationPtr csp_violation) final;
+ // Updates the snapshotted policy attributes (sandbox flags and feature policy
+ // container policy) in the frame's FrameOwner. This is used when this frame's
+ // parent is in another process and it dynamically updates this frame's
+ // sandbox flags or container policy. The new policy won't take effect until
+ // the next navigation.
+ void DidUpdateFramePolicy(const FramePolicy& frame_policy) final;
+
+ // blink::mojom::LocalMainFrame overrides:
+ void AnimateDoubleTapZoom(const gfx::Point& point,
+ const gfx::Rect& rect) override;
+ void SetScaleFactor(float scale) override;
+ void ClosePage(
+ mojom::blink::LocalMainFrame::ClosePageCallback callback) override;
+ // Performs the specified plugin action on the node at the given location.
+ void PluginActionAt(const gfx::Point& location,
+ mojom::blink::PluginActionType action) override;
+ void SetInitialFocus(bool reverse) override;
+ void EnablePreferredSizeChangedMode() override;
+ void ZoomToFindInPageRect(const gfx::Rect& rect_in_root_frame) override;
+
+ SystemClipboard* GetSystemClipboard();
+ RawSystemClipboard* GetRawSystemClipboard();
+
+ // Indicate that this frame was attached as a MainFrame.
+ void WasAttachedAsLocalMainFrame();
+
+ // Returns the first URL loaded in this frame that is cross-origin to the
+ // parent frame.
+ base::Optional<String> FirstUrlCrossOriginToParent() const;
private:
friend class FrameNavigationDisabler;
@@ -504,9 +596,6 @@ class CORE_EXPORT LocalFrame final : public Frame,
// Activates the user activation states of this frame and all its ancestors.
void NotifyUserActivation(bool need_browser_verification);
- // Returns the transient user activation state of this frame
- bool HasTransientUserActivation();
-
// Consumes and returns the transient user activation state this frame, after
// updating all other frames in the frame tree.
bool ConsumeTransientUserActivation(UserActivationUpdateSource update_source);
@@ -520,9 +609,17 @@ class CORE_EXPORT LocalFrame final : public Frame,
void EvictFromBackForwardCache();
+ HitTestResult HitTestResultForVisualViewportPos(
+ const IntPoint& pos_in_viewport);
+
+ bool ShouldThrottleDownload();
+
static void BindToReceiver(
blink::LocalFrame* frame,
mojo::PendingAssociatedReceiver<mojom::blink::LocalFrame> receiver);
+ static void BindToMainFrameReceiver(
+ blink::LocalFrame* frame,
+ mojo::PendingAssociatedReceiver<mojom::blink::LocalMainFrame> receiver);
std::unique_ptr<FrameScheduler> frame_scheduler_;
@@ -560,12 +657,6 @@ class CORE_EXPORT LocalFrame final : public Frame,
bool in_view_source_mode_;
- // Type of frame detected by heuristics checking if the frame was created
- // for advertising purposes. It's per-frame (as opposed to per-document)
- // because when an iframe is created on behalf of ad script that same frame is
- // not typically reused for non-ad purposes.
- mojom::AdFrameType ad_frame_type_;
-
Member<CoreProbeSink> probe_sink_;
scoped_refptr<InspectorTaskRunner> inspector_task_runner_;
Member<PerformanceMonitor> performance_monitor_;
@@ -603,6 +694,8 @@ class CORE_EXPORT LocalFrame final : public Frame,
std::unique_ptr<FrameOverlay> frame_color_overlay_;
+ base::Optional<base::UnguessableToken> embedding_token_;
+
mojom::FrameLifecycleState lifecycle_state_;
base::Optional<mojom::FrameLifecycleState> pending_lifecycle_state_;
@@ -610,6 +703,25 @@ class CORE_EXPORT LocalFrame final : public Frame,
mojo::AssociatedRemote<mojom::blink::LocalFrameHost> local_frame_host_remote_;
mojo::AssociatedReceiver<mojom::blink::LocalFrame> receiver_{this};
+ mojo::AssociatedReceiver<mojom::blink::LocalMainFrame> main_frame_receiver_{
+ this};
+
+ // Variable to control burst of download requests.
+ int num_burst_download_requests_ = 0;
+ base::TimeTicks burst_download_start_time_;
+
+ // Access to the global sanitized system clipboard.
+ Member<SystemClipboard> system_clipboard_;
+ // Access to the global raw/unsanitized system clipboard
+ Member<RawSystemClipboard> raw_system_clipboard_;
+
+ // Stores the first URL that was loaded in this frame that is cross-origin
+ // to the parent frame. For this URL we know that the parent origin provided
+ // it by either setting the |src| attribute or by navigating the iframe.
+ // Thus we can safely reveal it to the parent origin in Web APIs.
+ // TODO(ulan): Move this to the browser process once performance.measureMemory
+ // starts using Performance Manager to support cross-site iframes.
+ base::Optional<String> first_url_cross_origin_to_parent_;
};
inline FrameLoader& LocalFrame::Loader() const {
@@ -677,7 +789,7 @@ class FrameNavigationDisabler {
~FrameNavigationDisabler();
private:
- Member<LocalFrame> frame_;
+ LocalFrame* frame_;
DISALLOW_COPY_AND_ASSIGN(FrameNavigationDisabler);
};
@@ -713,7 +825,7 @@ class ScopedFrameBlamer {
private:
void LeaveContext();
- Member<LocalFrame> frame_;
+ LocalFrame* frame_;
DISALLOW_COPY_AND_ASSIGN(ScopedFrameBlamer);
};