| 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/in_memory_tab_restore_service.h" | 5 #include "chrome/browser/sessions/in_memory_tab_restore_service.h" |
| 6 | 6 |
| 7 #include <vector> |
| 8 |
| 7 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 11 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 10 | 12 |
| 11 InMemoryTabRestoreService::InMemoryTabRestoreService( | 13 InMemoryTabRestoreService::InMemoryTabRestoreService( |
| 12 Profile* profile, | 14 Profile* profile, |
| 13 TabRestoreService::TimeFactory* time_factory) | 15 TabRestoreService::TimeFactory* time_factory) |
| 14 : helper_(this, NULL, profile, time_factory) { | 16 : helper_(this, NULL, profile, time_factory) { |
| 15 } | 17 } |
| 16 | 18 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 43 } | 45 } |
| 44 | 46 |
| 45 void InMemoryTabRestoreService::ClearEntries() { | 47 void InMemoryTabRestoreService::ClearEntries() { |
| 46 helper_.ClearEntries(); | 48 helper_.ClearEntries(); |
| 47 } | 49 } |
| 48 | 50 |
| 49 const TabRestoreService::Entries& InMemoryTabRestoreService::entries() const { | 51 const TabRestoreService::Entries& InMemoryTabRestoreService::entries() const { |
| 50 return helper_.entries(); | 52 return helper_.entries(); |
| 51 } | 53 } |
| 52 | 54 |
| 53 void InMemoryTabRestoreService::RestoreMostRecentEntry( | 55 std::vector<content::WebContents*> |
| 56 InMemoryTabRestoreService::RestoreMostRecentEntry( |
| 54 TabRestoreServiceDelegate* delegate, | 57 TabRestoreServiceDelegate* delegate, |
| 55 chrome::HostDesktopType host_desktop_type) { | 58 chrome::HostDesktopType host_desktop_type) { |
| 56 helper_.RestoreMostRecentEntry(delegate, host_desktop_type); | 59 return helper_.RestoreMostRecentEntry(delegate, host_desktop_type); |
| 57 } | 60 } |
| 58 | 61 |
| 59 TabRestoreService::Tab* InMemoryTabRestoreService::RemoveTabEntryById( | 62 TabRestoreService::Tab* InMemoryTabRestoreService::RemoveTabEntryById( |
| 60 SessionID::id_type id) { | 63 SessionID::id_type id) { |
| 61 return helper_.RemoveTabEntryById(id); | 64 return helper_.RemoveTabEntryById(id); |
| 62 } | 65 } |
| 63 | 66 |
| 64 void InMemoryTabRestoreService::RestoreEntryById( | 67 std::vector<content::WebContents*> InMemoryTabRestoreService::RestoreEntryById( |
| 65 TabRestoreServiceDelegate* delegate, | 68 TabRestoreServiceDelegate* delegate, |
| 66 SessionID::id_type id, | 69 SessionID::id_type id, |
| 67 chrome::HostDesktopType host_desktop_type, | 70 chrome::HostDesktopType host_desktop_type, |
| 68 WindowOpenDisposition disposition) { | 71 WindowOpenDisposition disposition) { |
| 69 helper_.RestoreEntryById(delegate, id, host_desktop_type, disposition); | 72 return helper_.RestoreEntryById(delegate, id, host_desktop_type, disposition); |
| 70 } | 73 } |
| 71 | 74 |
| 72 void InMemoryTabRestoreService::LoadTabsFromLastSession() { | 75 void InMemoryTabRestoreService::LoadTabsFromLastSession() { |
| 73 // Do nothing. This relies on tab persistence which is implemented in Java on | 76 // Do nothing. This relies on tab persistence which is implemented in Java on |
| 74 // the application side on Android. | 77 // the application side on Android. |
| 75 } | 78 } |
| 76 | 79 |
| 77 bool InMemoryTabRestoreService::IsLoaded() const { | 80 bool InMemoryTabRestoreService::IsLoaded() const { |
| 78 // See comment above. | 81 // See comment above. |
| 79 return true; | 82 return true; |
| 80 } | 83 } |
| 81 | 84 |
| 82 void InMemoryTabRestoreService::DeleteLastSession() { | 85 void InMemoryTabRestoreService::DeleteLastSession() { |
| 83 // See comment above. | 86 // See comment above. |
| 84 } | 87 } |
| 85 | 88 |
| 86 void InMemoryTabRestoreService::Shutdown() { | 89 void InMemoryTabRestoreService::Shutdown() { |
| 87 } | 90 } |
| 88 | 91 |
| 89 BrowserContextKeyedService* TabRestoreServiceFactory::BuildServiceInstanceFor( | 92 BrowserContextKeyedService* TabRestoreServiceFactory::BuildServiceInstanceFor( |
| 90 content::BrowserContext* profile) const { | 93 content::BrowserContext* profile) const { |
| 91 return new InMemoryTabRestoreService(static_cast<Profile*>(profile), NULL); | 94 return new InMemoryTabRestoreService(static_cast<Profile*>(profile), NULL); |
| 92 } | 95 } |
| OLD | NEW |