OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 virtual void CopyStateFrom(const NavigationController& source) = 0; | 399 virtual void CopyStateFrom(const NavigationController& source) = 0; |
400 | 400 |
401 // A variant of CopyStateFrom. Removes all entries from this except the last | 401 // A variant of CopyStateFrom. Removes all entries from this except the last |
402 // committed entry, and inserts all entries from |source| before and including | 402 // committed entry, and inserts all entries from |source| before and including |
403 // its last committed entry. For example: | 403 // its last committed entry. For example: |
404 // source: A B *C* D | 404 // source: A B *C* D |
405 // this: E F *G* | 405 // this: E F *G* |
406 // result: A B C *G* | 406 // result: A B C *G* |
407 // If there is a pending entry after *G* in |this|, it is also preserved. | 407 // If there is a pending entry after *G* in |this|, it is also preserved. |
408 // This ignores any pending or transient entries in |source|. Callers must | 408 // This ignores any pending or transient entries in |source|. Callers must |
409 // ensure that |CanPruneAllButVisible| returns true before calling this, or it | 409 // ensure that |CanPruneAllButLastCommitted| returns true before calling this, |
410 // will crash. | 410 // or it will crash. |
411 virtual void CopyStateFromAndPrune(NavigationController* source) = 0; | 411 virtual void CopyStateFromAndPrune(NavigationController* source) = 0; |
412 | 412 |
413 // Returns whether it is safe to call PruneAllButVisible or | 413 // Returns whether it is safe to call PruneAllButLastCommitted or |
414 // CopyStateFromAndPrune. There must be a last committed entry, no transient | 414 // CopyStateFromAndPrune. There must be a last committed entry, no transient |
415 // entry, and if there is a pending entry, it must be new and not an existing | 415 // entry, and if there is a pending entry, it must be new and not an existing |
416 // entry. | 416 // entry. |
417 // | 417 // |
418 // If there were no last committed entry, the pending entry might not commit, | 418 // If there were no last committed entry, the pending entry might not commit, |
419 // leaving us with a blank page. This is unsafe when used with | 419 // leaving us with a blank page. This is unsafe when used with |
420 // |CopyStateFromAndPrune|, which would show an existing entry above the blank | 420 // |CopyStateFromAndPrune|, which would show an existing entry above the blank |
421 // page. | 421 // page. |
422 // If there were a transient entry, we would not want to prune the other | 422 // If there were a transient entry, we would not want to prune the other |
423 // entries, which the transient entry could be referring to. | 423 // entries, which the transient entry could be referring to. |
424 // If there were an existing pending entry, we could not prune the last | 424 // If there were an existing pending entry, we could not prune the last |
425 // committed entry, in case it did not commit. That would leave us with no | 425 // committed entry, in case it did not commit. That would leave us with no |
426 // sensible place to put the pending entry when it did commit, after all other | 426 // sensible place to put the pending entry when it did commit, after all other |
427 // entries are pruned. For example, it could be going back several entries. | 427 // entries are pruned. For example, it could be going back several entries. |
428 // (New pending entries are safe, because they can always commit to the end.) | 428 // (New pending entries are safe, because they can always commit to the end.) |
429 virtual bool CanPruneAllButVisible() = 0; | 429 virtual bool CanPruneAllButLastCommitted() = 0; |
430 | 430 |
431 // Removes all the entries except the last committed entry. If there is a new | 431 // Removes all the entries except the last committed entry. If there is a new |
432 // pending navigation it is preserved. Callers must ensure | 432 // pending navigation it is preserved. Callers must ensure |
433 // |CanPruneAllButVisible| returns true before calling this, or it will crash. | 433 // |CanPruneAllButLastCommitted| returns true before calling this, or it will |
434 virtual void PruneAllButVisible() = 0; | 434 // crash. |
| 435 virtual void PruneAllButLastCommitted() = 0; |
435 | 436 |
436 // Clears all screenshots associated with navigation entries in this | 437 // Clears all screenshots associated with navigation entries in this |
437 // controller. Useful to reduce memory consumption in low-memory situations. | 438 // controller. Useful to reduce memory consumption in low-memory situations. |
438 virtual void ClearAllScreenshots() = 0; | 439 virtual void ClearAllScreenshots() = 0; |
439 | 440 |
440 private: | 441 private: |
441 // This interface should only be implemented inside content. | 442 // This interface should only be implemented inside content. |
442 friend class NavigationControllerImpl; | 443 friend class NavigationControllerImpl; |
443 NavigationController() {} | 444 NavigationController() {} |
444 }; | 445 }; |
445 | 446 |
446 } // namespace content | 447 } // namespace content |
447 | 448 |
448 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 449 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
OLD | NEW |