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

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

Issue 11143034: Prevent app restore from happening on restart when user is in incognito mode. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 SessionStartupPref pref = 636 SessionStartupPref pref =
637 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); 637 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_);
638 if (pref.type == SessionStartupPref::LAST) 638 if (pref.type == SessionStartupPref::LAST)
639 VLOG(1) << "Pref: last"; 639 VLOG(1) << "Pref: last";
640 else if (pref.type == SessionStartupPref::URLS) 640 else if (pref.type == SessionStartupPref::URLS)
641 VLOG(1) << "Pref: urls"; 641 VLOG(1) << "Pref: urls";
642 else if (pref.type == SessionStartupPref::DEFAULT) 642 else if (pref.type == SessionStartupPref::DEFAULT)
643 VLOG(1) << "Pref: default"; 643 VLOG(1) << "Pref: default";
644 644
645 // The only time apps get restored is when the browser process is restarted. 645 // The only time apps get restored is when the browser process is restarted.
646 if (StartupBrowserCreator::WasRestarted()) 646 if (StartupBrowserCreator::WasRestarted()) {
647 extensions::AppRestoreServiceFactory::GetForProfile(profile_)-> 647 extensions::AppRestoreService* service =
648 RestoreApps(); 648 extensions::AppRestoreServiceFactory::GetForProfile(profile_);
649 // NULL in incognito mode.
650 if (service)
651 service->RestoreApps();
652 }
649 653
650 if (pref.type == SessionStartupPref::LAST) { 654 if (pref.type == SessionStartupPref::LAST) {
651 if (profile_->GetLastSessionExitType() == Profile::EXIT_CRASHED && 655 if (profile_->GetLastSessionExitType() == Profile::EXIT_CRASHED &&
652 !command_line_.HasSwitch(switches::kRestoreLastSession)) { 656 !command_line_.HasSwitch(switches::kRestoreLastSession)) {
653 // The last session crashed. It's possible automatically loading the 657 // The last session crashed. It's possible automatically loading the
654 // page will trigger another crash, locking the user out of chrome. 658 // page will trigger another crash, locking the user out of chrome.
655 // To avoid this, don't restore on startup but instead show the crashed 659 // To avoid this, don't restore on startup but instead show the crashed
656 // infobar. 660 // infobar.
657 VLOG(1) << "Unclean exit; not processing"; 661 VLOG(1) << "Unclean exit; not processing";
658 return false; 662 return false;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 // New: 1030 // New:
1027 prefs->GetString(prefs::kHomePage), 1031 prefs->GetString(prefs::kHomePage),
1028 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), 1032 prefs->GetBoolean(prefs::kHomePageIsNewTabPage),
1029 prefs->GetBoolean(prefs::kShowHomeButton), 1033 prefs->GetBoolean(prefs::kShowHomeButton),
1030 // Backup: 1034 // Backup:
1031 backup_homepage, 1035 backup_homepage,
1032 backup_homepage_is_ntp, 1036 backup_homepage_is_ntp,
1033 backup_show_home_button)); 1037 backup_show_home_button));
1034 } 1038 }
1035 } 1039 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698