| 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/ui/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/environment.h" | 11 #include "base/environment.h" |
| 12 #include "base/event_recorder.h" | 12 #include "base/event_recorder.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/metrics/statistics_recorder.h" | 16 #include "base/metrics/statistics_recorder.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 19 #include "base/string_split.h" | 19 #include "base/string_split.h" |
| 20 #include "base/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
| 21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 22 #include "chrome/browser/auto_launch_trial.h" | 22 #include "chrome/browser/auto_launch_trial.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 24 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 25 #include "chrome/browser/defaults.h" | 25 #include "chrome/browser/defaults.h" |
| 26 #include "chrome/browser/extensions/app_restore_service.h" | |
| 27 #include "chrome/browser/extensions/app_restore_service_factory.h" | |
| 28 #include "chrome/browser/extensions/extension_creator.h" | 26 #include "chrome/browser/extensions/extension_creator.h" |
| 29 #include "chrome/browser/extensions/extension_service.h" | 27 #include "chrome/browser/extensions/extension_service.h" |
| 30 #include "chrome/browser/extensions/pack_extension_job.h" | 28 #include "chrome/browser/extensions/pack_extension_job.h" |
| 31 #include "chrome/browser/first_run/first_run.h" | 29 #include "chrome/browser/first_run/first_run.h" |
| 32 #include "chrome/browser/net/predictor.h" | 30 #include "chrome/browser/net/predictor.h" |
| 33 #include "chrome/browser/net/url_fixer_upper.h" | 31 #include "chrome/browser/net/url_fixer_upper.h" |
| 34 #include "chrome/browser/notifications/desktop_notification_service.h" | 32 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 35 #include "chrome/browser/performance_monitor/startup_timer.h" | 33 #include "chrome/browser/performance_monitor/startup_timer.h" |
| 36 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 34 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 37 #include "chrome/browser/prefs/pref_service.h" | 35 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; | 587 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; |
| 590 SessionStartupPref pref = | 588 SessionStartupPref pref = |
| 591 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 589 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
| 592 if (pref.type == SessionStartupPref::LAST) | 590 if (pref.type == SessionStartupPref::LAST) |
| 593 VLOG(1) << "Pref: last"; | 591 VLOG(1) << "Pref: last"; |
| 594 else if (pref.type == SessionStartupPref::URLS) | 592 else if (pref.type == SessionStartupPref::URLS) |
| 595 VLOG(1) << "Pref: urls"; | 593 VLOG(1) << "Pref: urls"; |
| 596 else if (pref.type == SessionStartupPref::DEFAULT) | 594 else if (pref.type == SessionStartupPref::DEFAULT) |
| 597 VLOG(1) << "Pref: default"; | 595 VLOG(1) << "Pref: default"; |
| 598 | 596 |
| 599 // The only time apps get restored is when the browser process is restarted. | |
| 600 if (StartupBrowserCreator::WasRestarted()) | |
| 601 extensions::AppRestoreServiceFactory::GetForProfile(profile_)-> | |
| 602 RestoreApps(); | |
| 603 | |
| 604 if (pref.type == SessionStartupPref::LAST) { | 597 if (pref.type == SessionStartupPref::LAST) { |
| 605 if (!profile_->DidLastSessionExitCleanly() && | 598 if (!profile_->DidLastSessionExitCleanly() && |
| 606 !command_line_.HasSwitch(switches::kRestoreLastSession)) { | 599 !command_line_.HasSwitch(switches::kRestoreLastSession)) { |
| 607 // The last session crashed. It's possible automatically loading the | 600 // The last session crashed. It's possible automatically loading the |
| 608 // page will trigger another crash, locking the user out of chrome. | 601 // page will trigger another crash, locking the user out of chrome. |
| 609 // To avoid this, don't restore on startup but instead show the crashed | 602 // To avoid this, don't restore on startup but instead show the crashed |
| 610 // infobar. | 603 // infobar. |
| 611 VLOG(1) << "Unclean exit; not processing"; | 604 VLOG(1) << "Unclean exit; not processing"; |
| 612 return false; | 605 return false; |
| 613 } | 606 } |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 // New: | 942 // New: |
| 950 prefs->GetString(prefs::kHomePage), | 943 prefs->GetString(prefs::kHomePage), |
| 951 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), | 944 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), |
| 952 prefs->GetBoolean(prefs::kShowHomeButton), | 945 prefs->GetBoolean(prefs::kShowHomeButton), |
| 953 // Backup: | 946 // Backup: |
| 954 backup_homepage, | 947 backup_homepage, |
| 955 backup_homepage_is_ntp, | 948 backup_homepage_is_ntp, |
| 956 backup_show_home_button)); | 949 backup_show_home_button)); |
| 957 } | 950 } |
| 958 } | 951 } |
| OLD | NEW |