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 | |
109 private: | 104 private: |
110 SessionRestore(); | 105 SessionRestore(); |
111 | 106 |
112 // Accessor for |*on_session_restored_callbacks_|. Creates a new object the | 107 // Accessor for |*on_session_restored_callbacks_|. Creates a new object the |
113 // first time so that it always returns a valid object. | 108 // first time so that it always returns a valid object. |
114 static CallbackList* on_session_restored_callbacks() { | 109 static CallbackList* on_session_restored_callbacks() { |
115 if (!on_session_restored_callbacks_) | 110 if (!on_session_restored_callbacks_) |
116 on_session_restored_callbacks_ = new CallbackList(); | 111 on_session_restored_callbacks_ = new CallbackList(); |
117 return on_session_restored_callbacks_; | 112 return on_session_restored_callbacks_; |
118 } | 113 } |
119 | 114 |
120 // Contains all registered callbacks for session restore notifications. | 115 // Contains all registered callbacks for session restore notifications. |
121 static CallbackList* on_session_restored_callbacks_; | 116 static CallbackList* on_session_restored_callbacks_; |
122 | 117 |
123 DISALLOW_COPY_AND_ASSIGN(SessionRestore); | 118 DISALLOW_COPY_AND_ASSIGN(SessionRestore); |
124 }; | 119 }; |
125 | 120 |
126 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ | 121 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ |
OLD | NEW |