Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: content/renderer/render_view_impl.h

Issue 694963003: Revert of Clean up the page state saving mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_view_browsertest_mac.mm ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 int history_list_offset() const { return history_list_offset_; } 199 int history_list_offset() const { return history_list_offset_; }
200 200
201 const WebPreferences& webkit_preferences() const { 201 const WebPreferences& webkit_preferences() const {
202 return webkit_preferences_; 202 return webkit_preferences_;
203 } 203 }
204 204
205 const RendererPreferences& renderer_preferences() const { 205 const RendererPreferences& renderer_preferences() const {
206 return renderer_preferences_; 206 return renderer_preferences_;
207 } 207 }
208 208
209 void set_page_state_sent_immediately(bool value) { 209 void set_send_content_state_immediately(bool value) {
210 page_state_sent_immediately_ = value; 210 send_content_state_immediately_ = value;
211 } 211 }
212 212
213 MouseLockDispatcher* mouse_lock_dispatcher() { 213 MouseLockDispatcher* mouse_lock_dispatcher() {
214 return mouse_lock_dispatcher_; 214 return mouse_lock_dispatcher_;
215 } 215 }
216 216
217 HistoryController* history_controller() { 217 HistoryController* history_controller() {
218 return history_controller_.get(); 218 return history_controller_.get();
219 } 219 }
220 220
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // supported PPAPI plug-ins. 303 // supported PPAPI plug-ins.
304 bool HasIMETextFocus(); 304 bool HasIMETextFocus();
305 305
306 // Callback for use with GetWindowSnapshot. 306 // Callback for use with GetWindowSnapshot.
307 typedef base::Callback<void( 307 typedef base::Callback<void(
308 const gfx::Size&, const std::vector<unsigned char>&)> 308 const gfx::Size&, const std::vector<unsigned char>&)>
309 WindowSnapshotCallback; 309 WindowSnapshotCallback;
310 310
311 void GetWindowSnapshot(const WindowSnapshotCallback& callback); 311 void GetWindowSnapshot(const WindowSnapshotCallback& callback);
312 312
313 // Forces the current page state to be flushed to the browser. 313 // Dispatches the current navigation state to the browser. Called on a
314 void ForcePageStateFlushForTesting(); 314 // periodic timer so we don't send too many messages.
315 void SyncNavigationState();
315 316
316 // Returns the length of the session history of this RenderView. Note that 317 // Returns the length of the session history of this RenderView. Note that
317 // this only coincides with the actual length of the session history if this 318 // this only coincides with the actual length of the session history if this
318 // RenderView is the currently active RenderView of a WebContents. 319 // RenderView is the currently active RenderView of a WebContents.
319 unsigned GetLocalSessionHistoryLengthForTesting() const; 320 unsigned GetLocalSessionHistoryLengthForTesting() const;
320 321
321 // Invokes OnSetFocus and marks the widget as active depending on the value 322 // Invokes OnSetFocus and marks the widget as active depending on the value
322 // of |enable|. This is used for layout tests that need to control the focus 323 // of |enable|. This is used for layout tests that need to control the focus
323 // synchronously from the renderer. 324 // synchronously from the renderer.
324 void SetFocusAndActivateForTesting(bool enable); 325 void SetFocusAndActivateForTesting(bool enable);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 gfx::Size GetSize() const override; 458 gfx::Size GetSize() const override;
458 WebPreferences& GetWebkitPreferences() override; 459 WebPreferences& GetWebkitPreferences() override;
459 void SetWebkitPreferences(const WebPreferences& preferences) override; 460 void SetWebkitPreferences(const WebPreferences& preferences) override;
460 blink::WebView* GetWebView() override; 461 blink::WebView* GetWebView() override;
461 blink::WebElement GetFocusedElement() const override; 462 blink::WebElement GetFocusedElement() const override;
462 bool IsEditableNode(const blink::WebNode& node) const override; 463 bool IsEditableNode(const blink::WebNode& node) const override;
463 bool NodeContainsPoint(const blink::WebNode& node, 464 bool NodeContainsPoint(const blink::WebNode& node,
464 const gfx::Point& point) const override; 465 const gfx::Point& point) const override;
465 bool ShouldDisplayScrollbars(int width, int height) const override; 466 bool ShouldDisplayScrollbars(int width, int height) const override;
466 int GetEnabledBindings() const override; 467 int GetEnabledBindings() const override;
467 bool IsPageStateSentImmediately() const override; 468 bool GetContentStateImmediately() const override;
468 blink::WebPageVisibilityState GetVisibilityState() const override; 469 blink::WebPageVisibilityState GetVisibilityState() const override;
469 void DidStartLoading() override; 470 void DidStartLoading() override;
470 void DidStopLoading() override; 471 void DidStopLoading() override;
471 void Repaint(const gfx::Size& size) override; 472 void Repaint(const gfx::Size& size) override;
472 void SetEditCommandForNextKeyEvent(const std::string& name, 473 void SetEditCommandForNextKeyEvent(const std::string& name,
473 const std::string& value) override; 474 const std::string& value) override;
474 void ClearEditCommands() override; 475 void ClearEditCommands() override;
475 SSLStatus GetSSLStatusOfFrame(blink::WebFrame* frame) const override; 476 SSLStatus GetSSLStatusOfFrame(blink::WebFrame* frame) const override;
476 const std::string& GetAcceptLanguages() const override; 477 const std::string& GetAcceptLanguages() const override;
477 #if defined(OS_ANDROID) 478 #if defined(OS_ANDROID)
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 621
621 static bool IsReload(FrameMsg_Navigate_Type::Value navigation_type); 622 static bool IsReload(FrameMsg_Navigate_Type::Value navigation_type);
622 623
623 static Referrer GetReferrerFromRequest( 624 static Referrer GetReferrerFromRequest(
624 blink::WebFrame* frame, 625 blink::WebFrame* frame,
625 const blink::WebURLRequest& request); 626 const blink::WebURLRequest& request);
626 627
627 static WindowOpenDisposition NavigationPolicyToDisposition( 628 static WindowOpenDisposition NavigationPolicyToDisposition(
628 blink::WebNavigationPolicy policy); 629 blink::WebNavigationPolicy policy);
629 630
631 void UpdateSessionHistory(blink::WebFrame* frame);
632 void SendUpdateState(HistoryEntry* entry);
633
630 // Sends a message and runs a nested message loop. 634 // Sends a message and runs a nested message loop.
631 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message); 635 bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
632 636
633 // IPC message handlers ------------------------------------------------------ 637 // IPC message handlers ------------------------------------------------------
634 // 638 //
635 // The documentation for these functions should be in 639 // The documentation for these functions should be in
636 // content/common/*_messages.h for the message that the function is handling. 640 // content/common/*_messages.h for the message that the function is handling.
637 void OnExecuteEditCommand(const std::string& name, const std::string& value); 641 void OnExecuteEditCommand(const std::string& name, const std::string& value);
638 void OnMoveCaret(const gfx::Point& point); 642 void OnMoveCaret(const gfx::Point& point);
639 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect); 643 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 #endif 773 #endif
770 774
771 // Sends a reply to the current find operation handling if it was a 775 // Sends a reply to the current find operation handling if it was a
772 // synchronous find request. 776 // synchronous find request.
773 void SendFindReply(int request_id, 777 void SendFindReply(int request_id,
774 int match_count, 778 int match_count,
775 int ordinal, 779 int ordinal,
776 const blink::WebRect& selection_rect, 780 const blink::WebRect& selection_rect,
777 bool final_status_update); 781 bool final_status_update);
778 782
779 // Marks the page state as being changed and in need of being sent to the 783 // Starts nav_state_sync_timer_ if it isn't already running.
780 // browser. (It will be sent on a delay, but that doesn't concern callers.) 784 void StartNavStateSyncTimerIfNecessary();
781 void MarkPageStateAsDirty();
782
783 // If there is a pending page state update that hasn't yet been sent to the
784 // browser, send it to the browser.
785 void FlushPageState();
786 785
787 #if defined(OS_POSIX) && !defined(OS_MACOSX) 786 #if defined(OS_POSIX) && !defined(OS_MACOSX)
788 void UpdateFontRenderingFromRendererPrefs(); 787 void UpdateFontRenderingFromRendererPrefs();
789 #else 788 #else
790 void UpdateFontRenderingFromRendererPrefs() {} 789 void UpdateFontRenderingFromRendererPrefs() {}
791 #endif 790 #endif
792 791
793 // Update the target url and tell the browser that the target URL has changed. 792 // Update the target url and tell the browser that the target URL has changed.
794 // If |url| is empty, show |fallback_url|. 793 // If |url| is empty, show |fallback_url|.
795 void UpdateTargetURL(const GURL& url, const GURL& fallback_url); 794 void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 // it in the same order in the .cc file as it was in the header. 831 // it in the same order in the .cc file as it was in the header.
833 // --------------------------------------------------------------------------- 832 // ---------------------------------------------------------------------------
834 833
835 // Settings ------------------------------------------------------------------ 834 // Settings ------------------------------------------------------------------
836 835
837 WebPreferences webkit_preferences_; 836 WebPreferences webkit_preferences_;
838 RendererPreferences renderer_preferences_; 837 RendererPreferences renderer_preferences_;
839 838
840 HostZoomLevels host_zoom_levels_; 839 HostZoomLevels host_zoom_levels_;
841 840
841 // Whether content state (such as form state, scroll position and page
842 // contents) should be sent to the browser immediately. This is normally
843 // false, but set to true by some tests.
844 bool send_content_state_immediately_;
845
842 // Bitwise-ORed set of extra bindings that have been enabled. See 846 // Bitwise-ORed set of extra bindings that have been enabled. See
843 // BindingsPolicy for details. 847 // BindingsPolicy for details.
844 int enabled_bindings_; 848 int enabled_bindings_;
845 849
846 // If true, we send IPC messages when |preferred_size_| changes. 850 // If true, we send IPC messages when |preferred_size_| changes.
847 bool send_preferred_size_changes_; 851 bool send_preferred_size_changes_;
848 852
849 // If non-empty, and |send_preferred_size_changes_| is true, disable drawing 853 // If non-empty, and |send_preferred_size_changes_| is true, disable drawing
850 // scroll bars on windows smaller than this size. Used for windows that the 854 // scroll bars on windows smaller than this size. Used for windows that the
851 // browser resizes to the size of the content, such as browser action popups. 855 // browser resizes to the size of the content, such as browser action popups.
(...skipping 24 matching lines...) Expand all
876 // PageGroupLoadDeferrer on the stack that interferes with swapping out. 880 // PageGroupLoadDeferrer on the stack that interferes with swapping out.
877 bool suppress_dialogs_until_swap_out_; 881 bool suppress_dialogs_until_swap_out_;
878 882
879 // Holds state pertaining to a navigation that we initiated. This is held by 883 // Holds state pertaining to a navigation that we initiated. This is held by
880 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_ 884 // the WebDataSource::ExtraData attribute. We use pending_navigation_state_
881 // as a temporary holder for the state until the WebDataSource corresponding 885 // as a temporary holder for the state until the WebDataSource corresponding
882 // to the new navigation is created. See DidCreateDataSource. 886 // to the new navigation is created. See DidCreateDataSource.
883 // TODO(nasko): Move to RenderFrame, as this is per-frame state. 887 // TODO(nasko): Move to RenderFrame, as this is per-frame state.
884 scoped_ptr<FrameMsg_Navigate_Params> pending_navigation_params_; 888 scoped_ptr<FrameMsg_Navigate_Params> pending_navigation_params_;
885 889
886 // Whether the page state (such as form state, scroll position and page 890 // Timer used to delay the updating of nav state (see SyncNavigationState).
887 // contents) should be sent to the browser immediately. This is normally 891 base::OneShotTimer<RenderViewImpl> nav_state_sync_timer_;
888 // false, but is set to true by some tests.
889 bool page_state_sent_immediately_;
890
891 // Whether the page state is dirty (meaning that the browser does not have an
892 // up-to-date copy).
893 bool page_state_dirty_;
894
895 // Timer used to delay the sending of the page state (see
896 // MarkPageStateAsDirty).
897 base::OneShotTimer<RenderViewImpl> page_state_timer_;
898 892
899 // Page IDs ------------------------------------------------------------------ 893 // Page IDs ------------------------------------------------------------------
900 // See documentation in RenderView. 894 // See documentation in RenderView.
901 int32 page_id_; 895 int32 page_id_;
902 896
903 // Indicates the ID of the last page that we sent a FrameNavigate to the 897 // Indicates the ID of the last page that we sent a FrameNavigate to the
904 // browser for. This is used to determine if the most recent transition 898 // browser for. This is used to determine if the most recent transition
905 // generated a history entry (less than page_id_), or not (equal to or 899 // generated a history entry (less than page_id_), or not (equal to or
906 // greater than). Note that this will be greater than page_id_ if the user 900 // greater than). Note that this will be greater than page_id_ if the user
907 // goes back. 901 // goes back.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 // use the Observer interface to filter IPC messages and receive frame change 1105 // use the Observer interface to filter IPC messages and receive frame change
1112 // notifications. 1106 // notifications.
1113 // --------------------------------------------------------------------------- 1107 // ---------------------------------------------------------------------------
1114 1108
1115 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); 1109 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
1116 }; 1110 };
1117 1111
1118 } // namespace content 1112 } // namespace content
1119 1113
1120 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ 1114 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest_mac.mm ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698