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