| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSIONS_STATE_STORE_NOTIFICATION_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_STATE_STORE_NOTIFICATION_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_STATE_STORE_NOTIFICATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_STATE_STORE_NOTIFICATION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/sessions/session_restore.h" | 10 #include "chrome/browser/sessions/session_restore.h" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 class StateStore; | 13 class StateStore; |
| 14 | 14 |
| 15 // Initializes the StateStore when session restore is complete, for example when | 15 // Initializes the StateStore when session restore is complete, for example when |
| 16 // page load notifications are not sent ("Continue where I left off"). | 16 // page load notifications are not sent ("Continue where I left off"). |
| 17 // http://crbug.com/230481 | 17 // http://crbug.com/230481 |
| 18 class StateStoreNotificationObserver { | 18 class StateStoreNotificationObserver { |
| 19 public: | 19 public: |
| 20 explicit StateStoreNotificationObserver(StateStore* state_store); | 20 explicit StateStoreNotificationObserver(StateStore* state_store); |
| 21 ~StateStoreNotificationObserver(); | 21 ~StateStoreNotificationObserver(); |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 // Called when a session restore has finished. | 24 // Called when a session restore has finished. |
| 25 void OnSessionRestoreDone(); | 25 void OnSessionRestoreDone(int num_tabs_restored); |
| 26 | 26 |
| 27 StateStore* state_store_; // Not owned. | 27 StateStore* state_store_; // Not owned. |
| 28 | 28 |
| 29 // Points to the on-session-restored callback that was registered with | 29 // Points to the on-session-restored callback that was registered with |
| 30 // SessionRestore's callback list. When objects of this class are destroyed, | 30 // SessionRestore's callback list. When objects of this class are destroyed, |
| 31 // the subscription object's destructor will automatically unregister the | 31 // the subscription object's destructor will automatically unregister the |
| 32 // callback in SessionRestore, so that the callback list does not contain any | 32 // callback in SessionRestore, so that the callback list does not contain any |
| 33 // obsolete callbacks. | 33 // obsolete callbacks. |
| 34 SessionRestore::CallbackSubscription | 34 SessionRestore::CallbackSubscription |
| 35 on_session_restored_callback_subscription_; | 35 on_session_restored_callback_subscription_; |
| 36 | 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(StateStoreNotificationObserver); | 37 DISALLOW_COPY_AND_ASSIGN(StateStoreNotificationObserver); |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 } // namespace extensions | 40 } // namespace extensions |
| 41 | 41 |
| 42 #endif // CHROME_BROWSER_EXTENSIONS_STATE_STORE_NOTIFICATION_OBSERVER_H_ | 42 #endif // CHROME_BROWSER_EXTENSIONS_STATE_STORE_NOTIFICATION_OBSERVER_H_ |
| OLD | NEW |