| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 | 11 |
| 12 #include "base/linked_ptr.h" | 12 #include "base/linked_ptr.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "base/time.h" |
| 14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 15 #include "chrome/browser/sessions/session_id.h" | 16 #include "chrome/browser/sessions/session_id.h" |
| 16 #include "chrome/browser/ssl/ssl_manager.h" | 17 #include "chrome/browser/ssl/ssl_manager.h" |
| 17 #include "chrome/common/navigation_types.h" | 18 #include "chrome/common/navigation_types.h" |
| 18 #include "chrome/common/page_transition_types.h" | 19 #include "chrome/common/page_transition_types.h" |
| 19 | 20 |
| 20 class NavigationEntry; | 21 class NavigationEntry; |
| 21 class GURL; | 22 class GURL; |
| 22 class Profile; | 23 class Profile; |
| 23 class TabContents; | 24 class TabContents; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // TabContents --------------------------------------------------------------- | 282 // TabContents --------------------------------------------------------------- |
| 282 | 283 |
| 283 // Returns the tab contents associated with this controller. Non-NULL except | 284 // Returns the tab contents associated with this controller. Non-NULL except |
| 284 // during set-up of the tab. | 285 // during set-up of the tab. |
| 285 TabContents* tab_contents() const { | 286 TabContents* tab_contents() const { |
| 286 // This currently returns the active tab contents which should be renamed to | 287 // This currently returns the active tab contents which should be renamed to |
| 287 // tab_contents. | 288 // tab_contents. |
| 288 return tab_contents_; | 289 return tab_contents_; |
| 289 } | 290 } |
| 290 | 291 |
| 292 // Called when a document has been loaded in a frame. |
| 293 void DocumentLoadedInFrame(); |
| 294 |
| 295 // Called when the user presses the mouse, enter key or space bar. |
| 296 void OnUserGesture(); |
| 297 |
| 291 // For use by TabContents ---------------------------------------------------- | 298 // For use by TabContents ---------------------------------------------------- |
| 292 | 299 |
| 293 // Handles updating the navigation state after the renderer has navigated. | 300 // Handles updating the navigation state after the renderer has navigated. |
| 294 // This is used by the TabContents. Simpler tab contents types can use | 301 // This is used by the TabContents. Simpler tab contents types can use |
| 295 // CommitPendingEntry below. | 302 // CommitPendingEntry below. |
| 296 // | 303 // |
| 297 // If a new entry is created, it will return true and will have filled the | 304 // If a new entry is created, it will return true and will have filled the |
| 298 // given details structure and broadcast the NOTIFY_NAV_ENTRY_COMMITTED | 305 // given details structure and broadcast the NOTIFY_NAV_ENTRY_COMMITTED |
| 299 // notification. The caller can then use the details without worrying about | 306 // notification. The caller can then use the details without worrying about |
| 300 // listening for the notification. | 307 // listening for the notification. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 // Inserts a new entry or replaces the current entry with a new one, removing | 432 // Inserts a new entry or replaces the current entry with a new one, removing |
| 426 // all entries after it. The new entry will become the active one. | 433 // all entries after it. The new entry will become the active one. |
| 427 void InsertOrReplaceEntry(NavigationEntry* entry, bool replace); | 434 void InsertOrReplaceEntry(NavigationEntry* entry, bool replace); |
| 428 | 435 |
| 429 // Discards the pending and transient entries. | 436 // Discards the pending and transient entries. |
| 430 void DiscardNonCommittedEntriesInternal(); | 437 void DiscardNonCommittedEntriesInternal(); |
| 431 | 438 |
| 432 // Discards the transient entry. | 439 // Discards the transient entry. |
| 433 void DiscardTransientEntry(); | 440 void DiscardTransientEntry(); |
| 434 | 441 |
| 442 // Returns true if the navigation is redirect. |
| 443 bool IsRedirect(const ViewHostMsg_FrameNavigate_Params& params); |
| 444 |
| 445 // Returns true if the navigation is likley to be automatic rather than |
| 446 // user-initiated. |
| 447 bool IsLikelyAutoNavigation(base::TimeTicks now); |
| 448 |
| 435 // --------------------------------------------------------------------------- | 449 // --------------------------------------------------------------------------- |
| 436 | 450 |
| 437 // The user profile associated with this controller | 451 // The user profile associated with this controller |
| 438 Profile* profile_; | 452 Profile* profile_; |
| 439 | 453 |
| 440 // List of NavigationEntry for this tab | 454 // List of NavigationEntry for this tab |
| 441 typedef std::vector<linked_ptr<NavigationEntry> > NavigationEntries; | 455 typedef std::vector<linked_ptr<NavigationEntry> > NavigationEntries; |
| 442 NavigationEntries entries_; | 456 NavigationEntries entries_; |
| 443 | 457 |
| 444 // An entry we haven't gotten a response for yet. This will be discarded | 458 // An entry we haven't gotten a response for yet. This will be discarded |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 bool load_pending_entry_when_active_; | 498 bool load_pending_entry_when_active_; |
| 485 | 499 |
| 486 // Unique identifier of this controller for session restore. This id is only | 500 // Unique identifier of this controller for session restore. This id is only |
| 487 // unique within the current session, and is not guaranteed to be unique | 501 // unique within the current session, and is not guaranteed to be unique |
| 488 // across sessions. | 502 // across sessions. |
| 489 const SessionID session_id_; | 503 const SessionID session_id_; |
| 490 | 504 |
| 491 // Unique identifier of the window we're in. Used by session restore. | 505 // Unique identifier of the window we're in. Used by session restore. |
| 492 SessionID window_id_; | 506 SessionID window_id_; |
| 493 | 507 |
| 508 // The time ticks at which the last document was loaded. |
| 509 base::TimeTicks last_document_loaded_; |
| 510 |
| 511 // Whether a user gesture has been observed since the last navigation. |
| 512 bool user_gesture_observed_; |
| 513 |
| 494 // Should Reload check for post data? The default is true, but is set to false | 514 // Should Reload check for post data? The default is true, but is set to false |
| 495 // when testing. | 515 // when testing. |
| 496 static bool check_for_repost_; | 516 static bool check_for_repost_; |
| 497 | 517 |
| 498 // The maximum number of entries that a navigation controller can store. | 518 // The maximum number of entries that a navigation controller can store. |
| 499 static size_t max_entry_count_; | 519 static size_t max_entry_count_; |
| 500 | 520 |
| 501 DISALLOW_COPY_AND_ASSIGN(NavigationController); | 521 DISALLOW_COPY_AND_ASSIGN(NavigationController); |
| 502 }; | 522 }; |
| 503 | 523 |
| 504 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ | 524 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ |
| OLD | NEW |