Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / sessions / in_memory_tab_restore_service.cc
blob4d2856f86b02ab22e9452441c203bca9a206de04
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 <vector>
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/sessions/tab_restore_service_factory.h"
13 InMemoryTabRestoreService::InMemoryTabRestoreService(
14 Profile* profile,
15 TabRestoreService::TimeFactory* time_factory)
16 : helper_(this, NULL, profile, time_factory) {
19 InMemoryTabRestoreService::~InMemoryTabRestoreService() {}
21 void InMemoryTabRestoreService::AddObserver(
22 TabRestoreServiceObserver* observer) {
23 helper_.AddObserver(observer);
26 void InMemoryTabRestoreService::RemoveObserver(
27 TabRestoreServiceObserver* observer) {
28 helper_.RemoveObserver(observer);
31 void InMemoryTabRestoreService::CreateHistoricalTab(
32 content::WebContents* contents,
33 int index) {
34 helper_.CreateHistoricalTab(contents, index);
37 void InMemoryTabRestoreService::BrowserClosing(
38 TabRestoreServiceDelegate* delegate) {
39 helper_.BrowserClosing(delegate);
42 void InMemoryTabRestoreService::BrowserClosed(
43 TabRestoreServiceDelegate* delegate) {
44 helper_.BrowserClosed(delegate);
47 void InMemoryTabRestoreService::ClearEntries() {
48 helper_.ClearEntries();
51 const TabRestoreService::Entries& InMemoryTabRestoreService::entries() const {
52 return helper_.entries();
55 std::vector<content::WebContents*>
56 InMemoryTabRestoreService::RestoreMostRecentEntry(
57 TabRestoreServiceDelegate* delegate,
58 chrome::HostDesktopType host_desktop_type) {
59 return helper_.RestoreMostRecentEntry(delegate, host_desktop_type);
62 TabRestoreService::Tab* InMemoryTabRestoreService::RemoveTabEntryById(
63 SessionID::id_type id) {
64 return helper_.RemoveTabEntryById(id);
67 std::vector<content::WebContents*> InMemoryTabRestoreService::RestoreEntryById(
68 TabRestoreServiceDelegate* delegate,
69 SessionID::id_type id,
70 chrome::HostDesktopType host_desktop_type,
71 WindowOpenDisposition disposition) {
72 return helper_.RestoreEntryById(delegate, id, host_desktop_type, disposition);
75 void InMemoryTabRestoreService::LoadTabsFromLastSession() {
76 // Do nothing. This relies on tab persistence which is implemented in Java on
77 // the application side on Android.
80 bool InMemoryTabRestoreService::IsLoaded() const {
81 // See comment above.
82 return true;
85 void InMemoryTabRestoreService::DeleteLastSession() {
86 // See comment above.
89 void InMemoryTabRestoreService::Shutdown() {
92 KeyedService* TabRestoreServiceFactory::BuildServiceInstanceFor(
93 content::BrowserContext* profile) const {
94 return new InMemoryTabRestoreService(static_cast<Profile*>(profile), NULL);