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

Side by Side Diff: content/browser/web_contents/web_contents_impl.h

Issue 263973003: Move LoadProgressTracker to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final comment Created 6 years, 7 months 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 | Annotate | Revision Log
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_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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 virtual bool Send(IPC::Message* message) OVERRIDE; 321 virtual bool Send(IPC::Message* message) OVERRIDE;
322 322
323 // RenderFrameHostDelegate --------------------------------------------------- 323 // RenderFrameHostDelegate ---------------------------------------------------
324 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host, 324 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host,
325 const IPC::Message& message) OVERRIDE; 325 const IPC::Message& message) OVERRIDE;
326 virtual const GURL& GetMainFrameLastCommittedURL() const OVERRIDE; 326 virtual const GURL& GetMainFrameLastCommittedURL() const OVERRIDE;
327 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE; 327 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE;
328 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; 328 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE;
329 virtual void DidStartLoading(RenderFrameHost* render_frame_host, 329 virtual void DidStartLoading(RenderFrameHost* render_frame_host,
330 bool to_different_document) OVERRIDE; 330 bool to_different_document) OVERRIDE;
331 virtual void DidStopLoading(RenderFrameHost* render_frame_host) OVERRIDE;
332 virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE; 331 virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE;
333 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE; 332 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE;
334 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, 333 virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
335 const ContextMenuParams& params) OVERRIDE; 334 const ContextMenuParams& params) OVERRIDE;
336 virtual void RunJavaScriptMessage(RenderFrameHost* render_frame_host, 335 virtual void RunJavaScriptMessage(RenderFrameHost* render_frame_host,
337 const base::string16& message, 336 const base::string16& message,
338 const base::string16& default_prompt, 337 const base::string16& default_prompt,
339 const GURL& frame_url, 338 const GURL& frame_url,
340 JavaScriptMessageType type, 339 JavaScriptMessageType type,
341 IPC::Message* reply_msg) OVERRIDE; 340 IPC::Message* reply_msg) OVERRIDE;
(...skipping 28 matching lines...) Expand all
370 base::TerminationStatus status, 369 base::TerminationStatus status,
371 int error_code) OVERRIDE; 370 int error_code) OVERRIDE;
372 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; 371 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
373 virtual void UpdateState(RenderViewHost* render_view_host, 372 virtual void UpdateState(RenderViewHost* render_view_host,
374 int32 page_id, 373 int32 page_id,
375 const PageState& page_state) OVERRIDE; 374 const PageState& page_state) OVERRIDE;
376 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; 375 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
377 virtual void Close(RenderViewHost* render_view_host) OVERRIDE; 376 virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
378 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; 377 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
379 virtual void DidCancelLoading() OVERRIDE; 378 virtual void DidCancelLoading() OVERRIDE;
380 virtual void DidChangeLoadProgress(double progress) OVERRIDE;
381 virtual void DocumentAvailableInMainFrame( 379 virtual void DocumentAvailableInMainFrame(
382 RenderViewHost* render_view_host) OVERRIDE; 380 RenderViewHost* render_view_host) OVERRIDE;
383 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE; 381 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE;
384 virtual void RouteMessageEvent( 382 virtual void RouteMessageEvent(
385 RenderViewHost* rvh, 383 RenderViewHost* rvh,
386 const ViewMsg_PostMessage_Params& params) OVERRIDE; 384 const ViewMsg_PostMessage_Params& params) OVERRIDE;
387 virtual bool AddMessageToConsole(int32 level, 385 virtual bool AddMessageToConsole(int32 level,
388 const base::string16& message, 386 const base::string16& message,
389 int32 line_no, 387 int32 line_no,
390 const base::string16& source_id) OVERRIDE; 388 const base::string16& source_id) OVERRIDE;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 void OnDidLoadResourceFromMemoryCache(const GURL& url, 695 void OnDidLoadResourceFromMemoryCache(const GURL& url,
698 const std::string& security_info, 696 const std::string& security_info,
699 const std::string& http_request, 697 const std::string& http_request,
700 const std::string& mime_type, 698 const std::string& mime_type,
701 ResourceType::Type resource_type); 699 ResourceType::Type resource_type);
702 void OnDidDisplayInsecureContent(); 700 void OnDidDisplayInsecureContent();
703 void OnDidRunInsecureContent(const std::string& security_origin, 701 void OnDidRunInsecureContent(const std::string& security_origin,
704 const GURL& target_url); 702 const GURL& target_url);
705 void OnDocumentLoadedInFrame(); 703 void OnDocumentLoadedInFrame();
706 void OnDidFinishLoad(const GURL& url); 704 void OnDidFinishLoad(const GURL& url);
705 void OnDidStartLoading(bool to_different_document);
706 void OnDidStopLoading();
707 void OnDidChangeLoadProgress(double load_progress);
707 void OnGoToEntryAtOffset(int offset); 708 void OnGoToEntryAtOffset(int offset);
708 void OnUpdateZoomLimits(int minimum_percent, 709 void OnUpdateZoomLimits(int minimum_percent,
709 int maximum_percent, 710 int maximum_percent,
710 bool remember); 711 bool remember);
711 void OnEnumerateDirectory(int request_id, const base::FilePath& path); 712 void OnEnumerateDirectory(int request_id, const base::FilePath& path);
712 713
713 void OnRegisterProtocolHandler(const std::string& protocol, 714 void OnRegisterProtocolHandler(const std::string& protocol,
714 const GURL& url, 715 const GURL& url,
715 const base::string16& title, 716 const base::string16& title,
716 bool user_gesture); 717 bool user_gesture);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 816
816 // Finds the new RenderWidgetHost and returns it. Note that this can only be 817 // Finds the new RenderWidgetHost and returns it. Note that this can only be
817 // called once as this call also removes it from the internal map. 818 // called once as this call also removes it from the internal map.
818 RenderWidgetHostView* GetCreatedWidget(int route_id); 819 RenderWidgetHostView* GetCreatedWidget(int route_id);
819 820
820 // Finds the new WebContentsImpl by route_id, initializes it for 821 // Finds the new WebContentsImpl by route_id, initializes it for
821 // renderer-initiated creation, and returns it. Note that this can only be 822 // renderer-initiated creation, and returns it. Note that this can only be
822 // called once as this call also removes it from the internal map. 823 // called once as this call also removes it from the internal map.
823 WebContentsImpl* GetCreatedWindow(int route_id); 824 WebContentsImpl* GetCreatedWindow(int route_id);
824 825
826 // Tracking loading progress -------------------------------------------------
827
828 // Resets the tracking state of the current load.
829 void ResetLoadProgressState();
830
831 // Calculates the progress of the current load and notifies the delegate.
832 void SendLoadProgressChanged();
833
834 // Called once when the last frame on the page has stopped loading.
835 void DidStopLoading(RenderFrameHost* render_frame_host);
836
825 // Misc non-view stuff ------------------------------------------------------- 837 // Misc non-view stuff -------------------------------------------------------
826 838
827 // Helper functions for sending notifications. 839 // Helper functions for sending notifications.
828 void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host); 840 void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host);
829 void NotifyDisconnected(); 841 void NotifyDisconnected();
830 842
831 void SetEncoding(const std::string& encoding); 843 void SetEncoding(const std::string& encoding);
832 844
833 // TODO(creis): This should take in a FrameTreeNode to know which node's 845 // TODO(creis): This should take in a FrameTreeNode to know which node's
834 // render manager to return. For now, we just return the root's. 846 // render manager to return. For now, we just return the root's.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 bool waiting_for_response_; 950 bool waiting_for_response_;
939 951
940 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific 952 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
941 // to a given tab and SiteInstance, and must be valid for the lifetime of the 953 // to a given tab and SiteInstance, and must be valid for the lifetime of the
942 // WebContentsImpl. 954 // WebContentsImpl.
943 std::map<int32, int32> max_page_ids_; 955 std::map<int32, int32> max_page_ids_;
944 956
945 // The current load state and the URL associated with it. 957 // The current load state and the URL associated with it.
946 net::LoadStateWithParam load_state_; 958 net::LoadStateWithParam load_state_;
947 base::string16 load_state_host_; 959 base::string16 load_state_host_;
960
961 // LoadingProgressMap maps FrameTreeNode IDs to a double representing that
962 // frame's completion (from 0 to 1).
963 typedef base::hash_map<int64, double> LoadingProgressMap;
964 LoadingProgressMap loading_progresses_;
965 double loading_total_progress_;
966
967 base::TimeTicks loading_last_progress_update_;
968
969 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
970
971 // Counter to track how many frames have sent start notifications but not
972 // stop notifications.
973 int loading_frames_in_progress_;
974
948 // Upload progress, for displaying in the status bar. 975 // Upload progress, for displaying in the status bar.
949 // Set to zero when there is no significant upload happening. 976 // Set to zero when there is no significant upload happening.
950 uint64 upload_size_; 977 uint64 upload_size_;
951 uint64 upload_position_; 978 uint64 upload_position_;
952 979
953 // Data for current page ----------------------------------------------------- 980 // Data for current page -----------------------------------------------------
954 981
955 // When a title cannot be taken from any entry, this title will be used. 982 // When a title cannot be taken from any entry, this title will be used.
956 base::string16 page_title_when_no_navigation_entry_; 983 base::string16 page_title_when_no_navigation_entry_;
957 984
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 bool last_dialog_suppressed_; 1126 bool last_dialog_suppressed_;
1100 1127
1101 scoped_ptr<GeolocationDispatcherHost> geolocation_dispatcher_host_; 1128 scoped_ptr<GeolocationDispatcherHost> geolocation_dispatcher_host_;
1102 1129
1103 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); 1130 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
1104 }; 1131 };
1105 1132
1106 } // namespace content 1133 } // namespace content
1107 1134
1108 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1135 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698