OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 516 |
517 // Appends the urls in |urls| to |browser|. | 517 // Appends the urls in |urls| to |browser|. |
518 void AppendURLsToBrowser(Browser* browser, | 518 void AppendURLsToBrowser(Browser* browser, |
519 const std::vector<GURL>& urls) { | 519 const std::vector<GURL>& urls) { |
520 for (size_t i = 0; i < urls.size(); ++i) { | 520 for (size_t i = 0; i < urls.size(); ++i) { |
521 int add_types = TabStripModel::ADD_FORCE_INDEX; | 521 int add_types = TabStripModel::ADD_FORCE_INDEX; |
522 if (i == 0) | 522 if (i == 0) |
523 add_types |= TabStripModel::ADD_SELECTED; | 523 add_types |= TabStripModel::ADD_SELECTED; |
524 int index = browser->GetIndexForInsertionDuringRestore(i); | 524 int index = browser->GetIndexForInsertionDuringRestore(i); |
525 browser->AddTabWithURL(urls[i], GURL(), PageTransition::START_PAGE, index, | 525 browser->AddTabWithURL(urls[i], GURL(), PageTransition::START_PAGE, index, |
526 add_types, NULL, std::string()); | 526 add_types, NULL, std::string(), NULL); |
527 } | 527 } |
528 } | 528 } |
529 | 529 |
530 // Invokes TabRestored on the SessionService for all tabs in browser after | 530 // Invokes TabRestored on the SessionService for all tabs in browser after |
531 // initial_count. | 531 // initial_count. |
532 void NotifySessionServiceOfRestoredTabs(Browser* browser, int initial_count) { | 532 void NotifySessionServiceOfRestoredTabs(Browser* browser, int initial_count) { |
533 SessionService* session_service = profile_->GetSessionService(); | 533 SessionService* session_service = profile_->GetSessionService(); |
534 for (int i = initial_count; i < browser->tab_count(); ++i) | 534 for (int i = initial_count; i < browser->tab_count(); ++i) |
535 session_service->TabRestored(&browser->GetTabContentsAt(i)->controller(), | 535 session_service->TabRestored(&browser->GetTabContentsAt(i)->controller(), |
536 browser->tabstrip_model()->IsTabPinned(i)); | 536 browser->tabstrip_model()->IsTabPinned(i)); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 void SessionRestore::RestoreSessionSynchronously( | 617 void SessionRestore::RestoreSessionSynchronously( |
618 Profile* profile, | 618 Profile* profile, |
619 const std::vector<GURL>& urls_to_open) { | 619 const std::vector<GURL>& urls_to_open) { |
620 Restore(profile, NULL, true, false, true, urls_to_open); | 620 Restore(profile, NULL, true, false, true, urls_to_open); |
621 } | 621 } |
622 | 622 |
623 // static | 623 // static |
624 bool SessionRestore::IsRestoring() { | 624 bool SessionRestore::IsRestoring() { |
625 return restoring; | 625 return restoring; |
626 } | 626 } |
OLD | NEW |