Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 10875027: Restart running apps when chrome restarts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
26 #include "chrome/browser/extensions/extension_creator.h" 28 #include "chrome/browser/extensions/extension_creator.h"
27 #include "chrome/browser/extensions/extension_service.h" 29 #include "chrome/browser/extensions/extension_service.h"
28 #include "chrome/browser/extensions/pack_extension_job.h" 30 #include "chrome/browser/extensions/pack_extension_job.h"
29 #include "chrome/browser/first_run/first_run.h" 31 #include "chrome/browser/first_run/first_run.h"
30 #include "chrome/browser/net/predictor.h" 32 #include "chrome/browser/net/predictor.h"
31 #include "chrome/browser/net/url_fixer_upper.h" 33 #include "chrome/browser/net/url_fixer_upper.h"
32 #include "chrome/browser/notifications/desktop_notification_service.h" 34 #include "chrome/browser/notifications/desktop_notification_service.h"
33 #include "chrome/browser/performance_monitor/startup_timer.h" 35 #include "chrome/browser/performance_monitor/startup_timer.h"
34 #include "chrome/browser/prefs/incognito_mode_prefs.h" 36 #include "chrome/browser/prefs/incognito_mode_prefs.h"
35 #include "chrome/browser/prefs/pref_service.h" 37 #include "chrome/browser/prefs/pref_service.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs"; 593 VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs";
592 SessionStartupPref pref = 594 SessionStartupPref pref =
593 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); 595 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_);
594 if (pref.type == SessionStartupPref::LAST) 596 if (pref.type == SessionStartupPref::LAST)
595 VLOG(1) << "Pref: last"; 597 VLOG(1) << "Pref: last";
596 else if (pref.type == SessionStartupPref::URLS) 598 else if (pref.type == SessionStartupPref::URLS)
597 VLOG(1) << "Pref: urls"; 599 VLOG(1) << "Pref: urls";
598 else if (pref.type == SessionStartupPref::DEFAULT) 600 else if (pref.type == SessionStartupPref::DEFAULT)
599 VLOG(1) << "Pref: default"; 601 VLOG(1) << "Pref: default";
600 602
603 // The only time apps get restored is when the browser process is restarted.
604 if (StartupBrowserCreator::WasRestarted())
605 extensions::AppRestoreServiceFactory::GetForProfile(profile_)->
606 RestoreApps();
607
601 if (pref.type == SessionStartupPref::LAST) { 608 if (pref.type == SessionStartupPref::LAST) {
602 if (!profile_->DidLastSessionExitCleanly() && 609 if (!profile_->DidLastSessionExitCleanly() &&
603 !command_line_.HasSwitch(switches::kRestoreLastSession)) { 610 !command_line_.HasSwitch(switches::kRestoreLastSession)) {
604 // The last session crashed. It's possible automatically loading the 611 // The last session crashed. It's possible automatically loading the
605 // page will trigger another crash, locking the user out of chrome. 612 // page will trigger another crash, locking the user out of chrome.
606 // To avoid this, don't restore on startup but instead show the crashed 613 // To avoid this, don't restore on startup but instead show the crashed
607 // infobar. 614 // infobar.
608 VLOG(1) << "Unclean exit; not processing"; 615 VLOG(1) << "Unclean exit; not processing";
609 return false; 616 return false;
610 } 617 }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 // New: 948 // New:
942 prefs->GetString(prefs::kHomePage), 949 prefs->GetString(prefs::kHomePage),
943 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), 950 prefs->GetBoolean(prefs::kHomePageIsNewTabPage),
944 prefs->GetBoolean(prefs::kShowHomeButton), 951 prefs->GetBoolean(prefs::kShowHomeButton),
945 // Backup: 952 // Backup:
946 backup_homepage, 953 backup_homepage,
947 backup_homepage_is_ntp, 954 backup_homepage_is_ntp,
948 backup_show_home_button)); 955 backup_show_home_button));
949 } 956 }
950 } 957 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698