| 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> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 | 10 |
| 11 InMemoryTabRestoreService::InMemoryTabRestoreService( | 11 InMemoryTabRestoreService::InMemoryTabRestoreService( |
| 12 Profile* profile, | |
| 13 scoped_ptr<sessions::TabRestoreServiceClient> client, | 12 scoped_ptr<sessions::TabRestoreServiceClient> client, |
| 14 TabRestoreService::TimeFactory* time_factory) | 13 TabRestoreService::TimeFactory* time_factory) |
| 15 : client_(client.Pass()), | 14 : client_(client.Pass()), |
| 16 helper_(this, NULL, profile, client_.get(), time_factory) {} | 15 helper_(this, NULL, client_.get(), time_factory) {} |
| 17 | 16 |
| 18 InMemoryTabRestoreService::~InMemoryTabRestoreService() {} | 17 InMemoryTabRestoreService::~InMemoryTabRestoreService() {} |
| 19 | 18 |
| 20 void InMemoryTabRestoreService::AddObserver( | 19 void InMemoryTabRestoreService::AddObserver( |
| 21 TabRestoreServiceObserver* observer) { | 20 TabRestoreServiceObserver* observer) { |
| 22 helper_.AddObserver(observer); | 21 helper_.AddObserver(observer); |
| 23 } | 22 } |
| 24 | 23 |
| 25 void InMemoryTabRestoreService::RemoveObserver( | 24 void InMemoryTabRestoreService::RemoveObserver( |
| 26 TabRestoreServiceObserver* observer) { | 25 TabRestoreServiceObserver* observer) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 47 helper_.ClearEntries(); | 46 helper_.ClearEntries(); |
| 48 } | 47 } |
| 49 | 48 |
| 50 const TabRestoreService::Entries& InMemoryTabRestoreService::entries() const { | 49 const TabRestoreService::Entries& InMemoryTabRestoreService::entries() const { |
| 51 return helper_.entries(); | 50 return helper_.entries(); |
| 52 } | 51 } |
| 53 | 52 |
| 54 std::vector<content::WebContents*> | 53 std::vector<content::WebContents*> |
| 55 InMemoryTabRestoreService::RestoreMostRecentEntry( | 54 InMemoryTabRestoreService::RestoreMostRecentEntry( |
| 56 TabRestoreServiceDelegate* delegate, | 55 TabRestoreServiceDelegate* delegate, |
| 57 chrome::HostDesktopType host_desktop_type) { | 56 int host_desktop_type) { |
| 58 return helper_.RestoreMostRecentEntry(delegate, host_desktop_type); | 57 return helper_.RestoreMostRecentEntry(delegate, host_desktop_type); |
| 59 } | 58 } |
| 60 | 59 |
| 61 TabRestoreService::Tab* InMemoryTabRestoreService::RemoveTabEntryById( | 60 TabRestoreService::Tab* InMemoryTabRestoreService::RemoveTabEntryById( |
| 62 SessionID::id_type id) { | 61 SessionID::id_type id) { |
| 63 return helper_.RemoveTabEntryById(id); | 62 return helper_.RemoveTabEntryById(id); |
| 64 } | 63 } |
| 65 | 64 |
| 66 std::vector<content::WebContents*> InMemoryTabRestoreService::RestoreEntryById( | 65 std::vector<content::WebContents*> InMemoryTabRestoreService::RestoreEntryById( |
| 67 TabRestoreServiceDelegate* delegate, | 66 TabRestoreServiceDelegate* delegate, |
| 68 SessionID::id_type id, | 67 SessionID::id_type id, |
| 69 chrome::HostDesktopType host_desktop_type, | 68 int host_desktop_type, |
| 70 WindowOpenDisposition disposition) { | 69 WindowOpenDisposition disposition) { |
| 71 return helper_.RestoreEntryById(delegate, id, host_desktop_type, disposition); | 70 return helper_.RestoreEntryById(delegate, id, host_desktop_type, disposition); |
| 72 } | 71 } |
| 73 | 72 |
| 74 void InMemoryTabRestoreService::LoadTabsFromLastSession() { | 73 void InMemoryTabRestoreService::LoadTabsFromLastSession() { |
| 75 // Do nothing. This relies on tab persistence which is implemented in Java on | 74 // Do nothing. This relies on tab persistence which is implemented in Java on |
| 76 // the application side on Android. | 75 // the application side on Android. |
| 77 } | 76 } |
| 78 | 77 |
| 79 bool InMemoryTabRestoreService::IsLoaded() const { | 78 bool InMemoryTabRestoreService::IsLoaded() const { |
| 80 // See comment above. | 79 // See comment above. |
| 81 return true; | 80 return true; |
| 82 } | 81 } |
| 83 | 82 |
| 84 void InMemoryTabRestoreService::DeleteLastSession() { | 83 void InMemoryTabRestoreService::DeleteLastSession() { |
| 85 // See comment above. | 84 // See comment above. |
| 86 } | 85 } |
| 87 | 86 |
| 88 void InMemoryTabRestoreService::Shutdown() { | 87 void InMemoryTabRestoreService::Shutdown() { |
| 89 } | 88 } |
| OLD | NEW |