Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: chrome/browser/sessions/persistent_tab_restore_service.cc

Issue 1321713005: Abstract WebContents/NavigationController from core TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "base/stl_util.h" 17 #include "base/stl_util.h"
18 #include "base/task/cancelable_task_tracker.h" 18 #include "base/task/cancelable_task_tracker.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "components/sessions/base_session_service.h" 20 #include "components/sessions/base_session_service.h"
21 #include "components/sessions/base_session_service_commands.h" 21 #include "components/sessions/base_session_service_commands.h"
22 #include "components/sessions/base_session_service_delegate.h" 22 #include "components/sessions/base_session_service_delegate.h"
23 #include "components/sessions/core/session_constants.h" 23 #include "components/sessions/core/session_constants.h"
24 #include "components/sessions/session_command.h" 24 #include "components/sessions/session_command.h"
25 25
26 using sessions::LiveTab;
27
26 namespace { 28 namespace {
27 29
28 // Only written if the tab is pinned. 30 // Only written if the tab is pinned.
29 typedef bool PinnedStatePayload; 31 typedef bool PinnedStatePayload;
30 32
31 typedef int32 RestoredEntryPayload; 33 typedef int32 RestoredEntryPayload;
32 34
33 typedef std::map<SessionID::id_type, TabRestoreService::Entry*> IDToEntry; 35 typedef std::map<SessionID::id_type, TabRestoreService::Entry*> IDToEntry;
34 36
35 // Payload used for the start of a tab close. This is the old struct that is 37 // Payload used for the start of a tab close. This is the old struct that is
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 void PersistentTabRestoreService::AddObserver( 940 void PersistentTabRestoreService::AddObserver(
939 TabRestoreServiceObserver* observer) { 941 TabRestoreServiceObserver* observer) {
940 helper_.AddObserver(observer); 942 helper_.AddObserver(observer);
941 } 943 }
942 944
943 void PersistentTabRestoreService::RemoveObserver( 945 void PersistentTabRestoreService::RemoveObserver(
944 TabRestoreServiceObserver* observer) { 946 TabRestoreServiceObserver* observer) {
945 helper_.RemoveObserver(observer); 947 helper_.RemoveObserver(observer);
946 } 948 }
947 949
948 void PersistentTabRestoreService::CreateHistoricalTab( 950 void PersistentTabRestoreService::CreateHistoricalTab(LiveTab* live_tab,
949 content::WebContents* contents, 951 int index) {
950 int index) { 952 helper_.CreateHistoricalTab(live_tab, index);
951 helper_.CreateHistoricalTab(contents, index);
952 } 953 }
953 954
954 void PersistentTabRestoreService::BrowserClosing( 955 void PersistentTabRestoreService::BrowserClosing(
955 TabRestoreServiceDelegate* delegate) { 956 TabRestoreServiceDelegate* delegate) {
956 helper_.BrowserClosing(delegate); 957 helper_.BrowserClosing(delegate);
957 } 958 }
958 959
959 void PersistentTabRestoreService::BrowserClosed( 960 void PersistentTabRestoreService::BrowserClosed(
960 TabRestoreServiceDelegate* delegate) { 961 TabRestoreServiceDelegate* delegate) {
961 helper_.BrowserClosed(delegate); 962 helper_.BrowserClosed(delegate);
962 } 963 }
963 964
964 void PersistentTabRestoreService::ClearEntries() { 965 void PersistentTabRestoreService::ClearEntries() {
965 helper_.ClearEntries(); 966 helper_.ClearEntries();
966 } 967 }
967 968
968 const TabRestoreService::Entries& PersistentTabRestoreService::entries() const { 969 const TabRestoreService::Entries& PersistentTabRestoreService::entries() const {
969 return helper_.entries(); 970 return helper_.entries();
970 } 971 }
971 972
972 std::vector<content::WebContents*> 973 std::vector<LiveTab*> PersistentTabRestoreService::RestoreMostRecentEntry(
973 PersistentTabRestoreService::RestoreMostRecentEntry(
974 TabRestoreServiceDelegate* delegate, 974 TabRestoreServiceDelegate* delegate,
975 int host_desktop_type) { 975 int host_desktop_type) {
976 return helper_.RestoreMostRecentEntry(delegate, host_desktop_type); 976 return helper_.RestoreMostRecentEntry(delegate, host_desktop_type);
977 } 977 }
978 978
979 TabRestoreService::Tab* PersistentTabRestoreService::RemoveTabEntryById( 979 TabRestoreService::Tab* PersistentTabRestoreService::RemoveTabEntryById(
980 SessionID::id_type id) { 980 SessionID::id_type id) {
981 return helper_.RemoveTabEntryById(id); 981 return helper_.RemoveTabEntryById(id);
982 } 982 }
983 983
984 std::vector<content::WebContents*> 984 std::vector<LiveTab*> PersistentTabRestoreService::RestoreEntryById(
985 PersistentTabRestoreService::RestoreEntryById(
986 TabRestoreServiceDelegate* delegate, 985 TabRestoreServiceDelegate* delegate,
987 SessionID::id_type id, 986 SessionID::id_type id,
988 int host_desktop_type, 987 int host_desktop_type,
989 WindowOpenDisposition disposition) { 988 WindowOpenDisposition disposition) {
990 return helper_.RestoreEntryById(delegate, id, host_desktop_type, disposition); 989 return helper_.RestoreEntryById(delegate, id, host_desktop_type, disposition);
991 } 990 }
992 991
993 bool PersistentTabRestoreService::IsLoaded() const { 992 bool PersistentTabRestoreService::IsLoaded() const {
994 return delegate_->IsLoaded(); 993 return delegate_->IsLoaded();
995 } 994 }
(...skipping 10 matching lines...) Expand all
1006 delegate_->LoadTabsFromLastSession(); 1005 delegate_->LoadTabsFromLastSession();
1007 } 1006 }
1008 1007
1009 TabRestoreService::Entries* PersistentTabRestoreService::mutable_entries() { 1008 TabRestoreService::Entries* PersistentTabRestoreService::mutable_entries() {
1010 return &helper_.entries_; 1009 return &helper_.entries_;
1011 } 1010 }
1012 1011
1013 void PersistentTabRestoreService::PruneEntries() { 1012 void PersistentTabRestoreService::PruneEntries() {
1014 helper_.PruneEntries(); 1013 helper_.PruneEntries();
1015 } 1014 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698