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" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // Provides the details for a NOTIFY_NAV_ENTRY_COMMITTED notification. | 50 // Provides the details for a NOTIFY_NAV_ENTRY_COMMITTED notification. |
51 // TODO(brettw) this mostly duplicates ProvisionalLoadDetails, it would be | 51 // TODO(brettw) this mostly duplicates ProvisionalLoadDetails, it would be |
52 // nice to unify these somehow. | 52 // nice to unify these somehow. |
53 struct LoadCommittedDetails { | 53 struct LoadCommittedDetails { |
54 // By default, the entry will be filled according to a new main frame | 54 // By default, the entry will be filled according to a new main frame |
55 // navigation. | 55 // navigation. |
56 LoadCommittedDetails() | 56 LoadCommittedDetails() |
57 : entry(NULL), | 57 : entry(NULL), |
58 is_auto(false), | 58 is_auto(false), |
| 59 did_replace_entry(false), |
59 is_in_page(false), | 60 is_in_page(false), |
60 is_main_frame(true) { | 61 is_main_frame(true) { |
61 } | 62 } |
62 | 63 |
63 // The committed entry. This will be the active entry in the controller. | 64 // The committed entry. This will be the active entry in the controller. |
64 NavigationEntry* entry; | 65 NavigationEntry* entry; |
65 | 66 |
66 // The type of navigation that just occurred. Note that not all types of | 67 // The type of navigation that just occurred. Note that not all types of |
67 // navigations in the enum are valid here, since some of them don't actually | 68 // navigations in the enum are valid here, since some of them don't actually |
68 // cause a "commit" and won't generate this notification. | 69 // cause a "commit" and won't generate this notification. |
69 NavigationType::Type type; | 70 NavigationType::Type type; |
70 | 71 |
71 // The index of the previously committed navigation entry. This will be -1 | 72 // The index of the previously committed navigation entry. This will be -1 |
72 // if there are no previous entries. | 73 // if there are no previous entries. |
73 int previous_entry_index; | 74 int previous_entry_index; |
74 | 75 |
75 // The previous URL that the user was on. This may be empty if none. | 76 // The previous URL that the user was on. This may be empty if none. |
76 GURL previous_url; | 77 GURL previous_url; |
77 | 78 |
78 // True when this load was non-user initated. This corresponds to a | 79 // True when this load was non-user initated. This corresponds to a |
79 // a NavigationGestureAuto call from WebKit (see webview_delegate.h). | 80 // a NavigationGestureAuto call from WebKit (see webview_delegate.h). |
80 // We also count reloads and meta-refreshes as "auto" to account for the | 81 // We also count reloads and meta-refreshes as "auto" to account for the |
81 // fact that WebKit doesn't always set the user gesture properly in these | 82 // fact that WebKit doesn't always set the user gesture properly in these |
82 // cases (see bug 1051891). | 83 // cases (see bug 1051891). |
83 bool is_auto; | 84 bool is_auto; |
84 | 85 |
| 86 // True if the committed entry has replaced the exisiting one. |
| 87 // A non-user initiated redierct causes such replacement. |
| 88 // This is somewhat similiar to is_auto, but not exactly the same. |
| 89 bool did_replace_entry; |
| 90 |
85 // True if the navigation was in-page. This means that the active entry's | 91 // True if the navigation was in-page. This means that the active entry's |
86 // URL and the |previous_url| are the same except for reference fragments. | 92 // URL and the |previous_url| are the same except for reference fragments. |
87 bool is_in_page; | 93 bool is_in_page; |
88 | 94 |
89 // True when the main frame was navigated. False means the navigation was a | 95 // True when the main frame was navigated. False means the navigation was a |
90 // sub-frame. | 96 // sub-frame. |
91 bool is_main_frame; | 97 bool is_main_frame; |
92 | 98 |
93 // Whether the content of this frame has been altered/blocked because it was | 99 // Whether the content of this frame has been altered/blocked because it was |
94 // unsafe. | 100 // unsafe. |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 void LoadEntry(NavigationEntry* entry); | 396 void LoadEntry(NavigationEntry* entry); |
391 | 397 |
392 // Handlers for the different types of navigation types. They will actually | 398 // Handlers for the different types of navigation types. They will actually |
393 // handle the navigations corresponding to the different NavClasses above. | 399 // handle the navigations corresponding to the different NavClasses above. |
394 // They will NOT broadcast the commit notification, that should be handled by | 400 // They will NOT broadcast the commit notification, that should be handled by |
395 // the caller. | 401 // the caller. |
396 // | 402 // |
397 // RendererDidNavigateAutoSubframe is special, it may not actually change | 403 // RendererDidNavigateAutoSubframe is special, it may not actually change |
398 // anything if some random subframe is loaded. It will return true if anything | 404 // anything if some random subframe is loaded. It will return true if anything |
399 // changed, or false if not. | 405 // changed, or false if not. |
| 406 // |
| 407 // The functions taking |did_replace_entry| will fill into the given variable |
| 408 // whether the last entry has been replaced or not. |
| 409 // See LoadCommittedDetails.did_replace_entry. |
400 void RendererDidNavigateToNewPage( | 410 void RendererDidNavigateToNewPage( |
401 const ViewHostMsg_FrameNavigate_Params& params); | 411 const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry); |
402 void RendererDidNavigateToExistingPage( | 412 void RendererDidNavigateToExistingPage( |
403 const ViewHostMsg_FrameNavigate_Params& params); | 413 const ViewHostMsg_FrameNavigate_Params& params); |
404 void RendererDidNavigateToSamePage( | 414 void RendererDidNavigateToSamePage( |
405 const ViewHostMsg_FrameNavigate_Params& params); | 415 const ViewHostMsg_FrameNavigate_Params& params); |
406 void RendererDidNavigateInPage( | 416 void RendererDidNavigateInPage( |
407 const ViewHostMsg_FrameNavigate_Params& params); | 417 const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry); |
408 void RendererDidNavigateNewSubframe( | 418 void RendererDidNavigateNewSubframe( |
409 const ViewHostMsg_FrameNavigate_Params& params); | 419 const ViewHostMsg_FrameNavigate_Params& params); |
410 bool RendererDidNavigateAutoSubframe( | 420 bool RendererDidNavigateAutoSubframe( |
411 const ViewHostMsg_FrameNavigate_Params& params); | 421 const ViewHostMsg_FrameNavigate_Params& params); |
412 | 422 |
413 // Actually issues the navigation held in pending_entry. | 423 // Actually issues the navigation held in pending_entry. |
414 void NavigateToPendingEntry(bool reload); | 424 void NavigateToPendingEntry(bool reload); |
415 | 425 |
416 // Allows the derived class to issue notifications that a load has been | 426 // Allows the derived class to issue notifications that a load has been |
417 // committed. This will fill in the active entry to the details structure. | 427 // committed. This will fill in the active entry to the details structure. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 // when testing. | 525 // when testing. |
516 static bool check_for_repost_; | 526 static bool check_for_repost_; |
517 | 527 |
518 // The maximum number of entries that a navigation controller can store. | 528 // The maximum number of entries that a navigation controller can store. |
519 static size_t max_entry_count_; | 529 static size_t max_entry_count_; |
520 | 530 |
521 DISALLOW_COPY_AND_ASSIGN(NavigationController); | 531 DISALLOW_COPY_AND_ASSIGN(NavigationController); |
522 }; | 532 }; |
523 | 533 |
524 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ | 534 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ |
OLD | NEW |