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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.h

Issue 949473002: Avoid unnecessary casts in NavigationControllerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_NAVIGATION_CONTROLLER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "content/browser/frame_host/navigation_controller_delegate.h" 14 #include "content/browser/frame_host/navigation_controller_delegate.h"
15 #include "content/browser/frame_host/navigation_entry_impl.h"
15 #include "content/browser/ssl/ssl_manager.h" 16 #include "content/browser/ssl/ssl_manager.h"
16 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
17 #include "content/public/browser/navigation_type.h" 18 #include "content/public/browser/navigation_type.h"
18 19
19 struct FrameHostMsg_DidCommitProvisionalLoad_Params; 20 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
20 21
21 namespace content { 22 namespace content {
22 class NavigationEntryImpl; 23 class RenderFrameHostImpl;
23 class RenderViewHost;
24 class NavigationEntryScreenshotManager; 24 class NavigationEntryScreenshotManager;
25 class SiteInstance; 25 class SiteInstance;
26 struct LoadCommittedDetails; 26 struct LoadCommittedDetails;
27 27
28 class CONTENT_EXPORT NavigationControllerImpl 28 class CONTENT_EXPORT NavigationControllerImpl
29 : public NON_EXPORTED_BASE(NavigationController) { 29 : public NON_EXPORTED_BASE(NavigationController) {
30 public: 30 public:
31 NavigationControllerImpl( 31 NavigationControllerImpl(
32 NavigationControllerDelegate* delegate, 32 NavigationControllerDelegate* delegate,
33 BrowserContext* browser_context); 33 BrowserContext* browser_context);
34 ~NavigationControllerImpl() override; 34 ~NavigationControllerImpl() override;
35 35
36 // NavigationController implementation: 36 // NavigationController implementation:
37 WebContents* GetWebContents() const override; 37 WebContents* GetWebContents() const override;
38 BrowserContext* GetBrowserContext() const override; 38 BrowserContext* GetBrowserContext() const override;
39 void SetBrowserContext(BrowserContext* browser_context) override; 39 void SetBrowserContext(BrowserContext* browser_context) override;
40 void Restore(int selected_navigation, 40 void Restore(int selected_navigation,
41 RestoreType type, 41 RestoreType type,
42 std::vector<NavigationEntry*>* entries) override; 42 std::vector<NavigationEntry*>* entries) override;
43 NavigationEntry* GetActiveEntry() const override; 43 NavigationEntryImpl* GetActiveEntry() const override;
44 NavigationEntry* GetVisibleEntry() const override; 44 NavigationEntryImpl* GetVisibleEntry() const override;
45 int GetCurrentEntryIndex() const override; 45 int GetCurrentEntryIndex() const override;
46 NavigationEntry* GetLastCommittedEntry() const override; 46 NavigationEntryImpl* GetLastCommittedEntry() const override;
47 int GetLastCommittedEntryIndex() const override; 47 int GetLastCommittedEntryIndex() const override;
48 bool CanViewSource() const override; 48 bool CanViewSource() const override;
49 int GetEntryCount() const override; 49 int GetEntryCount() const override;
50 NavigationEntry* GetEntryAtIndex(int index) const override; 50 NavigationEntryImpl* GetEntryAtIndex(int index) const override;
51 NavigationEntry* GetEntryAtOffset(int offset) const override; 51 NavigationEntryImpl* GetEntryAtOffset(int offset) const override;
52 void DiscardNonCommittedEntries() override; 52 void DiscardNonCommittedEntries() override;
53 NavigationEntry* GetPendingEntry() const override; 53 NavigationEntryImpl* GetPendingEntry() const override;
54 int GetPendingEntryIndex() const override; 54 int GetPendingEntryIndex() const override;
55 NavigationEntry* GetTransientEntry() const override; 55 NavigationEntryImpl* GetTransientEntry() const override;
56 void SetTransientEntry(NavigationEntry* entry) override; 56 void SetTransientEntry(NavigationEntry* entry) override;
57 void LoadURL(const GURL& url, 57 void LoadURL(const GURL& url,
58 const Referrer& referrer, 58 const Referrer& referrer,
59 ui::PageTransition type, 59 ui::PageTransition type,
60 const std::string& extra_headers) override; 60 const std::string& extra_headers) override;
61 void LoadURLWithParams(const LoadURLParams& params) override; 61 void LoadURLWithParams(const LoadURLParams& params) override;
62 void LoadIfNecessary() override; 62 void LoadIfNecessary() override;
63 bool CanGoBack() const override; 63 bool CanGoBack() const override;
64 bool CanGoForward() const override; 64 bool CanGoForward() const override;
65 bool CanGoToOffset(int offset) const override; 65 bool CanGoToOffset(int offset) const override;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // This is used by the WebContentsImpl. 127 // This is used by the WebContentsImpl.
128 // 128 //
129 // If a new entry is created, it will return true and will have filled the 129 // If a new entry is created, it will return true and will have filled the
130 // given details structure and broadcast the NOTIFY_NAV_ENTRY_COMMITTED 130 // given details structure and broadcast the NOTIFY_NAV_ENTRY_COMMITTED
131 // notification. The caller can then use the details without worrying about 131 // notification. The caller can then use the details without worrying about
132 // listening for the notification. 132 // listening for the notification.
133 // 133 //
134 // In the case that nothing has changed, the details structure is undefined 134 // In the case that nothing has changed, the details structure is undefined
135 // and it will return false. 135 // and it will return false.
136 bool RendererDidNavigate( 136 bool RendererDidNavigate(
137 RenderFrameHost* rfh, 137 RenderFrameHostImpl* rfh,
138 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 138 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
139 LoadCommittedDetails* details); 139 LoadCommittedDetails* details);
140 140
141 // Notifies us that we just became active. This is used by the WebContentsImpl 141 // Notifies us that we just became active. This is used by the WebContentsImpl
142 // so that we know to load URLs that were pending as "lazy" loads. 142 // so that we know to load URLs that were pending as "lazy" loads.
143 void SetActive(bool is_active); 143 void SetActive(bool is_active);
144 144
145 // Returns true if the given URL would be an in-page navigation (i.e. only 145 // Returns true if the given URL would be an in-page navigation (i.e. only
146 // the reference fragment is different) from the "last committed entry". We do 146 // the reference fragment is different) from the "last committed entry". We do
147 // not compare it against the "active entry" since the active entry can be 147 // not compare it against the "active entry" since the active entry can be
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 private: 222 private:
223 // |low_water_mark_| is the first time in a sequence of adjusted 223 // |low_water_mark_| is the first time in a sequence of adjusted
224 // times and |high_water_mark_| is the last. 224 // times and |high_water_mark_| is the last.
225 base::Time low_water_mark_; 225 base::Time low_water_mark_;
226 base::Time high_water_mark_; 226 base::Time high_water_mark_;
227 }; 227 };
228 228
229 // Classifies the given renderer navigation (see the NavigationType enum). 229 // Classifies the given renderer navigation (see the NavigationType enum).
230 NavigationType ClassifyNavigation( 230 NavigationType ClassifyNavigation(
231 RenderFrameHost* rfh, 231 RenderFrameHostImpl* rfh,
232 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const; 232 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const;
233 233
234 // Causes the controller to load the specified entry. The function assumes 234 // Causes the controller to load the specified entry. The function assumes
235 // ownership of the pointer since it is put in the navigation list. 235 // ownership of the pointer since it is put in the navigation list.
236 // NOTE: Do not pass an entry that the controller already owns! 236 // NOTE: Do not pass an entry that the controller already owns!
237 void LoadEntry(NavigationEntryImpl* entry); 237 void LoadEntry(NavigationEntryImpl* entry);
238 238
239 // Handlers for the different types of navigation types. They will actually 239 // Handlers for the different types of navigation types. They will actually
240 // handle the navigations corresponding to the different NavClasses above. 240 // handle the navigations corresponding to the different NavClasses above.
241 // They will NOT broadcast the commit notification, that should be handled by 241 // They will NOT broadcast the commit notification, that should be handled by
242 // the caller. 242 // the caller.
243 // 243 //
244 // RendererDidNavigateAutoSubframe is special, it may not actually change 244 // RendererDidNavigateAutoSubframe is special, it may not actually change
245 // anything if some random subframe is loaded. It will return true if anything 245 // anything if some random subframe is loaded. It will return true if anything
246 // changed, or false if not. 246 // changed, or false if not.
247 // 247 //
248 // The functions taking |did_replace_entry| will fill into the given variable 248 // The functions taking |did_replace_entry| will fill into the given variable
249 // whether the last entry has been replaced or not. 249 // whether the last entry has been replaced or not.
250 // See LoadCommittedDetails.did_replace_entry. 250 // See LoadCommittedDetails.did_replace_entry.
251 void RendererDidNavigateToNewPage( 251 void RendererDidNavigateToNewPage(
252 RenderFrameHost* rfh, 252 RenderFrameHostImpl* rfh,
253 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 253 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
254 bool replace_entry); 254 bool replace_entry);
255 void RendererDidNavigateToExistingPage( 255 void RendererDidNavigateToExistingPage(
256 RenderFrameHost* rfh, 256 RenderFrameHostImpl* rfh,
257 const FrameHostMsg_DidCommitProvisionalLoad_Params& params); 257 const FrameHostMsg_DidCommitProvisionalLoad_Params& params);
258 void RendererDidNavigateToSamePage( 258 void RendererDidNavigateToSamePage(
259 RenderFrameHost* rfh, 259 RenderFrameHostImpl* rfh,
260 const FrameHostMsg_DidCommitProvisionalLoad_Params& params); 260 const FrameHostMsg_DidCommitProvisionalLoad_Params& params);
261 void RendererDidNavigateInPage( 261 void RendererDidNavigateInPage(
262 RenderFrameHost* rfh, 262 RenderFrameHostImpl* rfh,
263 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 263 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
264 bool* did_replace_entry); 264 bool* did_replace_entry);
265 void RendererDidNavigateNewSubframe( 265 void RendererDidNavigateNewSubframe(
266 RenderFrameHost* rfh, 266 RenderFrameHostImpl* rfh,
267 const FrameHostMsg_DidCommitProvisionalLoad_Params& params); 267 const FrameHostMsg_DidCommitProvisionalLoad_Params& params);
268 bool RendererDidNavigateAutoSubframe( 268 bool RendererDidNavigateAutoSubframe(
269 RenderFrameHost* rfh, 269 RenderFrameHostImpl* rfh,
270 const FrameHostMsg_DidCommitProvisionalLoad_Params& params); 270 const FrameHostMsg_DidCommitProvisionalLoad_Params& params);
271 271
272 // Helper function for code shared between Reload() and ReloadIgnoringCache(). 272 // Helper function for code shared between Reload() and ReloadIgnoringCache().
273 void ReloadInternal(bool check_for_repost, ReloadType reload_type); 273 void ReloadInternal(bool check_for_repost, ReloadType reload_type);
274 274
275 // Actually issues the navigation held in pending_entry. 275 // Actually issues the navigation held in pending_entry.
276 void NavigateToPendingEntry(ReloadType reload_type); 276 void NavigateToPendingEntry(ReloadType reload_type);
277 277
278 // Allows the derived class to issue notifications that a load has been 278 // Allows the derived class to issue notifications that a load has been
279 // committed. This will fill in the active entry to the details structure. 279 // committed. This will fill in the active entry to the details structure.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 TimeSmoother time_smoother_; 408 TimeSmoother time_smoother_;
409 409
410 scoped_ptr<NavigationEntryScreenshotManager> screenshot_manager_; 410 scoped_ptr<NavigationEntryScreenshotManager> screenshot_manager_;
411 411
412 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl); 412 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl);
413 }; 413 };
414 414
415 } // namespace content 415 } // namespace content
416 416
417 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_ 417 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698