OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FRAME_HOST_NAVIGATOR_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "content/browser/frame_host/navigation_controller_impl.h" | 9 #include "content/browser/frame_host/navigation_controller_impl.h" |
10 #include "content/browser/frame_host/navigator.h" | 10 #include "content/browser/frame_host/navigator.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 class NavigationControllerImpl; | 15 class NavigationControllerImpl; |
16 class NavigatorDelegate; | 16 class NavigatorDelegate; |
17 struct LoadCommittedDetails; | 17 struct LoadCommittedDetails; |
| 18 class LoadProgressTracker; |
18 | 19 |
19 // This class is an implementation of Navigator, responsible for managing | 20 // This class is an implementation of Navigator, responsible for managing |
20 // navigations in regular browser tabs. | 21 // navigations in regular browser tabs. |
21 class CONTENT_EXPORT NavigatorImpl : public Navigator { | 22 class CONTENT_EXPORT NavigatorImpl : public Navigator { |
22 public: | 23 public: |
23 NavigatorImpl(NavigationControllerImpl* navigation_controller, | 24 NavigatorImpl(NavigationControllerImpl* navigation_controller, |
24 NavigatorDelegate* delegate); | 25 NavigatorDelegate* delegate); |
25 | 26 |
26 // Navigator implementation. | 27 // Navigator implementation. |
27 virtual NavigationController* GetController() OVERRIDE; | 28 virtual NavigationController* GetController() OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
42 int32 page_id, | 43 int32 page_id, |
43 const GURL& source_url, | 44 const GURL& source_url, |
44 const GURL& target_url) OVERRIDE; | 45 const GURL& target_url) OVERRIDE; |
45 virtual void DidNavigate( | 46 virtual void DidNavigate( |
46 RenderFrameHostImpl* render_frame_host, | 47 RenderFrameHostImpl* render_frame_host, |
47 const FrameHostMsg_DidCommitProvisionalLoad_Params& | 48 const FrameHostMsg_DidCommitProvisionalLoad_Params& |
48 input_params) OVERRIDE; | 49 input_params) OVERRIDE; |
49 virtual bool NavigateToPendingEntry( | 50 virtual bool NavigateToPendingEntry( |
50 RenderFrameHostImpl* render_frame_host, | 51 RenderFrameHostImpl* render_frame_host, |
51 NavigationController::ReloadType reload_type) OVERRIDE; | 52 NavigationController::ReloadType reload_type) OVERRIDE; |
| 53 virtual void DidStartLoading(RenderFrameHostImpl* render_frame_host, |
| 54 bool to_different_document) OVERRIDE; |
| 55 virtual void DidStopLoading(RenderFrameHostImpl* render_frame_host) OVERRIDE; |
| 56 virtual void DidChangeLoadProgress(RenderFrameHostImpl* render_frame_host, |
| 57 double load_progress) OVERRIDE; |
52 virtual base::TimeTicks GetCurrentLoadStart() OVERRIDE; | 58 virtual base::TimeTicks GetCurrentLoadStart() OVERRIDE; |
53 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host, | 59 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host, |
54 const GURL& url, | 60 const GURL& url, |
55 const Referrer& referrer, | 61 const Referrer& referrer, |
56 WindowOpenDisposition disposition, | 62 WindowOpenDisposition disposition, |
57 bool should_replace_current_entry, | 63 bool should_replace_current_entry, |
58 bool user_gesture) OVERRIDE; | 64 bool user_gesture) OVERRIDE; |
59 virtual void RequestTransferURL( | 65 virtual void RequestTransferURL( |
60 RenderFrameHostImpl* render_frame_host, | 66 RenderFrameHostImpl* render_frame_host, |
61 const GURL& url, | 67 const GURL& url, |
62 const std::vector<GURL>& redirect_chain, | 68 const std::vector<GURL>& redirect_chain, |
63 const Referrer& referrer, | 69 const Referrer& referrer, |
64 PageTransition page_transition, | 70 PageTransition page_transition, |
65 WindowOpenDisposition disposition, | 71 WindowOpenDisposition disposition, |
66 const GlobalRequestID& transferred_global_request_id, | 72 const GlobalRequestID& transferred_global_request_id, |
67 bool should_replace_current_entry, | 73 bool should_replace_current_entry, |
68 bool user_gesture) OVERRIDE; | 74 bool user_gesture) OVERRIDE; |
69 | 75 |
| 76 LoadProgressTracker* load_progress_tracker_for_testing() { |
| 77 return load_progress_tracker_.get(); |
| 78 } |
| 79 |
70 private: | 80 private: |
71 virtual ~NavigatorImpl() {} | 81 virtual ~NavigatorImpl(); |
72 | 82 |
73 // Navigates to the given entry, which must be the pending entry. Private | 83 // Navigates to the given entry, which must be the pending entry. Private |
74 // because all callers should use NavigateToPendingEntry. | 84 // because all callers should use NavigateToPendingEntry. |
75 bool NavigateToEntry( | 85 bool NavigateToEntry( |
76 RenderFrameHostImpl* render_frame_host, | 86 RenderFrameHostImpl* render_frame_host, |
77 const NavigationEntryImpl& entry, | 87 const NavigationEntryImpl& entry, |
78 NavigationController::ReloadType reload_type); | 88 NavigationController::ReloadType reload_type); |
79 | 89 |
80 bool ShouldAssignSiteForURL(const GURL& url); | 90 bool ShouldAssignSiteForURL(const GURL& url); |
81 | 91 |
82 // The NavigationController that will keep track of session history for all | 92 // The NavigationController that will keep track of session history for all |
83 // RenderFrameHost objects using this NavigatorImpl. | 93 // RenderFrameHost objects using this NavigatorImpl. |
84 // TODO(nasko): Move ownership of the NavigationController from | 94 // TODO(nasko): Move ownership of the NavigationController from |
85 // WebContentsImpl to this class. | 95 // WebContentsImpl to this class. |
86 NavigationControllerImpl* controller_; | 96 NavigationControllerImpl* controller_; |
87 | 97 |
88 // Used to notify the object embedding this Navigator about navigation | 98 // Used to notify the object embedding this Navigator about navigation |
89 // events. Can be NULL in tests. | 99 // events. Can be NULL in tests. |
90 NavigatorDelegate* delegate_; | 100 NavigatorDelegate* delegate_; |
91 | 101 |
92 // System time at which the current load was started. | 102 // System time at which the current load was started. |
93 base::TimeTicks current_load_start_; | 103 base::TimeTicks current_load_start_; |
94 | 104 |
| 105 // Reports load progress. |
| 106 scoped_ptr<LoadProgressTracker> load_progress_tracker_; |
| 107 |
95 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); | 108 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); |
96 }; | 109 }; |
97 | 110 |
98 } // namespace content | 111 } // namespace content |
99 | 112 |
100 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ | 113 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_ |
OLD | NEW |