| 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 #include "chrome/browser/sessions/persistent_tab_restore_service.h" | 5 #include "chrome/browser/sessions/persistent_tab_restore_service.h" |
| 6 | 6 |
| 7 #include <cstring> // memcpy | 7 #include <cstring> // memcpy |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 // PersistentTabRestoreService::Delegate --------------------------------------- | 113 // PersistentTabRestoreService::Delegate --------------------------------------- |
| 114 | 114 |
| 115 // Implements the link between the tab restore service and the session backend. | 115 // Implements the link between the tab restore service and the session backend. |
| 116 class PersistentTabRestoreService::Delegate | 116 class PersistentTabRestoreService::Delegate |
| 117 : public BaseSessionService, | 117 : public BaseSessionService, |
| 118 public TabRestoreServiceHelper::Observer { | 118 public TabRestoreServiceHelper::Observer { |
| 119 public: | 119 public: |
| 120 explicit Delegate(Profile* profile); | 120 explicit Delegate(Profile* profile); |
| 121 | 121 |
| 122 virtual ~Delegate(); | 122 ~Delegate() override; |
| 123 | 123 |
| 124 // BaseSessionService: | 124 // BaseSessionService: |
| 125 virtual void Save() override; | 125 void Save() override; |
| 126 | 126 |
| 127 // TabRestoreServiceHelper::Observer: | 127 // TabRestoreServiceHelper::Observer: |
| 128 virtual void OnClearEntries() override; | 128 void OnClearEntries() override; |
| 129 virtual void OnRestoreEntryById( | 129 void OnRestoreEntryById(SessionID::id_type id, |
| 130 SessionID::id_type id, | 130 Entries::const_iterator entry_iterator) override; |
| 131 Entries::const_iterator entry_iterator) override; | 131 void OnAddEntry() override; |
| 132 virtual void OnAddEntry() override; | |
| 133 | 132 |
| 134 void set_tab_restore_service_helper( | 133 void set_tab_restore_service_helper( |
| 135 TabRestoreServiceHelper* tab_restore_service_helper) { | 134 TabRestoreServiceHelper* tab_restore_service_helper) { |
| 136 tab_restore_service_helper_ = tab_restore_service_helper; | 135 tab_restore_service_helper_ = tab_restore_service_helper; |
| 137 } | 136 } |
| 138 | 137 |
| 139 void LoadTabsFromLastSession(); | 138 void LoadTabsFromLastSession(); |
| 140 | 139 |
| 141 bool IsLoaded() const; | 140 bool IsLoaded() const; |
| 142 | 141 |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 } | 982 } |
| 984 | 983 |
| 985 void PersistentTabRestoreService::PruneEntries() { | 984 void PersistentTabRestoreService::PruneEntries() { |
| 986 helper_.PruneEntries(); | 985 helper_.PruneEntries(); |
| 987 } | 986 } |
| 988 | 987 |
| 989 KeyedService* TabRestoreServiceFactory::BuildServiceInstanceFor( | 988 KeyedService* TabRestoreServiceFactory::BuildServiceInstanceFor( |
| 990 content::BrowserContext* profile) const { | 989 content::BrowserContext* profile) const { |
| 991 return new PersistentTabRestoreService(static_cast<Profile*>(profile), NULL); | 990 return new PersistentTabRestoreService(static_cast<Profile*>(profile), NULL); |
| 992 } | 991 } |
| OLD | NEW |