OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Takes a screenshot of the page at the current state. | 192 // Takes a screenshot of the page at the current state. |
193 void TakeScreenshot(); | 193 void TakeScreenshot(); |
194 | 194 |
195 // Sets the screenshot manager for this NavigationControllerImpl. The | 195 // Sets the screenshot manager for this NavigationControllerImpl. The |
196 // controller takes ownership of the screenshot manager and destroys it when | 196 // controller takes ownership of the screenshot manager and destroys it when |
197 // a new screenshot-manager is set, or when the controller is destroyed. | 197 // a new screenshot-manager is set, or when the controller is destroyed. |
198 // Setting a NULL manager recreates the default screenshot manager and uses | 198 // Setting a NULL manager recreates the default screenshot manager and uses |
199 // that. | 199 // that. |
200 void SetScreenshotManager(NavigationEntryScreenshotManager* manager); | 200 void SetScreenshotManager(NavigationEntryScreenshotManager* manager); |
201 | 201 |
202 // Discards only the pending entry. | 202 // Discards only the pending entry. |was_failure| should be set if the pending |
203 void DiscardPendingEntry(); | 203 // entry is being discarded because it failed to load. |
| 204 void DiscardPendingEntry(bool was_failure); |
204 | 205 |
205 private: | 206 private: |
206 friend class RestoreHelper; | 207 friend class RestoreHelper; |
207 | 208 |
208 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, | 209 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, |
209 PurgeScreenshot); | 210 PurgeScreenshot); |
210 FRIEND_TEST_ALL_PREFIXES(TimeSmoother, Basic); | 211 FRIEND_TEST_ALL_PREFIXES(TimeSmoother, Basic); |
211 FRIEND_TEST_ALL_PREFIXES(TimeSmoother, SingleDuplicate); | 212 FRIEND_TEST_ALL_PREFIXES(TimeSmoother, SingleDuplicate); |
212 FRIEND_TEST_ALL_PREFIXES(TimeSmoother, ManyDuplicates); | 213 FRIEND_TEST_ALL_PREFIXES(TimeSmoother, ManyDuplicates); |
213 FRIEND_TEST_ALL_PREFIXES(TimeSmoother, ClockBackwardsJump); | 214 FRIEND_TEST_ALL_PREFIXES(TimeSmoother, ClockBackwardsJump); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 339 |
339 // An entry we haven't gotten a response for yet. This will be discarded | 340 // An entry we haven't gotten a response for yet. This will be discarded |
340 // when we navigate again. It's used only so we know what the currently | 341 // when we navigate again. It's used only so we know what the currently |
341 // displayed tab is. | 342 // displayed tab is. |
342 // | 343 // |
343 // This may refer to an item in the entries_ list if the pending_entry_index_ | 344 // This may refer to an item in the entries_ list if the pending_entry_index_ |
344 // == -1, or it may be its own entry that should be deleted. Be careful with | 345 // == -1, or it may be its own entry that should be deleted. Be careful with |
345 // the memory management. | 346 // the memory management. |
346 NavigationEntryImpl* pending_entry_; | 347 NavigationEntryImpl* pending_entry_; |
347 | 348 |
348 // currently visible entry | 349 // If a new entry fails loading, details about it are temporarily held here |
| 350 // until the error page is shown. These variables are only valid if |
| 351 // |failed_pending_entry_id_| is not 0. |
| 352 // |
| 353 // TODO(avi): We need a better way to handle the connection between failed |
| 354 // loads and the subsequent load of the error page. This current approach has |
| 355 // issues: 1. This might hang around longer than we'd like if there is no |
| 356 // error page loaded, and 2. This doesn't work very well for frames. |
| 357 // http://crbug.com/474261 |
| 358 int failed_pending_entry_id_; |
| 359 bool failed_pending_entry_should_replace_; |
| 360 |
| 361 // The index of the currently visible entry. |
349 int last_committed_entry_index_; | 362 int last_committed_entry_index_; |
350 | 363 |
351 // index of pending entry if it is in entries_, or -1 if pending_entry_ is a | 364 // The index of the pending entry if it is in entries_, or -1 if |
352 // new entry (created by LoadURL). | 365 // pending_entry_ is a new entry (created by LoadURL). |
353 int pending_entry_index_; | 366 int pending_entry_index_; |
354 | 367 |
355 // The index for the entry that is shown until a navigation occurs. This is | 368 // The index for the entry that is shown until a navigation occurs. This is |
356 // used for interstitial pages. -1 if there are no such entry. | 369 // used for interstitial pages. -1 if there are no such entry. |
357 // Note that this entry really appears in the list of entries, but only | 370 // Note that this entry really appears in the list of entries, but only |
358 // temporarily (until the next navigation). Any index pointing to an entry | 371 // temporarily (until the next navigation). Any index pointing to an entry |
359 // after the transient entry will become invalid if you navigate forward. | 372 // after the transient entry will become invalid if you navigate forward. |
360 int transient_entry_index_; | 373 int transient_entry_index_; |
361 | 374 |
362 // The delegate associated with the controller. Possibly NULL during | 375 // The delegate associated with the controller. Possibly NULL during |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 TimeSmoother time_smoother_; | 421 TimeSmoother time_smoother_; |
409 | 422 |
410 scoped_ptr<NavigationEntryScreenshotManager> screenshot_manager_; | 423 scoped_ptr<NavigationEntryScreenshotManager> screenshot_manager_; |
411 | 424 |
412 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl); | 425 DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl); |
413 }; | 426 }; |
414 | 427 |
415 } // namespace content | 428 } // namespace content |
416 | 429 |
417 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_ | 430 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_IMPL_H_ |
OLD | NEW |