| 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 CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Returns true if synchronously restoring a session. | 91 // Returns true if synchronously restoring a session. |
| 92 static bool IsRestoringSynchronously(); | 92 static bool IsRestoringSynchronously(); |
| 93 | 93 |
| 94 // Registers a callback that is notified every time session restore completes. | 94 // Registers a callback that is notified every time session restore completes. |
| 95 // Note that 'complete' means all the browsers and tabs have been created but | 95 // Note that 'complete' means all the browsers and tabs have been created but |
| 96 // have not necessarily finished loading. The integer supplied to the callback | 96 // have not necessarily finished loading. The integer supplied to the callback |
| 97 // indicates the number of tabs that were created. | 97 // indicates the number of tabs that were created. |
| 98 static CallbackSubscription RegisterOnSessionRestoredCallback( | 98 static CallbackSubscription RegisterOnSessionRestoredCallback( |
| 99 const base::Callback<void(int)>& callback); | 99 const base::Callback<void(int)>& callback); |
| 100 | 100 |
| 101 // Returns true if only active tabs are to be loaded during session restore |
| 102 // (lazy load). Otherwise returns false if all tabs will be loaded when |
| 103 // restored. |
| 104 static bool WillLoadActiveTabsOnly(); |
| 105 |
| 101 private: | 106 private: |
| 102 SessionRestore(); | 107 SessionRestore(); |
| 103 | 108 |
| 104 // Accessor for |*on_session_restored_callbacks_|. Creates a new object the | 109 // Accessor for |*on_session_restored_callbacks_|. Creates a new object the |
| 105 // first time so that it always returns a valid object. | 110 // first time so that it always returns a valid object. |
| 106 static CallbackList* on_session_restored_callbacks() { | 111 static CallbackList* on_session_restored_callbacks() { |
| 107 if (!on_session_restored_callbacks_) | 112 if (!on_session_restored_callbacks_) |
| 108 on_session_restored_callbacks_ = new CallbackList(); | 113 on_session_restored_callbacks_ = new CallbackList(); |
| 109 return on_session_restored_callbacks_; | 114 return on_session_restored_callbacks_; |
| 110 } | 115 } |
| 111 | 116 |
| 112 // Contains all registered callbacks for session restore notifications. | 117 // Contains all registered callbacks for session restore notifications. |
| 113 static CallbackList* on_session_restored_callbacks_; | 118 static CallbackList* on_session_restored_callbacks_; |
| 114 | 119 |
| 115 DISALLOW_COPY_AND_ASSIGN(SessionRestore); | 120 DISALLOW_COPY_AND_ASSIGN(SessionRestore); |
| 116 }; | 121 }; |
| 117 | 122 |
| 118 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ | 123 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ |
| OLD | NEW |