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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Returns true if synchronously restoring a session. | 94 // Returns true if synchronously restoring a session. |
95 static bool IsRestoringSynchronously(); | 95 static bool IsRestoringSynchronously(); |
96 | 96 |
97 // Registers a callback that is notified every time session restore completes. | 97 // Registers a callback that is notified every time session restore completes. |
98 // Note that 'complete' means all the browsers and tabs have been created but | 98 // Note that 'complete' means all the browsers and tabs have been created but |
99 // have not necessarily finished loading. The integer supplied to the callback | 99 // have not necessarily finished loading. The integer supplied to the callback |
100 // indicates the number of tabs that were created. | 100 // indicates the number of tabs that were created. |
101 static CallbackSubscription RegisterOnSessionRestoredCallback( | 101 static CallbackSubscription RegisterOnSessionRestoredCallback( |
102 const base::Callback<void(int)>& callback); | 102 const base::Callback<void(int)>& callback); |
103 | 103 |
| 104 // Add |urls| to URLs-to-open list, so that they will be opened after session |
| 105 // URLs when session is restored. |
| 106 static void AddURLsToOpen(const Profile* profile, |
| 107 const std::vector<GURL>& urls); |
| 108 |
104 private: | 109 private: |
105 SessionRestore(); | 110 SessionRestore(); |
106 | 111 |
107 // Accessor for |*on_session_restored_callbacks_|. Creates a new object the | 112 // Accessor for |*on_session_restored_callbacks_|. Creates a new object the |
108 // first time so that it always returns a valid object. | 113 // first time so that it always returns a valid object. |
109 static CallbackList* on_session_restored_callbacks() { | 114 static CallbackList* on_session_restored_callbacks() { |
110 if (!on_session_restored_callbacks_) | 115 if (!on_session_restored_callbacks_) |
111 on_session_restored_callbacks_ = new CallbackList(); | 116 on_session_restored_callbacks_ = new CallbackList(); |
112 return on_session_restored_callbacks_; | 117 return on_session_restored_callbacks_; |
113 } | 118 } |
114 | 119 |
115 // Contains all registered callbacks for session restore notifications. | 120 // Contains all registered callbacks for session restore notifications. |
116 static CallbackList* on_session_restored_callbacks_; | 121 static CallbackList* on_session_restored_callbacks_; |
117 | 122 |
118 DISALLOW_COPY_AND_ASSIGN(SessionRestore); | 123 DISALLOW_COPY_AND_ASSIGN(SessionRestore); |
119 }; | 124 }; |
120 | 125 |
121 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ | 126 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ |
OLD | NEW |