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

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

Issue 925623002: Refactor the loading tracking logic in WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments + add test Created 5 years, 10 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
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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 WebContentsImpl* GetCreatedWindow(int route_id); 898 WebContentsImpl* GetCreatedWindow(int route_id);
899 899
900 // Tracking loading progress ------------------------------------------------- 900 // Tracking loading progress -------------------------------------------------
901 901
902 // Resets the tracking state of the current load. 902 // Resets the tracking state of the current load.
903 void ResetLoadProgressState(); 903 void ResetLoadProgressState();
904 904
905 // Calculates the progress of the current load and notifies the delegate. 905 // Calculates the progress of the current load and notifies the delegate.
906 void SendLoadProgressChanged(); 906 void SendLoadProgressChanged();
907 907
908 // Returns true if at least one of the nodes in the |frame_tree_| is loading,
909 // false otherwise.
910 bool IsFrameTreeLoading();
911
908 // Misc non-view stuff ------------------------------------------------------- 912 // Misc non-view stuff -------------------------------------------------------
909 913
910 // Sets the history for a specified RenderViewHost to |history_length| 914 // Sets the history for a specified RenderViewHost to |history_length|
911 // entries, with an offset of |history_offset|. 915 // entries, with an offset of |history_offset|.
912 void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host, 916 void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host,
913 int history_offset, 917 int history_offset,
914 int history_length); 918 int history_length);
915 919
916 // Helper functions for sending notifications. 920 // Helper functions for sending notifications.
917 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host); 921 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 1052
1049 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific 1053 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
1050 // to a given tab and SiteInstance, and must be valid for the lifetime of the 1054 // to a given tab and SiteInstance, and must be valid for the lifetime of the
1051 // WebContentsImpl. 1055 // WebContentsImpl.
1052 std::map<int32, int32> max_page_ids_; 1056 std::map<int32, int32> max_page_ids_;
1053 1057
1054 // The current load state and the URL associated with it. 1058 // The current load state and the URL associated with it.
1055 net::LoadStateWithParam load_state_; 1059 net::LoadStateWithParam load_state_;
1056 base::string16 load_state_host_; 1060 base::string16 load_state_host_;
1057 1061
1058 // LoadingProgressMap maps FrameTreeNode IDs to a double representing that
1059 // frame's completion (from 0 to 1).
1060 typedef base::hash_map<int64, double> LoadingProgressMap;
1061 LoadingProgressMap loading_progresses_;
1062 double loading_total_progress_; 1062 double loading_total_progress_;
1063 1063
1064 base::TimeTicks loading_last_progress_update_; 1064 base::TimeTicks loading_last_progress_update_;
1065 1065
1066 // Counter to track how many frames have sent start notifications but not
1067 // stop notifications.
1068 int loading_frames_in_progress_;
1069
1070 // Upload progress, for displaying in the status bar. 1066 // Upload progress, for displaying in the status bar.
1071 // Set to zero when there is no significant upload happening. 1067 // Set to zero when there is no significant upload happening.
1072 uint64 upload_size_; 1068 uint64 upload_size_;
1073 uint64 upload_position_; 1069 uint64 upload_position_;
1074 1070
1075 // Data for current page ----------------------------------------------------- 1071 // Data for current page -----------------------------------------------------
1076 1072
1077 // When a title cannot be taken from any entry, this title will be used. 1073 // When a title cannot be taken from any entry, this title will be used.
1078 base::string16 page_title_when_no_navigation_entry_; 1074 base::string16 page_title_when_no_navigation_entry_;
1079 1075
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 // Adds/removes a callback called on creation of each new WebContents. 1263 // Adds/removes a callback called on creation of each new WebContents.
1268 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); 1264 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1269 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); 1265 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1270 1266
1271 DISALLOW_COPY_AND_ASSIGN(FriendZone); 1267 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1272 }; 1268 };
1273 1269
1274 } // namespace content 1270 } // namespace content
1275 1271
1276 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1272 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698