| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ | 6 #define CHROME_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 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/linked_ptr.h" | 14 #include "base/linked_ptr.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "chrome/browser/sessions/session_id.h" | 17 #include "chrome/browser/sessions/session_id.h" |
| 18 #include "chrome/browser/ssl/ssl_manager.h" | 18 #include "chrome/browser/ssl/ssl_manager.h" |
| 19 #include "chrome/common/navigation_types.h" | 19 #include "chrome/common/navigation_types.h" |
| 20 #include "chrome/common/page_transition_types.h" | 20 #include "chrome/common/page_transition_types.h" |
| 21 | 21 |
| 22 class NavigationEntry; | 22 class NavigationEntry; |
| 23 class Profile; | 23 class Profile; |
| 24 class SessionStorageNamespace; |
| 24 class SiteInstance; | 25 class SiteInstance; |
| 25 class TabContents; | 26 class TabContents; |
| 26 class TabNavigation; | 27 class TabNavigation; |
| 27 struct ViewHostMsg_FrameNavigate_Params; | 28 struct ViewHostMsg_FrameNavigate_Params; |
| 28 | 29 |
| 29 // A NavigationController maintains the back-forward list for a single tab and | 30 // A NavigationController maintains the back-forward list for a single tab and |
| 30 // manages all navigation within that list. | 31 // manages all navigation within that list. |
| 31 // | 32 // |
| 32 // The NavigationController also owns all TabContents for the tab. This is to | 33 // The NavigationController also owns all TabContents for the tab. This is to |
| 33 // make sure that we have at most one TabContents instance per type. | 34 // make sure that we have at most one TabContents instance per type. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 enum ReloadType { | 133 enum ReloadType { |
| 133 NO_RELOAD, // Normal load. | 134 NO_RELOAD, // Normal load. |
| 134 RELOAD, // Normal (cache-validating) reload. | 135 RELOAD, // Normal (cache-validating) reload. |
| 135 RELOAD_IGNORING_CACHE // Reload bypassing the cache, aka shift-reload. | 136 RELOAD_IGNORING_CACHE // Reload bypassing the cache, aka shift-reload. |
| 136 }; | 137 }; |
| 137 | 138 |
| 138 // --------------------------------------------------------------------------- | 139 // --------------------------------------------------------------------------- |
| 139 | 140 |
| 140 NavigationController(TabContents* tab_contents, Profile* profile); | 141 // The session storage namespace parameter allows multiple render views and |
| 142 // tab contentses to share the same session storage (part of the WebStorage |
| 143 // spec) space. Passing in NULL simply allocates a new one which is often the |
| 144 // correct thing to do (especially in tests. |
| 145 NavigationController(TabContents* tab_contents, |
| 146 Profile* profile, |
| 147 SessionStorageNamespace* session_storage_namespace); |
| 141 ~NavigationController(); | 148 ~NavigationController(); |
| 142 | 149 |
| 143 // Returns the profile for this controller. It can never be NULL. | 150 // Returns the profile for this controller. It can never be NULL. |
| 144 Profile* profile() const { | 151 Profile* profile() const { |
| 145 return profile_; | 152 return profile_; |
| 146 } | 153 } |
| 147 | 154 |
| 148 // Sets the profile for this controller. | 155 // Sets the profile for this controller. |
| 149 void set_profile(Profile* profile) { | 156 void set_profile(Profile* profile) { |
| 150 profile_ = profile; | 157 profile_ = profile; |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 SSLManager* ssl_manager() { return &ssl_manager_; } | 390 SSLManager* ssl_manager() { return &ssl_manager_; } |
| 384 | 391 |
| 385 // Returns true if a reload happens when activated (SetActive(true) is | 392 // Returns true if a reload happens when activated (SetActive(true) is |
| 386 // invoked). This is true for session/tab restore and cloned tabs. | 393 // invoked). This is true for session/tab restore and cloned tabs. |
| 387 bool needs_reload() const { return needs_reload_; } | 394 bool needs_reload() const { return needs_reload_; } |
| 388 | 395 |
| 389 // Returns the largest restored page ID seen in this navigation controller, | 396 // Returns the largest restored page ID seen in this navigation controller, |
| 390 // if it was restored from a previous session. (-1 otherwise) | 397 // if it was restored from a previous session. (-1 otherwise) |
| 391 int32 max_restored_page_id() const { return max_restored_page_id_; } | 398 int32 max_restored_page_id() const { return max_restored_page_id_; } |
| 392 | 399 |
| 393 // The session storage namespace id that all child render views should use. | 400 // The session storage namespace that all child render views should use. |
| 394 int64 session_storage_namespace_id() const { | 401 SessionStorageNamespace* session_storage_namespace() const { |
| 395 return session_storage_namespace_id_; | 402 return session_storage_namespace_; |
| 396 } | 403 } |
| 397 | 404 |
| 398 // Disables checking for a repost and prompting the user. This is used during | 405 // Disables checking for a repost and prompting the user. This is used during |
| 399 // testing. | 406 // testing. |
| 400 static void DisablePromptOnRepost(); | 407 static void DisablePromptOnRepost(); |
| 401 | 408 |
| 402 // Maximum number of entries before we start removing entries from the front. | 409 // Maximum number of entries before we start removing entries from the front. |
| 403 #ifdef UNIT_TEST | 410 #ifdef UNIT_TEST |
| 404 static void set_max_entry_count(size_t max_entry_count) { | 411 static void set_max_entry_count(size_t max_entry_count) { |
| 405 max_entry_count_ = max_entry_count; | 412 max_entry_count_ = max_entry_count; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 // across sessions. | 583 // across sessions. |
| 577 SessionID session_id_; | 584 SessionID session_id_; |
| 578 | 585 |
| 579 // Unique identifier of the window we're in. Used by session restore. | 586 // Unique identifier of the window we're in. Used by session restore. |
| 580 SessionID window_id_; | 587 SessionID window_id_; |
| 581 | 588 |
| 582 // The time ticks at which the last document was loaded. | 589 // The time ticks at which the last document was loaded. |
| 583 base::TimeTicks last_document_loaded_; | 590 base::TimeTicks last_document_loaded_; |
| 584 | 591 |
| 585 // The session storage id that any (indirectly) owned RenderView should use. | 592 // The session storage id that any (indirectly) owned RenderView should use. |
| 586 int64 session_storage_namespace_id_; | 593 scoped_refptr<SessionStorageNamespace> session_storage_namespace_; |
| 587 | 594 |
| 588 // Should Reload check for post data? The default is true, but is set to false | 595 // Should Reload check for post data? The default is true, but is set to false |
| 589 // when testing. | 596 // when testing. |
| 590 static bool check_for_repost_; | 597 static bool check_for_repost_; |
| 591 | 598 |
| 592 // The maximum number of entries that a navigation controller can store. | 599 // The maximum number of entries that a navigation controller can store. |
| 593 static size_t max_entry_count_; | 600 static size_t max_entry_count_; |
| 594 | 601 |
| 595 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE), | 602 // If a repost is pending, its type (RELOAD or RELOAD_IGNORING_CACHE), |
| 596 // NO_RELOAD otherwise. | 603 // NO_RELOAD otherwise. |
| 597 ReloadType pending_reload_; | 604 ReloadType pending_reload_; |
| 598 | 605 |
| 599 DISALLOW_COPY_AND_ASSIGN(NavigationController); | 606 DISALLOW_COPY_AND_ASSIGN(NavigationController); |
| 600 }; | 607 }; |
| 601 | 608 |
| 602 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ | 609 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ |
| OLD | NEW |