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

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

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review & fixes. Created 8 years, 5 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/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "chrome/common/chrome_constants.h" 64 #include "chrome/common/chrome_constants.h"
65 #include "chrome/common/chrome_notification_types.h" 65 #include "chrome/common/chrome_notification_types.h"
66 #include "chrome/common/chrome_paths.h" 66 #include "chrome/common/chrome_paths.h"
67 #include "chrome/common/chrome_result_codes.h" 67 #include "chrome/common/chrome_result_codes.h"
68 #include "chrome/common/chrome_switches.h" 68 #include "chrome/common/chrome_switches.h"
69 #include "chrome/common/chrome_version_info.h" 69 #include "chrome/common/chrome_version_info.h"
70 #include "chrome/common/extensions/extension_constants.h" 70 #include "chrome/common/extensions/extension_constants.h"
71 #include "chrome/common/pref_names.h" 71 #include "chrome/common/pref_names.h"
72 #include "chrome/common/url_constants.h" 72 #include "chrome/common/url_constants.h"
73 #include "chrome/installer/util/browser_distribution.h" 73 #include "chrome/installer/util/browser_distribution.h"
74 #include "content/public/browser/browser_context.h"
jam 2012/07/11 15:51:35 nit: ditto
marja 2012/07/12 09:22:03 Done.
74 #include "content/public/browser/child_process_security_policy.h" 75 #include "content/public/browser/child_process_security_policy.h"
76 #include "content/public/browser/dom_storage_context.h"
75 #include "content/public/browser/notification_observer.h" 77 #include "content/public/browser/notification_observer.h"
76 #include "content/public/browser/notification_registrar.h" 78 #include "content/public/browser/notification_registrar.h"
77 #include "content/public/browser/web_contents.h" 79 #include "content/public/browser/web_contents.h"
78 #include "content/public/browser/web_contents_view.h" 80 #include "content/public/browser/web_contents_view.h"
79 #include "grit/locale_settings.h" 81 #include "grit/locale_settings.h"
80 #include "ui/base/l10n/l10n_util.h" 82 #include "ui/base/l10n/l10n_util.h"
81 #include "ui/base/resource/resource_bundle.h" 83 #include "ui/base/resource/resource_bundle.h"
82 84
83 #if defined(OS_MACOSX) 85 #if defined(OS_MACOSX)
84 #include "base/mac/mac_util.h" 86 #include "base/mac/mac_util.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 urls_to_open); 614 urls_to_open);
613 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); 615 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP);
614 return true; 616 return true;
615 } 617 }
616 618
617 Browser* browser = ProcessSpecifiedURLs(urls_to_open); 619 Browser* browser = ProcessSpecifiedURLs(urls_to_open);
618 if (!browser) 620 if (!browser)
619 return false; 621 return false;
620 622
621 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); 623 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP);
624
625 // Session restore may occur if the startup preference is "last" or if the
626 // crash infobar is displayed. Otherwise, it's safe for the DOM storage system
627 // to start deleting leftover data.
628 if (pref.type != SessionStartupPref::LAST &&
629 !HasPendingUncleanExit(profile_)) {
630 content::DOMStorageContext* dom_storage_context =
631 content::BrowserContext::GetDOMStorageContext(profile_);
632 dom_storage_context->StartScavengingUnusedSessionStorage();
633 }
634
622 return true; 635 return true;
623 } 636 }
624 637
625 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( 638 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs(
626 const std::vector<GURL>& urls_to_open) { 639 const std::vector<GURL>& urls_to_open) {
627 SessionStartupPref pref = 640 SessionStartupPref pref =
628 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); 641 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_);
629 StartupTabs tabs; 642 StartupTabs tabs;
630 // Pinned tabs should not be displayed when chrome is launched in incognito 643 // Pinned tabs should not be displayed when chrome is launched in incognito
631 // mode. Also, no pages should be opened automatically if the session 644 // mode. Also, no pages should be opened automatically if the session
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 // New: 914 // New:
902 prefs->GetString(prefs::kHomePage), 915 prefs->GetString(prefs::kHomePage),
903 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), 916 prefs->GetBoolean(prefs::kHomePageIsNewTabPage),
904 prefs->GetBoolean(prefs::kShowHomeButton), 917 prefs->GetBoolean(prefs::kShowHomeButton),
905 // Backup: 918 // Backup:
906 backup_homepage, 919 backup_homepage,
907 backup_homepage_is_ntp, 920 backup_homepage_is_ntp,
908 backup_show_home_button)); 921 backup_show_home_button));
909 } 922 }
910 } 923 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698