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

Side by Side Diff: content/browser/tab_contents/navigation_controller.h

Issue 8983010: Convert WebContents to return a content::NavigationController instead of the implementation. Upda... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_
6 #define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ 6 #define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 17 matching lines...) Expand all
28 : public NON_EXPORTED_BASE(content::NavigationController) { 28 : public NON_EXPORTED_BASE(content::NavigationController) {
29 public: 29 public:
30 NavigationController(TabContents* tab_contents, 30 NavigationController(TabContents* tab_contents,
31 content::BrowserContext* browser_context, 31 content::BrowserContext* browser_context,
32 SessionStorageNamespace* session_storage_namespace); 32 SessionStorageNamespace* session_storage_namespace);
33 virtual ~NavigationController(); 33 virtual ~NavigationController();
34 34
35 // NavigationController implementation: 35 // NavigationController implementation:
36 virtual content::WebContents* GetWebContents() const OVERRIDE; 36 virtual content::WebContents* GetWebContents() const OVERRIDE;
37 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; 37 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE;
38 virtual void SetBrowserContext(
39 content::BrowserContext* browser_context) OVERRIDE;
38 virtual void Restore( 40 virtual void Restore(
39 int selected_navigation, 41 int selected_navigation,
40 bool from_last_session, 42 bool from_last_session,
41 std::vector<content::NavigationEntry*>* entries) OVERRIDE; 43 std::vector<content::NavigationEntry*>* entries) OVERRIDE;
42 virtual content::NavigationEntry* GetActiveEntry() const OVERRIDE; 44 virtual content::NavigationEntry* GetActiveEntry() const OVERRIDE;
43 virtual content::NavigationEntry* GetVisibleEntry() const OVERRIDE; 45 virtual content::NavigationEntry* GetVisibleEntry() const OVERRIDE;
44 virtual int GetCurrentEntryIndex() const OVERRIDE; 46 virtual int GetCurrentEntryIndex() const OVERRIDE;
45 virtual content::NavigationEntry* GetLastCommittedEntry() const OVERRIDE; 47 virtual content::NavigationEntry* GetLastCommittedEntry() const OVERRIDE;
46 virtual int GetLastCommittedEntryIndex() const OVERRIDE; 48 virtual int GetLastCommittedEntryIndex() const OVERRIDE;
47 virtual bool CanViewSource() const OVERRIDE; 49 virtual bool CanViewSource() const OVERRIDE;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE; 82 virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE;
81 virtual int32 GetMaxRestoredPageID() const OVERRIDE; 83 virtual int32 GetMaxRestoredPageID() const OVERRIDE;
82 virtual bool NeedsReload() const OVERRIDE; 84 virtual bool NeedsReload() const OVERRIDE;
83 virtual void CancelPendingReload() OVERRIDE; 85 virtual void CancelPendingReload() OVERRIDE;
84 virtual void ContinuePendingReload() OVERRIDE; 86 virtual void ContinuePendingReload() OVERRIDE;
85 virtual bool IsInitialNavigation() OVERRIDE; 87 virtual bool IsInitialNavigation() OVERRIDE;
86 virtual void Reload(bool check_for_repost) OVERRIDE; 88 virtual void Reload(bool check_for_repost) OVERRIDE;
87 virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE; 89 virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE;
88 virtual void NotifyEntryChanged(const content::NavigationEntry* entry, 90 virtual void NotifyEntryChanged(const content::NavigationEntry* entry,
89 int index) OVERRIDE; 91 int index) OVERRIDE;
92 virtual void CopyStateFrom(
93 const content::NavigationController& source) OVERRIDE;
90 virtual void CopyStateFromAndPrune( 94 virtual void CopyStateFromAndPrune(
91 content::NavigationController* source) OVERRIDE; 95 content::NavigationController* source) OVERRIDE;
92 virtual void PruneAllButActive() OVERRIDE; 96 virtual void PruneAllButActive() OVERRIDE;
93 97
94 // Sets the browser context for this controller.
95 void set_browser_context(content::BrowserContext* browser_context) {
96 browser_context_ = browser_context;
97 }
98
99 // Returns the index of the specified entry, or -1 if entry is not contained 98 // Returns the index of the specified entry, or -1 if entry is not contained
100 // in this NavigationController. 99 // in this NavigationController.
101 int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const; 100 int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const;
102 101
103 // Return the index of the entry with the corresponding instance and page_id, 102 // Return the index of the entry with the corresponding instance and page_id,
104 // or -1 if not found. 103 // or -1 if not found.
105 int GetEntryIndexWithPageID(SiteInstance* instance, 104 int GetEntryIndexWithPageID(SiteInstance* instance,
106 int32 page_id) const; 105 int32 page_id) const;
107 106
108 // Return the entry with the corresponding instance and page_id, or NULL if 107 // Return the entry with the corresponding instance and page_id, or NULL if
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // is no last committed entry, then nothing will be in-page. 157 // is no last committed entry, then nothing will be in-page.
159 // 158 //
160 // Special note: if the URLs are the same, it does NOT count as an in-page 159 // Special note: if the URLs are the same, it does NOT count as an in-page
161 // navigation. Neither does an input URL that has no ref, even if the rest is 160 // navigation. Neither does an input URL that has no ref, even if the rest is
162 // the same. This may seem weird, but when we're considering whether a 161 // the same. This may seem weird, but when we're considering whether a
163 // navigation happened without loading anything, the same URL would be a 162 // navigation happened without loading anything, the same URL would be a
164 // reload, while only a different ref would be in-page (pages can't clear 163 // reload, while only a different ref would be in-page (pages can't clear
165 // refs without reload, only change to "#" which we don't count as empty). 164 // refs without reload, only change to "#" which we don't count as empty).
166 bool IsURLInPageNavigation(const GURL& url) const; 165 bool IsURLInPageNavigation(const GURL& url) const;
167 166
168 // Copies the navigation state from the given controller to this one. This
169 // one should be empty (just created).
170 void CopyStateFrom(const NavigationController& source);
171
172 // Random data --------------------------------------------------------------- 167 // Random data ---------------------------------------------------------------
173 168
174 // Disables checking for a repost and prompting the user. This is used during
175 // testing.
176 static void DisablePromptOnRepost();
177
178 // Maximum number of entries before we start removing entries from the front. 169 // Maximum number of entries before we start removing entries from the front.
179 static void set_max_entry_count_for_testing(size_t max_entry_count) { 170 static void set_max_entry_count_for_testing(size_t max_entry_count) {
180 max_entry_count_for_testing_ = max_entry_count; 171 max_entry_count_for_testing_ = max_entry_count;
181 } 172 }
182 static size_t max_entry_count(); 173 static size_t max_entry_count();
183 174
184 private: 175 private:
185 class RestoreHelper; 176 class RestoreHelper;
186 friend class RestoreHelper; 177 friend class RestoreHelper;
187 friend class TabContents; // For invoking OnReservedPageIDRange. 178 friend class TabContents; // For invoking OnReservedPageIDRange.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 304
314 // Whether we need to be reloaded when made active. 305 // Whether we need to be reloaded when made active.
315 bool needs_reload_; 306 bool needs_reload_;
316 307
317 // The time ticks at which the last document was loaded. 308 // The time ticks at which the last document was loaded.
318 base::TimeTicks last_document_loaded_; 309 base::TimeTicks last_document_loaded_;
319 310
320 // The session storage id that any (indirectly) owned RenderView should use. 311 // The session storage id that any (indirectly) owned RenderView should use.
321 scoped_refptr<SessionStorageNamespace> session_storage_namespace_; 312 scoped_refptr<SessionStorageNamespace> session_storage_namespace_;
322 313
323 // Should Reload check for post data? The default is true, but is set to false
324 // when testing.
325 static bool check_for_repost_;
326
327 // The maximum number of entries that a navigation controller can store. 314 // The maximum number of entries that a navigation controller can store.
328 static size_t max_entry_count_for_testing_; 315 static size_t max_entry_count_for_testing_;
329 316
330 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE), 317 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE),
331 // NO_RELOAD otherwise. 318 // NO_RELOAD otherwise.
332 ReloadType pending_reload_; 319 ReloadType pending_reload_;
333 320
334 DISALLOW_COPY_AND_ASSIGN(NavigationController); 321 DISALLOW_COPY_AND_ASSIGN(NavigationController);
335 }; 322 };
336 323
337 #endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ 324 #endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698