| 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_RENDERER_RENDER_VIEW_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
| 6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 static RenderViewImpl* FromWebView(blink::WebView* webview); | 177 static RenderViewImpl* FromWebView(blink::WebView* webview); |
| 178 | 178 |
| 179 // Returns the RenderViewImpl for the given routing ID. | 179 // Returns the RenderViewImpl for the given routing ID. |
| 180 static RenderViewImpl* FromRoutingID(int routing_id); | 180 static RenderViewImpl* FromRoutingID(int routing_id); |
| 181 | 181 |
| 182 static size_t GetRenderViewCount(); | 182 static size_t GetRenderViewCount(); |
| 183 | 183 |
| 184 // May return NULL when the view is closing. | 184 // May return NULL when the view is closing. |
| 185 blink::WebView* webview() const; | 185 blink::WebView* webview() const; |
| 186 | 186 |
| 187 int history_list_offset() const { return history_list_offset_; } | |
| 188 | |
| 189 const WebPreferences& webkit_preferences() const { | 187 const WebPreferences& webkit_preferences() const { |
| 190 return webkit_preferences_; | 188 return webkit_preferences_; |
| 191 } | 189 } |
| 192 | 190 |
| 193 const RendererPreferences& renderer_preferences() const { | 191 const RendererPreferences& renderer_preferences() const { |
| 194 return renderer_preferences_; | 192 return renderer_preferences_; |
| 195 } | 193 } |
| 196 | 194 |
| 197 void set_send_content_state_immediately(bool value) { | 195 void set_send_content_state_immediately(bool value) { |
| 198 send_content_state_immediately_ = value; | 196 send_content_state_immediately_ = value; |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // TODO(nasko): Temporarily friend RenderFrameImpl, so we don't duplicate | 542 // TODO(nasko): Temporarily friend RenderFrameImpl, so we don't duplicate |
| 545 // utility functions needed in both classes, while we move frame specific | 543 // utility functions needed in both classes, while we move frame specific |
| 546 // code away from this class. | 544 // code away from this class. |
| 547 friend class RenderFrameImpl; | 545 friend class RenderFrameImpl; |
| 548 | 546 |
| 549 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI); | 547 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, DecideNavigationPolicyForWebUI); |
| 550 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 548 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 551 DidFailProvisionalLoadWithErrorForError); | 549 DidFailProvisionalLoadWithErrorForError); |
| 552 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 550 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 553 DidFailProvisionalLoadWithErrorForCancellation); | 551 DidFailProvisionalLoadWithErrorForCancellation); |
| 554 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | |
| 555 DontIgnoreBackAfterNavEntryLimit); | |
| 556 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition); | 552 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ImeComposition); |
| 557 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters); | 553 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, InsertCharacters); |
| 558 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad); | 554 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, JSBlockSentAfterPageLoad); |
| 559 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState); | 555 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, LastCommittedUpdateState); |
| 560 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent); | 556 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnHandleKeyboardEvent); |
| 561 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeTypeChanged); | 557 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnImeTypeChanged); |
| 562 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged); | 558 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavStateChanged); |
| 563 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection); | 559 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnSetTextDirection); |
| 564 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences); | 560 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnUpdateWebPreferences); |
| 565 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 561 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 566 SetEditableSelectionAndComposition); | 562 SetEditableSelectionAndComposition); |
| 567 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored); | 563 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, StaleNavigationsIgnored); |
| 564 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 565 DontIgnoreBackAfterNavEntryLimit); |
| 568 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL); | 566 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, UpdateTargetURLWithInvalidURL); |
| 569 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 567 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 570 GetCompositionCharacterBoundsTest); | 568 GetCompositionCharacterBoundsTest); |
| 571 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost); | 569 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost); |
| 572 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 570 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 573 DecideNavigationPolicyHandlesAllTopLevel); | 571 DecideNavigationPolicyHandlesAllTopLevel); |
| 574 #if defined(OS_MACOSX) | 572 #if defined(OS_MACOSX) |
| 575 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); | 573 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); |
| 576 #endif | 574 #endif |
| 577 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune); | 575 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndOffset); |
| 578 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit); | 576 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit); |
| 579 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame); | 577 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame); |
| 580 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame); | 578 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame); |
| 581 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper); | 579 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper); |
| 582 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, | 580 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, |
| 583 MessageOrderInDidChangeSelection); | 581 MessageOrderInDidChangeSelection); |
| 584 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendCandidateWindowEvents); | 582 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendCandidateWindowEvents); |
| 585 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, Suppresses); | 583 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, Suppresses); |
| 586 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, DoesNotSuppress); | 584 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, DoesNotSuppress); |
| 587 | 585 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 const blink::WebMediaPlayerAction& action); | 676 const blink::WebMediaPlayerAction& action); |
| 679 void OnPluginActionAt(const gfx::Point& location, | 677 void OnPluginActionAt(const gfx::Point& location, |
| 680 const blink::WebPluginAction& action); | 678 const blink::WebPluginAction& action); |
| 681 void OnMoveOrResizeStarted(); | 679 void OnMoveOrResizeStarted(); |
| 682 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params); | 680 void OnPostMessageEvent(const ViewMsg_PostMessage_Params& params); |
| 683 void OnReleaseDisambiguationPopupBitmap(const cc::SharedBitmapId& id); | 681 void OnReleaseDisambiguationPopupBitmap(const cc::SharedBitmapId& id); |
| 684 void OnResetPageEncodingToDefault(); | 682 void OnResetPageEncodingToDefault(); |
| 685 void OnSetActive(bool active); | 683 void OnSetActive(bool active); |
| 686 void OnSetBackgroundOpaque(bool opaque); | 684 void OnSetBackgroundOpaque(bool opaque); |
| 687 void OnExitFullscreen(); | 685 void OnExitFullscreen(); |
| 688 void OnSetHistoryLengthAndPrune(int history_length, int32 minimum_page_id); | 686 void OnSetHistoryOffsetAndLength(int history_offset, int history_length); |
| 689 void OnSetInitialFocus(bool reverse); | 687 void OnSetInitialFocus(bool reverse); |
| 690 void OnSetPageEncoding(const std::string& encoding_name); | 688 void OnSetPageEncoding(const std::string& encoding_name); |
| 691 void OnSetRendererPrefs(const RendererPreferences& renderer_prefs); | 689 void OnSetRendererPrefs(const RendererPreferences& renderer_prefs); |
| 692 void OnSetWebUIProperty(const std::string& name, const std::string& value); | 690 void OnSetWebUIProperty(const std::string& name, const std::string& value); |
| 693 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level); | 691 void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level); |
| 694 void OnSetZoomLevelForView(bool uses_temporary_zoom_level, double level); | 692 void OnSetZoomLevelForView(bool uses_temporary_zoom_level, double level); |
| 695 void OnStopFinding(StopFindAction action); | 693 void OnStopFinding(StopFindAction action); |
| 696 void OnSuppressDialogsUntilSwapOut(); | 694 void OnSuppressDialogsUntilSwapOut(); |
| 697 void OnThemeChanged(); | 695 void OnThemeChanged(); |
| 698 void OnUpdateTargetURLAck(); | 696 void OnUpdateTargetURLAck(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 725 // and put it in the same position in the .cc file. | 723 // and put it in the same position in the .cc file. |
| 726 | 724 |
| 727 // Misc private functions ---------------------------------------------------- | 725 // Misc private functions ---------------------------------------------------- |
| 728 // Check whether the preferred size has changed. | 726 // Check whether the preferred size has changed. |
| 729 void CheckPreferredSize(); | 727 void CheckPreferredSize(); |
| 730 | 728 |
| 731 // Called to get the WebPlugin to handle find requests in the document. | 729 // Called to get the WebPlugin to handle find requests in the document. |
| 732 // Returns NULL if there is no such WebPlugin. | 730 // Returns NULL if there is no such WebPlugin. |
| 733 blink::WebPlugin* GetWebPluginForFind(); | 731 blink::WebPlugin* GetWebPluginForFind(); |
| 734 | 732 |
| 735 // Returns true if the |params| navigation is to an entry that has been | |
| 736 // cropped due to a recent navigation the browser did not know about. | |
| 737 bool IsBackForwardToStaleEntry(const PageState& state, | |
| 738 int pending_history_list_offset, | |
| 739 int32 page_id, | |
| 740 bool is_reload); | |
| 741 | 733 |
| 742 // If we initiated a navigation, this function will populate |document_state| | 734 // If we initiated a navigation, this function will populate |document_state| |
| 743 // with the navigation information saved in OnNavigate(). | 735 // with the navigation information saved in OnNavigate(). |
| 744 void PopulateDocumentStateFromPending(DocumentState* document_state); | 736 void PopulateDocumentStateFromPending(DocumentState* document_state); |
| 745 | 737 |
| 746 // Returns a new NavigationState populated with the navigation information | 738 // Returns a new NavigationState populated with the navigation information |
| 747 // saved in OnNavigate(). | 739 // saved in OnNavigate(). |
| 748 NavigationState* CreateNavigationStateFromPending(); | 740 NavigationState* CreateNavigationStateFromPending(); |
| 749 | 741 |
| 750 // Processes the command-line flags --enable-viewport, | 742 // Processes the command-line flags --enable-viewport, |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 // navigations, the history may have some entries that were committed in other | 889 // navigations, the history may have some entries that were committed in other |
| 898 // processes. We won't know about them until the next navigation in this | 890 // processes. We won't know about them until the next navigation in this |
| 899 // process. | 891 // process. |
| 900 int history_list_length_; | 892 int history_list_length_; |
| 901 | 893 |
| 902 // Counter to track how many frames have sent start notifications but not stop | 894 // Counter to track how many frames have sent start notifications but not stop |
| 903 // notifications. TODO(avi): Remove this once DidStartLoading/DidStopLoading | 895 // notifications. TODO(avi): Remove this once DidStartLoading/DidStopLoading |
| 904 // are gone. | 896 // are gone. |
| 905 int frames_in_progress_; | 897 int frames_in_progress_; |
| 906 | 898 |
| 907 // The list of page IDs for each history item this RenderView knows about. | |
| 908 // Some entries may be -1 if they were rendered by other processes or were | |
| 909 // restored from a previous session. This lets us detect attempts to | |
| 910 // navigate to stale entries that have been cropped from our history. | |
| 911 std::vector<int32> history_page_ids_; | |
| 912 | |
| 913 // UI state ------------------------------------------------------------------ | 899 // UI state ------------------------------------------------------------------ |
| 914 | 900 |
| 915 // The state of our target_url transmissions. When we receive a request to | 901 // The state of our target_url transmissions. When we receive a request to |
| 916 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK | 902 // send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK |
| 917 // comes back - if a new request comes in before the ACK, we store the new | 903 // comes back - if a new request comes in before the ACK, we store the new |
| 918 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an | 904 // URL in pending_target_url_ and set the status to TARGET_PENDING. If an |
| 919 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and | 905 // ACK comes back and we are in TARGET_PENDING, we send the stored URL and |
| 920 // revert to TARGET_INFLIGHT. | 906 // revert to TARGET_INFLIGHT. |
| 921 // | 907 // |
| 922 // We don't need a queue of URLs to send, as only the latest is useful. | 908 // We don't need a queue of URLs to send, as only the latest is useful. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 // use the Observer interface to filter IPC messages and receive frame change | 1075 // use the Observer interface to filter IPC messages and receive frame change |
| 1090 // notifications. | 1076 // notifications. |
| 1091 // --------------------------------------------------------------------------- | 1077 // --------------------------------------------------------------------------- |
| 1092 | 1078 |
| 1093 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); | 1079 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); |
| 1094 }; | 1080 }; |
| 1095 | 1081 |
| 1096 } // namespace content | 1082 } // namespace content |
| 1097 | 1083 |
| 1098 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 1084 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
| OLD | NEW |