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/session_restore.h" | 5 #include "chrome/browser/sessions/session_restore.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 // without valid navigations. In that case, just skip it. | 951 // without valid navigations. In that case, just skip it. |
952 // See crbug.com/154129. | 952 // See crbug.com/154129. |
953 if (tab.navigations.empty()) | 953 if (tab.navigations.empty()) |
954 return NULL; | 954 return NULL; |
955 int selected_index = tab.current_navigation_index; | 955 int selected_index = tab.current_navigation_index; |
956 selected_index = std::max( | 956 selected_index = std::max( |
957 0, | 957 0, |
958 std::min(selected_index, | 958 std::min(selected_index, |
959 static_cast<int>(tab.navigations.size() - 1))); | 959 static_cast<int>(tab.navigations.size() - 1))); |
960 | 960 |
961 LOG(ERROR) << "Restoring a tab, title: " | |
962 << tab.navigations.at(selected_index).title(); | |
963 RecordAppLaunchForTab(browser, tab, selected_index); | 961 RecordAppLaunchForTab(browser, tab, selected_index); |
964 | 962 |
965 // Associate sessionStorage (if any) to the restored tab. | 963 // Associate sessionStorage (if any) to the restored tab. |
966 scoped_refptr<content::SessionStorageNamespace> session_storage_namespace; | 964 scoped_refptr<content::SessionStorageNamespace> session_storage_namespace; |
967 if (!tab.session_storage_persistent_id.empty()) { | 965 if (!tab.session_storage_persistent_id.empty()) { |
968 session_storage_namespace = | 966 session_storage_namespace = |
969 content::BrowserContext::GetDefaultStoragePartition(profile_)-> | 967 content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
970 GetDOMStorageContext()->RecreateSessionStorage( | 968 GetDOMStorageContext()->RecreateSessionStorage( |
971 tab.session_storage_persistent_id); | 969 tab.session_storage_persistent_id); |
972 } | 970 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 if (active_session_restorers == NULL) | 1185 if (active_session_restorers == NULL) |
1188 return false; | 1186 return false; |
1189 for (std::set<SessionRestoreImpl*>::const_iterator it = | 1187 for (std::set<SessionRestoreImpl*>::const_iterator it = |
1190 active_session_restorers->begin(); | 1188 active_session_restorers->begin(); |
1191 it != active_session_restorers->end(); ++it) { | 1189 it != active_session_restorers->end(); ++it) { |
1192 if ((*it)->profile() == profile) | 1190 if ((*it)->profile() == profile) |
1193 return true; | 1191 return true; |
1194 } | 1192 } |
1195 return false; | 1193 return false; |
1196 } | 1194 } |
OLD | NEW |