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

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: cleanip 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 // Implementation of IPC::Sender. 332 // Implementation of IPC::Sender.
333 virtual bool Send(IPC::Message* message) OVERRIDE; 333 virtual bool Send(IPC::Message* message) OVERRIDE;
334 334
335 // RenderFrameHostDelegate --------------------------------------------------- 335 // RenderFrameHostDelegate ---------------------------------------------------
336 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host, 336 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host,
337 const IPC::Message& message) OVERRIDE; 337 const IPC::Message& message) OVERRIDE;
338 virtual const GURL& GetMainFrameLastCommittedURL() const OVERRIDE; 338 virtual const GURL& GetMainFrameLastCommittedURL() const OVERRIDE;
339 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE; 339 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE;
340 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; 340 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE;
341 // Called once when the first frame on the page has started loading.
jam 2014/05/05 23:19:10 nit: in general comments go in the interface and n
Avi (use Gerrit) 2014/05/05 23:34:27 Done.
nasko 2014/05/05 23:51:12 This isn't quite correct. It is called when we sta
341 virtual void DidStartLoading(RenderFrameHost* render_frame_host, 342 virtual void DidStartLoading(RenderFrameHost* render_frame_host,
342 bool to_different_document) OVERRIDE; 343 bool to_different_document) OVERRIDE;
343 virtual void DidStopLoading(RenderFrameHost* render_frame_host) OVERRIDE;
344 virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE; 344 virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE;
345 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE; 345 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE;
346 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, 346 virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
347 const ContextMenuParams& params) OVERRIDE; 347 const ContextMenuParams& params) OVERRIDE;
348 virtual void RunJavaScriptMessage(RenderFrameHost* render_frame_host, 348 virtual void RunJavaScriptMessage(RenderFrameHost* render_frame_host,
349 const base::string16& message, 349 const base::string16& message,
350 const base::string16& default_prompt, 350 const base::string16& default_prompt,
351 const GURL& frame_url, 351 const GURL& frame_url,
352 JavaScriptMessageType type, 352 JavaScriptMessageType type,
353 IPC::Message* reply_msg) OVERRIDE; 353 IPC::Message* reply_msg) OVERRIDE;
(...skipping 28 matching lines...) Expand all
382 virtual void UpdateTitle(RenderViewHost* render_view_host, 382 virtual void UpdateTitle(RenderViewHost* render_view_host,
383 int32 page_id, 383 int32 page_id,
384 const base::string16& title, 384 const base::string16& title,
385 base::i18n::TextDirection title_direction) OVERRIDE; 385 base::i18n::TextDirection title_direction) OVERRIDE;
386 virtual void UpdateEncoding(RenderViewHost* render_view_host, 386 virtual void UpdateEncoding(RenderViewHost* render_view_host,
387 const std::string& encoding) OVERRIDE; 387 const std::string& encoding) OVERRIDE;
388 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; 388 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
389 virtual void Close(RenderViewHost* render_view_host) OVERRIDE; 389 virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
390 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; 390 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
391 virtual void DidCancelLoading() OVERRIDE; 391 virtual void DidCancelLoading() OVERRIDE;
392 virtual void DidChangeLoadProgress(double progress) OVERRIDE;
393 virtual void DocumentAvailableInMainFrame( 392 virtual void DocumentAvailableInMainFrame(
394 RenderViewHost* render_view_host) OVERRIDE; 393 RenderViewHost* render_view_host) OVERRIDE;
395 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE; 394 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE;
396 virtual void RouteMessageEvent( 395 virtual void RouteMessageEvent(
397 RenderViewHost* rvh, 396 RenderViewHost* rvh,
398 const ViewMsg_PostMessage_Params& params) OVERRIDE; 397 const ViewMsg_PostMessage_Params& params) OVERRIDE;
399 virtual bool AddMessageToConsole(int32 level, 398 virtual bool AddMessageToConsole(int32 level,
400 const base::string16& message, 399 const base::string16& message,
401 int32 line_no, 400 int32 line_no,
402 const base::string16& source_id) OVERRIDE; 401 const base::string16& source_id) OVERRIDE;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 void OnDidLoadResourceFromMemoryCache(const GURL& url, 706 void OnDidLoadResourceFromMemoryCache(const GURL& url,
708 const std::string& security_info, 707 const std::string& security_info,
709 const std::string& http_request, 708 const std::string& http_request,
710 const std::string& mime_type, 709 const std::string& mime_type,
711 ResourceType::Type resource_type); 710 ResourceType::Type resource_type);
712 void OnDidDisplayInsecureContent(); 711 void OnDidDisplayInsecureContent();
713 void OnDidRunInsecureContent(const std::string& security_origin, 712 void OnDidRunInsecureContent(const std::string& security_origin,
714 const GURL& target_url); 713 const GURL& target_url);
715 void OnDocumentLoadedInFrame(); 714 void OnDocumentLoadedInFrame();
716 void OnDidFinishLoad(const GURL& url); 715 void OnDidFinishLoad(const GURL& url);
716 void OnDidStartLoading(bool to_different_document);
717 void OnDidStopLoading();
718 void OnDidChangeLoadProgress(double load_progress);
717 void OnGoToEntryAtOffset(int offset); 719 void OnGoToEntryAtOffset(int offset);
718 void OnUpdateZoomLimits(int minimum_percent, 720 void OnUpdateZoomLimits(int minimum_percent,
719 int maximum_percent, 721 int maximum_percent,
720 bool remember); 722 bool remember);
721 void OnEnumerateDirectory(int request_id, const base::FilePath& path); 723 void OnEnumerateDirectory(int request_id, const base::FilePath& path);
722 724
723 void OnRegisterProtocolHandler(const std::string& protocol, 725 void OnRegisterProtocolHandler(const std::string& protocol,
724 const GURL& url, 726 const GURL& url,
725 const base::string16& title, 727 const base::string16& title,
726 bool user_gesture); 728 bool user_gesture);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 829
828 // Finds the new RenderWidgetHost and returns it. Note that this can only be 830 // Finds the new RenderWidgetHost and returns it. Note that this can only be
829 // called once as this call also removes it from the internal map. 831 // called once as this call also removes it from the internal map.
830 RenderWidgetHostView* GetCreatedWidget(int route_id); 832 RenderWidgetHostView* GetCreatedWidget(int route_id);
831 833
832 // Finds the new WebContentsImpl by route_id, initializes it for 834 // Finds the new WebContentsImpl by route_id, initializes it for
833 // renderer-initiated creation, and returns it. Note that this can only be 835 // renderer-initiated creation, and returns it. Note that this can only be
834 // called once as this call also removes it from the internal map. 836 // called once as this call also removes it from the internal map.
835 WebContentsImpl* GetCreatedWindow(int route_id); 837 WebContentsImpl* GetCreatedWindow(int route_id);
836 838
839 // Tracking loading progress -------------------------------------------------
840
841 // Resets the tracking state of the current load.
842 void ResetLoadProgressState();
843
844 // Calculates the progress of the current load and notifies the delegate.
845 void SendLoadProgressChanged();
jam 2014/05/05 23:19:10 since these two methods are called internally only
Avi (use Gerrit) 2014/05/05 23:34:27 This *is* the private section.
846
847 // Called once when the last frame on the page has stopped loading.
848 void DidStopLoading(RenderFrameHost* render_frame_host);
jam 2014/05/05 23:19:10 this is only called by OnDidStopLoading() right? i
Avi (use Gerrit) 2014/05/05 23:34:27 Nope. This is called by OnDidStopLoading and by On
849
837 // Misc non-view stuff ------------------------------------------------------- 850 // Misc non-view stuff -------------------------------------------------------
838 851
839 // Helper functions for sending notifications. 852 // Helper functions for sending notifications.
840 void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host); 853 void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host);
841 void NotifyDisconnected(); 854 void NotifyDisconnected();
842 855
843 void SetEncoding(const std::string& encoding); 856 void SetEncoding(const std::string& encoding);
844 857
845 // TODO(creis): This should take in a FrameTreeNode to know which node's 858 // TODO(creis): This should take in a FrameTreeNode to know which node's
846 // render manager to return. For now, we just return the root's. 859 // render manager to return. For now, we just return the root's.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 bool waiting_for_response_; 970 bool waiting_for_response_;
958 971
959 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific 972 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
960 // to a given tab and SiteInstance, and must be valid for the lifetime of the 973 // to a given tab and SiteInstance, and must be valid for the lifetime of the
961 // WebContentsImpl. 974 // WebContentsImpl.
962 std::map<int32, int32> max_page_ids_; 975 std::map<int32, int32> max_page_ids_;
963 976
964 // The current load state and the URL associated with it. 977 // The current load state and the URL associated with it.
965 net::LoadStateWithParam load_state_; 978 net::LoadStateWithParam load_state_;
966 base::string16 load_state_host_; 979 base::string16 load_state_host_;
980
981 // LoadingProgressMap maps FrameTreeNode IDs to a double representing that
Avi (use Gerrit) 2014/05/05 22:28:42 A FrameTreeNode ID rather than a routing ID like b
982 // frame's completion (from 0 to 1).
983 typedef base::hash_map<int64, double> LoadingProgressMap;
984 LoadingProgressMap loading_progresses_;
985 double loading_total_progress_;
986
987 base::TimeTicks loading_last_progress_update_;
988
989 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
990
991 // Counter to track how many frames have sent start notifications but not
992 // stop notifications.
993 int loading_frames_in_progress_;
994
967 // Upload progress, for displaying in the status bar. 995 // Upload progress, for displaying in the status bar.
968 // Set to zero when there is no significant upload happening. 996 // Set to zero when there is no significant upload happening.
969 uint64 upload_size_; 997 uint64 upload_size_;
970 uint64 upload_position_; 998 uint64 upload_position_;
971 999
972 // Data for current page ----------------------------------------------------- 1000 // Data for current page -----------------------------------------------------
973 1001
974 // When a title cannot be taken from any entry, this title will be used. 1002 // When a title cannot be taken from any entry, this title will be used.
975 base::string16 page_title_when_no_navigation_entry_; 1003 base::string16 page_title_when_no_navigation_entry_;
976 1004
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 1141
1114 // Whether the last JavaScript dialog shown was suppressed. Used for testing. 1142 // Whether the last JavaScript dialog shown was suppressed. Used for testing.
1115 bool last_dialog_suppressed_; 1143 bool last_dialog_suppressed_;
1116 1144
1117 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); 1145 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
1118 }; 1146 };
1119 1147
1120 } // namespace content 1148 } // namespace content
1121 1149
1122 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1150 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698