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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 params.tabstrip_add_types = add_types; | 946 params.tabstrip_add_types = add_types; |
947 browser::Navigate(¶ms); | 947 browser::Navigate(¶ms); |
948 } | 948 } |
949 } | 949 } |
950 | 950 |
951 // Invokes TabRestored on the SessionService for all tabs in browser after | 951 // Invokes TabRestored on the SessionService for all tabs in browser after |
952 // initial_count. | 952 // initial_count. |
953 void NotifySessionServiceOfRestoredTabs(Browser* browser, int initial_count) { | 953 void NotifySessionServiceOfRestoredTabs(Browser* browser, int initial_count) { |
954 SessionService* session_service = | 954 SessionService* session_service = |
955 SessionServiceFactory::GetForProfile(profile_); | 955 SessionServiceFactory::GetForProfile(profile_); |
| 956 if (!session_service) |
| 957 return; |
956 for (int i = initial_count; i < browser->tab_count(); ++i) | 958 for (int i = initial_count; i < browser->tab_count(); ++i) |
957 session_service->TabRestored(browser->GetTabContentsWrapperAt(i), | 959 session_service->TabRestored(browser->GetTabContentsWrapperAt(i), |
958 browser->IsTabPinned(i)); | 960 browser->IsTabPinned(i)); |
959 } | 961 } |
960 | 962 |
961 // The profile to create the sessions for. | 963 // The profile to create the sessions for. |
962 Profile* profile_; | 964 Profile* profile_; |
963 | 965 |
964 // The first browser to restore to, may be null. | 966 // The first browser to restore to, may be null. |
965 Browser* browser_; | 967 Browser* browser_; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 if (active_session_restorers == NULL) | 1061 if (active_session_restorers == NULL) |
1060 return false; | 1062 return false; |
1061 for (std::set<SessionRestoreImpl*>::const_iterator it = | 1063 for (std::set<SessionRestoreImpl*>::const_iterator it = |
1062 active_session_restorers->begin(); | 1064 active_session_restorers->begin(); |
1063 it != active_session_restorers->end(); ++it) { | 1065 it != active_session_restorers->end(); ++it) { |
1064 if ((*it)->profile() == profile) | 1066 if ((*it)->profile() == profile) |
1065 return true; | 1067 return true; |
1066 } | 1068 } |
1067 return false; | 1069 return false; |
1068 } | 1070 } |
OLD | NEW |