| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_service.h" | 5 #include "chrome/browser/sessions/session_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" |
| 14 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 15 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 16 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 18 #include "base/pickle.h" | 19 #include "base/pickle.h" |
| 19 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
| 20 #include "chrome/browser/extensions/extension_tab_helper.h" | 21 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 21 #include "chrome/browser/prefs/session_startup_pref.h" | 22 #include "chrome/browser/prefs/session_startup_pref.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/sessions/restore_tab_helper.h" | 24 #include "chrome/browser/sessions/restore_tab_helper.h" |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 bool SessionService::RestoreIfNecessary(const std::vector<GURL>& urls_to_open, | 479 bool SessionService::RestoreIfNecessary(const std::vector<GURL>& urls_to_open, |
| 479 Browser* browser) { | 480 Browser* browser) { |
| 480 if (ShouldNewWindowStartSession()) { | 481 if (ShouldNewWindowStartSession()) { |
| 481 // We're going from no tabbed browsers to a tabbed browser (and not in | 482 // We're going from no tabbed browsers to a tabbed browser (and not in |
| 482 // process startup), restore the last session. | 483 // process startup), restore the last session. |
| 483 if (move_on_new_browser_) { | 484 if (move_on_new_browser_) { |
| 484 // Make the current session the last. | 485 // Make the current session the last. |
| 485 MoveCurrentSessionToLastSession(); | 486 MoveCurrentSessionToLastSession(); |
| 486 move_on_new_browser_ = false; | 487 move_on_new_browser_ = false; |
| 487 } | 488 } |
| 488 SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile()); | 489 SessionStartupPref pref = BrowserInit::GetSessionStartupPref( |
| 490 *CommandLine::ForCurrentProcess(), profile()); |
| 489 if (pref.type == SessionStartupPref::LAST) { | 491 if (pref.type == SessionStartupPref::LAST) { |
| 490 SessionRestore::RestoreSession( | 492 SessionRestore::RestoreSession( |
| 491 profile(), browser, | 493 profile(), browser, |
| 492 browser ? 0 : SessionRestore::ALWAYS_CREATE_TABBED_BROWSER, | 494 browser ? 0 : SessionRestore::ALWAYS_CREATE_TABBED_BROWSER, |
| 493 urls_to_open); | 495 urls_to_open); |
| 494 return true; | 496 return true; |
| 495 } | 497 } |
| 496 } | 498 } |
| 497 return false; | 499 return false; |
| 498 } | 500 } |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 50); | 1514 50); |
| 1513 if (use_long_period) { | 1515 if (use_long_period) { |
| 1514 std::string long_name_("SessionRestore.SaveLongPeriod"); | 1516 std::string long_name_("SessionRestore.SaveLongPeriod"); |
| 1515 UMA_HISTOGRAM_CUSTOM_TIMES(long_name_, | 1517 UMA_HISTOGRAM_CUSTOM_TIMES(long_name_, |
| 1516 delta, | 1518 delta, |
| 1517 save_delay_in_mins_, | 1519 save_delay_in_mins_, |
| 1518 save_delay_in_hrs_, | 1520 save_delay_in_hrs_, |
| 1519 50); | 1521 50); |
| 1520 } | 1522 } |
| 1521 } | 1523 } |
| OLD | NEW |