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
3 // found in the LICENSE file.
5 #include "chrome/browser/sessions/in_memory_tab_restore_service.h"
7 #include "base/compiler_specific.h"
8 #include "chrome/browser/sessions/tab_restore_service_factory.h"
10 InMemoryTabRestoreService::InMemoryTabRestoreService(
12 TabRestoreService::TimeFactory
* time_factory
)
13 : ALLOW_THIS_IN_INITIALIZER_LIST(
14 helper_(this, NULL
, profile
, time_factory
)) {
17 InMemoryTabRestoreService::~InMemoryTabRestoreService() {}
19 void InMemoryTabRestoreService::AddObserver(
20 TabRestoreServiceObserver
* observer
) {
21 helper_
.AddObserver(observer
);
24 void InMemoryTabRestoreService::RemoveObserver(
25 TabRestoreServiceObserver
* observer
) {
26 helper_
.RemoveObserver(observer
);
29 void InMemoryTabRestoreService::CreateHistoricalTab(
30 content::WebContents
* contents
,
32 helper_
.CreateHistoricalTab(contents
, index
);
35 void InMemoryTabRestoreService::BrowserClosing(
36 TabRestoreServiceDelegate
* delegate
) {
37 helper_
.BrowserClosing(delegate
);
40 void InMemoryTabRestoreService::BrowserClosed(
41 TabRestoreServiceDelegate
* delegate
) {
42 helper_
.BrowserClosed(delegate
);
45 void InMemoryTabRestoreService::ClearEntries() {
46 helper_
.ClearEntries();
49 const TabRestoreService::Entries
& InMemoryTabRestoreService::entries() const {
50 return helper_
.entries();
53 void InMemoryTabRestoreService::RestoreMostRecentEntry(
54 TabRestoreServiceDelegate
* delegate
,
55 chrome::HostDesktopType host_desktop_type
) {
56 helper_
.RestoreMostRecentEntry(delegate
, host_desktop_type
);
59 TabRestoreService::Tab
* InMemoryTabRestoreService::RemoveTabEntryById(
60 SessionID::id_type id
) {
61 return helper_
.RemoveTabEntryById(id
);
64 void InMemoryTabRestoreService::RestoreEntryById(
65 TabRestoreServiceDelegate
* delegate
,
66 SessionID::id_type id
,
67 chrome::HostDesktopType host_desktop_type
,
68 WindowOpenDisposition disposition
) {
69 helper_
.RestoreEntryById(delegate
, id
, host_desktop_type
, disposition
);
72 void InMemoryTabRestoreService::LoadTabsFromLastSession() {
73 // Do nothing. This relies on tab persistence which is implemented in Java on
74 // the application side on Android.
77 bool InMemoryTabRestoreService::IsLoaded() const {
82 void InMemoryTabRestoreService::DeleteLastSession() {
86 void InMemoryTabRestoreService::Shutdown() {
89 ProfileKeyedService
* TabRestoreServiceFactory::BuildServiceInstanceFor(
90 Profile
* profile
) const {
91 return new InMemoryTabRestoreService(profile
, NULL
);