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