1 /* 2 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_WEB_LOCAL_FRAME_IMPL_H_ 32 #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_WEB_LOCAL_FRAME_IMPL_H_ 33 34 #include <memory> 35 #include <set> 36 #include <utility> 37 38 #include "base/single_thread_task_runner.h" 39 #include "base/util/type_safety/pass_key.h" 40 #include "mojo/public/cpp/bindings/pending_associated_receiver.h" 41 #include "mojo/public/cpp/bindings/pending_associated_remote.h" 42 #include "services/network/public/mojom/web_sandbox_flags.mojom-blink.h" 43 #include "third_party/blink/public/mojom/ad_tagging/ad_frame.mojom-blink-forward.h" 44 #include "third_party/blink/public/mojom/blob/blob_url_store.mojom-blink-forward.h" 45 #include "third_party/blink/public/mojom/devtools/devtools_agent.mojom-blink-forward.h" 46 #include "third_party/blink/public/mojom/frame/find_in_page.mojom-blink-forward.h" 47 #include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink-forward.h" 48 #include "third_party/blink/public/mojom/frame/tree_scope_type.mojom-blink.h" 49 #include "third_party/blink/public/mojom/portal/portal.mojom-blink-forward.h" 50 #include "third_party/blink/public/platform/web_file_system_type.h" 51 #include "third_party/blink/public/web/web_history_commit_type.h" 52 #include "third_party/blink/public/web/web_local_frame.h" 53 #include "third_party/blink/public/web/web_navigation_control.h" 54 #include "third_party/blink/renderer/core/core_export.h" 55 #include "third_party/blink/renderer/core/editing/forward.h" 56 #include "third_party/blink/renderer/core/exported/web_input_method_controller_impl.h" 57 #include "third_party/blink/renderer/core/frame/local_frame.h" 58 #include "third_party/blink/renderer/core/frame/web_remote_frame_impl.h" 59 #include "third_party/blink/renderer/platform/geometry/float_rect.h" 60 #include "third_party/blink/renderer/platform/heap/self_keep_alive.h" 61 #include "third_party/blink/renderer/platform/wtf/casting.h" 62 #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" 63 64 namespace blink { 65 66 class ChromePrintContext; 67 class FindInPage; 68 class HTMLPortalElement; 69 class IntSize; 70 class LocalFrameClientImpl; 71 class ResourceError; 72 class ScrollableArea; 73 class TextFinder; 74 class WebAssociatedURLLoader; 75 struct WebAssociatedURLLoaderOptions; 76 class WebAutofillClient; 77 class WebContentSettingsClient; 78 class WebDevToolsAgentImpl; 79 class WebLocalFrameClient; 80 class WebFrameWidgetBase; 81 class WebNode; 82 class WebPerformance; 83 class WebRemoteFrameImpl; 84 class WebScriptExecutionCallback; 85 class WebSpellCheckPanelHostClient; 86 class WebView; 87 class WebViewImpl; 88 enum class WebFrameLoadType; 89 struct WebPrintParams; 90 class WindowAgentFactory; 91 92 template <typename T> 93 class WebVector; 94 95 // Implementation of WebFrame, note that this is a reference counted object. 96 class CORE_EXPORT WebLocalFrameImpl final 97 : public GarbageCollected<WebLocalFrameImpl>, 98 public WebNavigationControl { 99 public: 100 // WebFrame overrides: 101 void Close() override; 102 WebView* View() const override; 103 v8::Local<v8::Object> GlobalProxy() const override; 104 bool IsLoading() const override; 105 106 // WebLocalFrame overrides: 107 WebLocalFrameImpl* CreateLocalChild( 108 mojom::blink::TreeScopeType, 109 WebLocalFrameClient*, 110 blink::InterfaceRegistry*, 111 const base::UnguessableToken& frame_token) override; Client()112 WebLocalFrameClient* Client() const override { return client_; } 113 void SetAutofillClient(WebAutofillClient*) override; 114 WebAutofillClient* AutofillClient() override; 115 void SetContentCaptureClient(WebContentCaptureClient*) override; 116 WebContentCaptureClient* ContentCaptureClient() const override; 117 WebDocument GetDocument() const override; 118 WebString AssignedName() const override; 119 ui::AXTreeID GetAXTreeID() const override; 120 void SetName(const WebString&) override; 121 bool IsProvisional() const override; 122 WebLocalFrameImpl* LocalRoot() override; 123 WebFrameWidget* FrameWidget() const override; 124 WebFrame* FindFrameByName(const WebString& name) override; 125 void SetEmbeddingToken( 126 const base::UnguessableToken& embedding_token) override; 127 const base::Optional<base::UnguessableToken>& GetEmbeddingToken() 128 const override; 129 void SendPings(const WebURL& destination_url) override; 130 void StartReload(WebFrameLoadType) override; 131 void StartNavigation(const WebURLRequest&) override; 132 void EnableViewSourceMode(bool enable) override; 133 bool IsViewSourceModeEnabled() const override; 134 WebDocumentLoader* GetDocumentLoader() const override; 135 void SetReferrerForRequest(WebURLRequest&, const WebURL& referrer) override; 136 bool IsNavigationScheduledWithin(base::TimeDelta interval) const override; 137 void BlinkFeatureUsageReport(blink::mojom::WebFeature feature) override; 138 PageSizeType GetPageSizeType(uint32_t page_index) override; 139 void GetPageDescription(uint32_t page_index, 140 WebPrintPageDescription*) override; 141 void ExecuteScript(const WebScriptSource&) override; 142 void ExecuteScriptInIsolatedWorld(int32_t world_id, 143 const WebScriptSource&) override; 144 WARN_UNUSED_RESULT v8::Local<v8::Value> 145 ExecuteScriptInIsolatedWorldAndReturnValue(int32_t world_id, 146 const WebScriptSource&) override; 147 void ClearIsolatedWorldCSPForTesting(int32_t world_id) override; 148 v8::Local<v8::Value> ExecuteScriptAndReturnValue( 149 const WebScriptSource&) override; 150 // Call the function with the given receiver and arguments 151 v8::MaybeLocal<v8::Value> ExecuteMethodAndReturnValue( 152 v8::Local<v8::Function>, 153 v8::Local<v8::Value>, 154 int argc, 155 v8::Local<v8::Value> argv[]) override; 156 v8::MaybeLocal<v8::Value> CallFunctionEvenIfScriptDisabled( 157 v8::Local<v8::Function>, 158 v8::Local<v8::Value>, 159 int argc, 160 v8::Local<v8::Value> argv[]) override; 161 v8::Local<v8::Context> MainWorldScriptContext() const override; 162 int32_t GetScriptContextWorldId( 163 v8::Local<v8::Context> script_context) const override; 164 void RequestExecuteScriptAndReturnValue(const WebScriptSource&, 165 bool user_gesture, 166 WebScriptExecutionCallback*) override; 167 void RequestExecuteV8Function(v8::Local<v8::Context>, 168 v8::Local<v8::Function>, 169 v8::Local<v8::Value> receiver, 170 int argc, 171 v8::Local<v8::Value> argv[], 172 WebScriptExecutionCallback*) override; 173 void RequestExecuteScriptInIsolatedWorld( 174 int32_t world_id, 175 const WebScriptSource* source_in, 176 unsigned num_sources, 177 bool user_gesture, 178 ScriptExecutionType, 179 WebScriptExecutionCallback*) override; 180 void Alert(const WebString& message) override; 181 bool Confirm(const WebString& message) override; 182 WebString Prompt(const WebString& message, 183 const WebString& default_value) override; 184 void BindDevToolsAgent(CrossVariantMojoAssociatedRemote< 185 mojom::blink::DevToolsAgentHostInterfaceBase> 186 devtools_agent_host_remote, 187 CrossVariantMojoAssociatedReceiver< 188 mojom::blink::DevToolsAgentInterfaceBase> 189 devtools_agent_receiver) override; 190 void UnmarkText() override; 191 bool HasMarkedText() const override; 192 WebRange MarkedRange() const override; 193 bool FirstRectForCharacterRange(unsigned location, 194 unsigned length, 195 WebRect&) const override; 196 bool ExecuteCommand(const WebString&) override; 197 bool ExecuteCommand(const WebString&, const WebString& value) override; 198 bool IsCommandEnabled(const WebString&) const override; 199 bool SelectionTextDirection(base::i18n::TextDirection& start, 200 base::i18n::TextDirection& end) const override; 201 bool IsSelectionAnchorFirst() const override; 202 void SetTextDirectionForTesting(base::i18n::TextDirection direction) override; 203 bool HasSelection() const override; 204 WebRange SelectionRange() const override; 205 WebString SelectionAsText() const override; 206 WebString SelectionAsMarkup() const override; 207 void TextSelectionChanged(const WebString& selection_text, 208 uint32_t offset, 209 const gfx::Range& range) override; 210 bool SelectWordAroundCaret() override; 211 void SelectRange(const gfx::Point& base, const gfx::Point& extent) override; 212 void SelectRange(const WebRange&, 213 HandleVisibilityBehavior, 214 blink::mojom::SelectionMenuBehavior) override; 215 WebString RangeAsText(const WebRange&) override; 216 void MoveRangeSelection( 217 const gfx::Point& base, 218 const gfx::Point& extent, 219 WebFrame::TextGranularity = kCharacterGranularity) override; 220 void MoveCaretSelection(const gfx::Point&) override; 221 bool SetEditableSelectionOffsets(int start, int end) override; 222 bool AddImeTextSpansToExistingText( 223 const WebVector<ui::ImeTextSpan>& ime_text_spans, 224 unsigned text_start, 225 unsigned text_end) override; 226 bool ClearImeTextSpansByType(ui::ImeTextSpan::Type type, 227 unsigned text_start, 228 unsigned text_end) override; 229 bool SetCompositionFromExistingText( 230 int composition_start, 231 int composition_end, 232 const WebVector<ui::ImeTextSpan>& ime_text_spans) override; 233 void ExtendSelectionAndDelete(int before, int after) override; 234 void MoveRangeSelectionExtent(const gfx::Point&) override; 235 void ReplaceSelection(const WebString&) override; 236 void DeleteSurroundingText(int before, int after) override; 237 void DeleteSurroundingTextInCodePoints(int before, int after) override; 238 void ExtractSmartClipData(WebRect rect_in_viewport, 239 WebString& clip_text, 240 WebString& clip_html, 241 WebRect& clip_rect) override; 242 void SetTextCheckClient(WebTextCheckClient*) override; 243 void SetSpellCheckPanelHostClient(WebSpellCheckPanelHostClient*) override; SpellCheckPanelHostClient()244 WebSpellCheckPanelHostClient* SpellCheckPanelHostClient() const override { 245 return spell_check_panel_host_client_; 246 } 247 void ReplaceMisspelledRange(const WebString&) override; 248 void RemoveSpellingMarkers() override; 249 void RemoveSpellingMarkersUnderWords( 250 const WebVector<WebString>& words) override; 251 void SetContentSettingsClient(WebContentSettingsClient*) override; 252 void ReloadImage(const WebNode&) override; 253 bool IsAllowedToDownload() const override; 254 bool FindForTesting(int identifier, 255 const WebString& search_text, 256 bool match_case, 257 bool forward, 258 bool force, 259 bool new_session, 260 bool wrap_within_frame, 261 bool async) override; 262 void SetTickmarks(const WebElement& target, 263 const WebVector<WebRect>& tickmarks) override; 264 WebNode ContextMenuNode() const override; 265 void CopyImageAtForTesting(const gfx::Point&) override; 266 void UsageCountChromeLoadTimes(const WebString& metric) override; 267 bool DispatchedPagehideAndStillHidden() const override; 268 FrameScheduler* Scheduler() const override; 269 scheduler::WebAgentGroupScheduler* GetAgentGroupScheduler() const override; 270 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(TaskType) override; 271 WebInputMethodController* GetInputMethodController() override; 272 std::unique_ptr<WebAssociatedURLLoader> CreateAssociatedURLLoader( 273 const WebAssociatedURLLoaderOptions&) override; 274 void DeprecatedStopLoading() override; 275 WebSize GetScrollOffset() const override; 276 void SetScrollOffset(const WebSize&) override; 277 WebSize DocumentSize() const override; 278 bool HasVisibleContent() const override; 279 WebRect VisibleContentRect() const override; 280 void DispatchBeforePrintEvent( 281 base::WeakPtr<WebPrintClient> print_client) override; 282 WebPlugin* GetPluginToPrint(const WebNode& constrain_to_node) override; 283 uint32_t PrintBegin(const WebPrintParams&, 284 const WebNode& constrain_to_node) override; 285 float GetPrintPageShrink(uint32_t page) override; 286 float PrintPage(uint32_t page_to_print, cc::PaintCanvas*) override; 287 void PrintEnd() override; 288 void DispatchAfterPrintEvent() override; 289 bool GetPrintPresetOptionsForPlugin(const WebNode&, 290 WebPrintPresetOptions*) override; 291 bool CapturePaintPreview(const WebRect& bounds, 292 cc::PaintCanvas* canvas, 293 bool include_linked_destinations) override; 294 bool ShouldSuppressKeyboardForFocusedElement() override; 295 WebPerformance Performance() const override; 296 bool IsAdSubframe() const override; 297 void SetIsAdSubframe(blink::mojom::AdFrameType ad_frame_type) override; 298 WebSize SpoolSizeInPixelsForTesting(const WebSize& page_size_in_pixels, 299 uint32_t page_count) override; 300 void PrintPagesForTesting(cc::PaintCanvas*, 301 const WebSize& page_size_in_pixels, 302 const WebSize& spool_size_in_pixels) override; 303 WebRect GetSelectionBoundsRectForTesting() const override; 304 gfx::Point GetPositionInViewportForTesting() const override; 305 void WasHidden() override; 306 void WasShown() override; 307 void SetAllowsCrossBrowsingInstanceFrameLookup() override; 308 void NotifyUserActivation( 309 mojom::blink::UserActivationNotificationType notification_type) override; 310 bool HasStickyUserActivation() override; 311 bool HasTransientUserActivation() override; 312 bool ConsumeTransientUserActivation(UserActivationUpdateSource) override; 313 void SetOptimizationGuideHints(const WebOptimizationGuideHints&) override; 314 315 // WebNavigationControl overrides: 316 bool DispatchBeforeUnloadEvent(bool) override; 317 void CommitNavigation( 318 std::unique_ptr<WebNavigationParams> navigation_params, 319 std::unique_ptr<WebDocumentLoader::ExtraData> extra_data) override; 320 blink::mojom::CommitResult CommitSameDocumentNavigation( 321 const WebURL&, 322 WebFrameLoadType, 323 const WebHistoryItem&, 324 bool is_client_redirect, 325 std::unique_ptr<WebDocumentLoader::ExtraData> extra_data) override; 326 void LoadJavaScriptURL(const WebURL&) override; 327 FallbackContentResult MaybeRenderFallbackContent( 328 const WebURLError&) const override; 329 void SetCommittedFirstRealLoad() override; 330 bool HasCommittedFirstRealLoad() override; 331 bool WillStartNavigation(const WebNavigationInfo&) override; 332 void DidDropNavigation() override; 333 void DownloadURL( 334 const WebURLRequest& request, 335 network::mojom::blink::RedirectMode cross_origin_redirect_behavior, 336 CrossVariantMojoRemote<mojom::blink::BlobURLTokenInterfaceBase> 337 blob_url_token) override; 338 339 void InitializeCoreFrame( 340 Page&, 341 FrameOwner*, 342 WebFrame* parent, 343 WebFrame* previous_sibling, 344 FrameInsertType, 345 const AtomicString& name, 346 WindowAgentFactory*, 347 WebFrame* opener, 348 std::unique_ptr<blink::WebPolicyContainer> policy_container, 349 network::mojom::blink::WebSandboxFlags sandbox_flags = 350 network::mojom::blink::WebSandboxFlags::kNone, 351 const FeaturePolicyFeatureState& opener_feature_state = 352 FeaturePolicyFeatureState()); GetFrame()353 LocalFrame* GetFrame() const { return frame_.Get(); } 354 355 void WillBeDetached(); 356 void WillDetachParent(); 357 void CollectGarbageForTesting(); 358 359 static WebLocalFrameImpl* CreateMainFrame( 360 WebView*, 361 WebLocalFrameClient*, 362 InterfaceRegistry*, 363 const base::UnguessableToken& frame_token, 364 WebFrame* opener, 365 const WebString& name, 366 network::mojom::blink::WebSandboxFlags, 367 std::unique_ptr<blink::WebPolicyContainer>, 368 const FeaturePolicyFeatureState&); 369 static WebLocalFrameImpl* CreateProvisional( 370 WebLocalFrameClient*, 371 InterfaceRegistry*, 372 const base::UnguessableToken& frame_token, 373 WebFrame*, 374 const FramePolicy&, 375 const WebString& name); 376 377 WebLocalFrameImpl(util::PassKey<WebLocalFrameImpl>, 378 mojom::blink::TreeScopeType, 379 WebLocalFrameClient*, 380 blink::InterfaceRegistry*, 381 const base::UnguessableToken& frame_token); 382 WebLocalFrameImpl(util::PassKey<WebRemoteFrameImpl>, 383 mojom::blink::TreeScopeType, 384 WebLocalFrameClient*, 385 blink::InterfaceRegistry*, 386 const base::UnguessableToken& frame_token); 387 ~WebLocalFrameImpl() override; 388 389 LocalFrame* CreateChildFrame(const AtomicString& name, 390 HTMLFrameOwnerElement*); 391 std::pair<RemoteFrame*, PortalToken> CreatePortal( 392 HTMLPortalElement*, 393 mojo::PendingAssociatedReceiver<mojom::blink::Portal>, 394 mojo::PendingAssociatedRemote<mojom::blink::PortalClient>); 395 RemoteFrame* AdoptPortal(HTMLPortalElement*); 396 397 void DidChangeContentsSize(const IntSize&); 398 399 bool HasDevToolsOverlays() const; 400 void UpdateDevToolsOverlaysPrePaint(); 401 void PaintDevToolsOverlays(GraphicsContext&); // For CompositeAfterPaint. 402 403 void CreateFrameView(); 404 405 // Sometimes Blink makes Page/Frame for internal purposes like for SVGImage 406 // (see comments in third_party/blink/renderer/core/page/page.h). In that 407 // case, such frames are not associated with a WebLocalFrame(Impl). 408 // So note that FromFrame may return nullptr even for non-null frames. 409 static WebLocalFrameImpl* FromFrame(LocalFrame*); 410 static WebLocalFrameImpl* FromFrame(LocalFrame&); 411 412 WebViewImpl* ViewImpl() const; 413 GetFrameView()414 LocalFrameView* GetFrameView() const { 415 return GetFrame() ? GetFrame()->View() : nullptr; 416 } 417 418 void SendOrientationChangeEvent(); 419 420 void SetDevToolsAgentImpl(WebDevToolsAgentImpl*); 421 WebDevToolsAgentImpl* DevToolsAgentImpl(); 422 423 // Instructs devtools to pause loading of the frame as soon as it's shown 424 // until explicit command from the devtools client. May only be called on a 425 // local root. 426 void WaitForDebuggerWhenShown(); 427 428 // When a Find operation ends, we want to set the selection to what was active 429 // and set focus to the first focusable node we find (starting with the first 430 // node in the matched range and going up the inheritance chain). If we find 431 // nothing to focus we focus the first focusable node in the range. This 432 // allows us to set focus to a link (when we find text inside a link), which 433 // allows us to navigate by pressing Enter after closing the Find box. 434 void SetFindEndstateFocusAndSelection(); 435 436 void DidFailLoad(const ResourceError&, WebHistoryCommitType); 437 void DidFinish(); 438 SetClient(WebLocalFrameClient * client)439 void SetClient(WebLocalFrameClient* client) { client_ = client; } 440 FrameWidgetImpl()441 WebFrameWidgetBase* FrameWidgetImpl() { return frame_widget_; } 442 GetContentSettingsClient()443 WebContentSettingsClient* GetContentSettingsClient() { 444 return content_settings_client_; 445 } 446 GetTextCheckerClient()447 WebTextCheckClient* GetTextCheckerClient() const { 448 return text_check_client_; 449 } 450 GetFindInPage()451 FindInPage* GetFindInPage() const { return find_in_page_; } 452 453 TextFinder* GetTextFinder() const; 454 // Returns the text finder object if it already exists. 455 // Otherwise creates it and then returns. 456 TextFinder& EnsureTextFinder(); 457 458 void SetFrameWidget(WebFrameWidgetBase*); 459 460 // TODO(dcheng): Remove this and make |FrameWidget()| always return something 461 // useful. 462 WebFrameWidgetBase* LocalRootFrameWidget(); 463 464 // Returns true if the frame is focused. 465 bool IsFocused() const; 466 467 // Returns true if our print context suggests using printing layout. 468 bool UsePrintingLayout() const; 469 470 // Copy the current selection to the pboard. 471 void CopyToFindPboard(); 472 473 virtual void Trace(Visitor*) const; 474 475 protected: 476 // WebLocalFrame protected overrides: 477 void AddMessageToConsoleImpl(const WebConsoleMessage&, 478 bool discard_duplicates) override; 479 480 void AddInspectorIssueImpl(mojom::blink::InspectorIssueCode code) override; 481 482 private: 483 friend LocalFrameClientImpl; 484 485 // Sets the local core frame and registers destruction observers. 486 void SetCoreFrame(LocalFrame*); 487 488 // Inherited from WebFrame, but intentionally hidden: it never makes sense 489 // to call these on a WebLocalFrameImpl. 490 bool IsWebLocalFrame() const override; 491 WebLocalFrame* ToWebLocalFrame() override; 492 bool IsWebRemoteFrame() const override; 493 WebRemoteFrame* ToWebRemoteFrame() override; 494 495 HitTestResult HitTestResultForVisualViewportPos(const IntPoint&); 496 497 WebPlugin* FocusedPluginIfInputMethodSupported(); 498 ScrollableArea* LayoutViewport() const; 499 500 // A helper for DispatchBeforePrintEvent() and DispatchAfterPrintEvent(). 501 void DispatchPrintEventRecursively(const AtomicString& event_type); 502 503 WebPluginContainerImpl* GetPluginToPrintHelper( 504 const WebNode& constrain_to_node); 505 506 Node* ContextMenuNodeInner() const; 507 508 void InitializeCoreFrameInternal( 509 Page&, 510 FrameOwner*, 511 WebFrame* parent, 512 WebFrame* previous_sibling, 513 FrameInsertType, 514 const AtomicString& name, 515 WindowAgentFactory*, 516 WebFrame* opener, 517 std::unique_ptr<PolicyContainer> policy_container, 518 network::mojom::blink::WebSandboxFlags sandbox_flags = 519 network::mojom::blink::WebSandboxFlags::kNone, 520 const FeaturePolicyFeatureState& opener_feature_state = 521 FeaturePolicyFeatureState()); 522 523 WebLocalFrameClient* client_; 524 525 // TODO(dcheng): Inline this field directly rather than going through Member. 526 const Member<LocalFrameClientImpl> local_frame_client_; 527 528 // The embedder retains a reference to the WebCore LocalFrame while it is 529 // active in the DOM. This reference is released when the frame is removed 530 // from the DOM or the entire page is closed. 531 Member<LocalFrame> frame_; 532 533 // This is set if the frame is the root of a local frame tree, and requires a 534 // widget for layout. 535 Member<WebFrameWidgetBase> frame_widget_; 536 537 Member<WebDevToolsAgentImpl> dev_tools_agent_; 538 539 WebAutofillClient* autofill_client_; 540 541 WebContentCaptureClient* content_capture_client_ = nullptr; 542 543 WebContentSettingsClient* content_settings_client_ = nullptr; 544 545 Member<FindInPage> find_in_page_; 546 547 // Optional weak pointer to the WebPrintClient that initiated printing. Only 548 // valid when |is_in_printing_| is true. 549 base::WeakPtr<WebPrintClient> print_client_; 550 551 // Valid between calls to BeginPrint() and EndPrint(). Containts the print 552 // information. Is used by PrintPage(). 553 Member<ChromePrintContext> print_context_; 554 555 // Borrowed pointers to Mojo objects. 556 blink::InterfaceRegistry* interface_registry_; 557 558 WebInputMethodControllerImpl input_method_controller_; 559 560 WebTextCheckClient* text_check_client_; 561 562 WebSpellCheckPanelHostClient* spell_check_panel_host_client_; 563 564 // Oilpan: WebLocalFrameImpl must remain alive until close() is called. 565 // Accomplish that by keeping a self-referential Persistent<>. It is 566 // cleared upon close(). 567 SelfKeepAlive<WebLocalFrameImpl> self_keep_alive_; 568 569 #if DCHECK_IS_ON() 570 // True if DispatchBeforePrintEvent() was called, and 571 // DispatchAfterPrintEvent() is not called yet. 572 bool is_in_printing_ = false; 573 #endif 574 }; 575 576 template <> 577 struct DowncastTraits<WebLocalFrameImpl> { 578 static bool AllowFrom(const WebFrame& frame) { 579 return frame.IsWebLocalFrame(); 580 } 581 }; 582 583 } // namespace blink 584 585 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_WEB_LOCAL_FRAME_IMPL_H_ 586