OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 virtual void RunJavaScriptMessage(RenderFrameHost* rfh, | 332 virtual void RunJavaScriptMessage(RenderFrameHost* rfh, |
333 const base::string16& message, | 333 const base::string16& message, |
334 const base::string16& default_prompt, | 334 const base::string16& default_prompt, |
335 const GURL& frame_url, | 335 const GURL& frame_url, |
336 JavaScriptMessageType type, | 336 JavaScriptMessageType type, |
337 IPC::Message* reply_msg) OVERRIDE; | 337 IPC::Message* reply_msg) OVERRIDE; |
338 virtual void RunBeforeUnloadConfirm(RenderFrameHost* rfh, | 338 virtual void RunBeforeUnloadConfirm(RenderFrameHost* rfh, |
339 const base::string16& message, | 339 const base::string16& message, |
340 bool is_reload, | 340 bool is_reload, |
341 IPC::Message* reply_msg) OVERRIDE; | 341 IPC::Message* reply_msg) OVERRIDE; |
| 342 virtual void DidAccessInitialDocument() OVERRIDE; |
342 virtual WebContents* GetAsWebContents() OVERRIDE; | 343 virtual WebContents* GetAsWebContents() OVERRIDE; |
343 virtual bool IsNeverVisible() OVERRIDE; | 344 virtual bool IsNeverVisible() OVERRIDE; |
344 | 345 |
345 // RenderViewHostDelegate ---------------------------------------------------- | 346 // RenderViewHostDelegate ---------------------------------------------------- |
346 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; | 347 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; |
347 virtual bool OnMessageReceived(RenderViewHost* render_view_host, | 348 virtual bool OnMessageReceived(RenderViewHost* render_view_host, |
348 const IPC::Message& message) OVERRIDE; | 349 const IPC::Message& message) OVERRIDE; |
349 // RenderFrameHostDelegate has the same method, so list it there because this | 350 // RenderFrameHostDelegate has the same method, so list it there because this |
350 // interface is going away. | 351 // interface is going away. |
351 // virtual WebContents* GetAsWebContents() OVERRIDE; | 352 // virtual WebContents* GetAsWebContents() OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... |
364 const base::string16& title, | 365 const base::string16& title, |
365 base::i18n::TextDirection title_direction) OVERRIDE; | 366 base::i18n::TextDirection title_direction) OVERRIDE; |
366 virtual void UpdateEncoding(RenderViewHost* render_view_host, | 367 virtual void UpdateEncoding(RenderViewHost* render_view_host, |
367 const std::string& encoding) OVERRIDE; | 368 const std::string& encoding) OVERRIDE; |
368 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; | 369 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; |
369 virtual void Close(RenderViewHost* render_view_host) OVERRIDE; | 370 virtual void Close(RenderViewHost* render_view_host) OVERRIDE; |
370 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; | 371 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; |
371 virtual void DidCancelLoading() OVERRIDE; | 372 virtual void DidCancelLoading() OVERRIDE; |
372 virtual void DidChangeLoadProgress(double progress) OVERRIDE; | 373 virtual void DidChangeLoadProgress(double progress) OVERRIDE; |
373 virtual void DidDisownOpener(RenderViewHost* rvh) OVERRIDE; | 374 virtual void DidDisownOpener(RenderViewHost* rvh) OVERRIDE; |
374 virtual void DidAccessInitialDocument() OVERRIDE; | |
375 virtual void DocumentAvailableInMainFrame( | 375 virtual void DocumentAvailableInMainFrame( |
376 RenderViewHost* render_view_host) OVERRIDE; | 376 RenderViewHost* render_view_host) OVERRIDE; |
377 virtual void DocumentOnLoadCompletedInMainFrame( | 377 virtual void DocumentOnLoadCompletedInMainFrame( |
378 RenderViewHost* render_view_host, | 378 RenderViewHost* render_view_host, |
379 int32 page_id) OVERRIDE; | 379 int32 page_id) OVERRIDE; |
380 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE; | 380 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE; |
381 virtual void RouteMessageEvent( | 381 virtual void RouteMessageEvent( |
382 RenderViewHost* rvh, | 382 RenderViewHost* rvh, |
383 const ViewMsg_PostMessage_Params& params) OVERRIDE; | 383 const ViewMsg_PostMessage_Params& params) OVERRIDE; |
384 virtual bool AddMessageToConsole(int32 level, | 384 virtual bool AddMessageToConsole(int32 level, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 virtual WebContents* GetWebContents() OVERRIDE; | 550 virtual WebContents* GetWebContents() OVERRIDE; |
551 virtual void NotifyNavigationEntryCommitted( | 551 virtual void NotifyNavigationEntryCommitted( |
552 const LoadCommittedDetails& load_details) OVERRIDE; | 552 const LoadCommittedDetails& load_details) OVERRIDE; |
553 | 553 |
554 // Invoked before a form repost warning is shown. | 554 // Invoked before a form repost warning is shown. |
555 virtual void NotifyBeforeFormRepostWarningShow() OVERRIDE; | 555 virtual void NotifyBeforeFormRepostWarningShow() OVERRIDE; |
556 | 556 |
557 // Activate this WebContents and show a form repost warning. | 557 // Activate this WebContents and show a form repost warning. |
558 virtual void ActivateAndShowRepostFormWarningDialog() OVERRIDE; | 558 virtual void ActivateAndShowRepostFormWarningDialog() OVERRIDE; |
559 | 559 |
| 560 // Whether the initial empty page of this view has been accessed by another |
| 561 // page, making it unsafe to show the pending URL. Always false after the |
| 562 // first commit. |
| 563 virtual bool HasAccessedInitialDocument() OVERRIDE; |
| 564 |
560 // Updates the max page ID for the current SiteInstance in this | 565 // Updates the max page ID for the current SiteInstance in this |
561 // WebContentsImpl to be at least |page_id|. | 566 // WebContentsImpl to be at least |page_id|. |
562 virtual void UpdateMaxPageID(int32 page_id) OVERRIDE; | 567 virtual void UpdateMaxPageID(int32 page_id) OVERRIDE; |
563 | 568 |
564 // Updates the max page ID for the given SiteInstance in this WebContentsImpl | 569 // Updates the max page ID for the given SiteInstance in this WebContentsImpl |
565 // to be at least |page_id|. | 570 // to be at least |page_id|. |
566 virtual void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance, | 571 virtual void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance, |
567 int32 page_id) OVERRIDE; | 572 int32 page_id) OVERRIDE; |
568 | 573 |
569 // Copy the current map of SiteInstance ID to max page ID from another tab. | 574 // Copy the current map of SiteInstance ID to max page ID from another tab. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 bool to_different_document, | 618 bool to_different_document, |
614 LoadNotificationDetails* details) OVERRIDE; | 619 LoadNotificationDetails* details) OVERRIDE; |
615 | 620 |
616 typedef base::Callback<void(WebContents*)> CreatedCallback; | 621 typedef base::Callback<void(WebContents*)> CreatedCallback; |
617 | 622 |
618 // Requests the renderer to select the region between two points in the | 623 // Requests the renderer to select the region between two points in the |
619 // currently focused frame. | 624 // currently focused frame. |
620 void SelectRange(const gfx::Point& start, const gfx::Point& end); | 625 void SelectRange(const gfx::Point& start, const gfx::Point& end); |
621 | 626 |
622 private: | 627 private: |
623 friend class NavigationControllerImpl; | |
624 friend class TestNavigationObserver; | 628 friend class TestNavigationObserver; |
625 friend class WebContentsObserver; | 629 friend class WebContentsObserver; |
626 friend class WebContents; // To implement factory methods. | 630 friend class WebContents; // To implement factory methods. |
627 | 631 |
628 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); | 632 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); |
629 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); | 633 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); |
630 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); | 634 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); |
631 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, | 635 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
632 CrossSiteCantPreemptAfterUnload); | 636 CrossSiteCantPreemptAfterUnload); |
633 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); | 637 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 // When a navigation occurs, we record its contents MIME type. It can be | 966 // When a navigation occurs, we record its contents MIME type. It can be |
963 // used to check whether we can do something for some special contents. | 967 // used to check whether we can do something for some special contents. |
964 std::string contents_mime_type_; | 968 std::string contents_mime_type_; |
965 | 969 |
966 // Character encoding. | 970 // Character encoding. |
967 std::string encoding_; | 971 std::string encoding_; |
968 | 972 |
969 // True if this is a secure page which displayed insecure content. | 973 // True if this is a secure page which displayed insecure content. |
970 bool displayed_insecure_content_; | 974 bool displayed_insecure_content_; |
971 | 975 |
| 976 // Whether the initial empty page has been accessed by another page, making it |
| 977 // unsafe to show the pending URL. Usually false unless another window tries |
| 978 // to modify the blank page. Always false after the first commit. |
| 979 bool has_accessed_initial_document_; |
| 980 |
972 // Data for misc internal state ---------------------------------------------- | 981 // Data for misc internal state ---------------------------------------------- |
973 | 982 |
974 // When > 0, the WebContents is currently being captured (e.g., for | 983 // When > 0, the WebContents is currently being captured (e.g., for |
975 // screenshots or mirroring); and the underlying RenderWidgetHost should not | 984 // screenshots or mirroring); and the underlying RenderWidgetHost should not |
976 // be told it is hidden. | 985 // be told it is hidden. |
977 int capturer_count_; | 986 int capturer_count_; |
978 | 987 |
979 // Tracks whether RWHV should be visible once capturer_count_ becomes zero. | 988 // Tracks whether RWHV should be visible once capturer_count_ becomes zero. |
980 bool should_normally_be_visible_; | 989 bool should_normally_be_visible_; |
981 | 990 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 | 1102 |
1094 // Whether the last JavaScript dialog shown was suppressed. Used for testing. | 1103 // Whether the last JavaScript dialog shown was suppressed. Used for testing. |
1095 bool last_dialog_suppressed_; | 1104 bool last_dialog_suppressed_; |
1096 | 1105 |
1097 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 1106 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
1098 }; | 1107 }; |
1099 | 1108 |
1100 } // namespace content | 1109 } // namespace content |
1101 | 1110 |
1102 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1111 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |