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

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 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/child_process_security_policy.h" 74 #include "content/public/browser/child_process_security_policy.h"
75 #include "content/public/browser/dom_storage_context.h"
75 #include "content/public/browser/notification_observer.h" 76 #include "content/public/browser/notification_observer.h"
76 #include "content/public/browser/notification_registrar.h" 77 #include "content/public/browser/notification_registrar.h"
77 #include "content/public/browser/web_contents.h" 78 #include "content/public/browser/web_contents.h"
78 #include "content/public/browser/web_contents_view.h" 79 #include "content/public/browser/web_contents_view.h"
79 #include "grit/locale_settings.h" 80 #include "grit/locale_settings.h"
80 #include "ui/base/l10n/l10n_util.h" 81 #include "ui/base/l10n/l10n_util.h"
81 #include "ui/base/resource/resource_bundle.h" 82 #include "ui/base/resource/resource_bundle.h"
82 83
83 #if defined(OS_MACOSX) 84 #if defined(OS_MACOSX)
84 #include "base/mac/mac_util.h" 85 #include "base/mac/mac_util.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 urls_to_open); 613 urls_to_open);
613 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); 614 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP);
614 return true; 615 return true;
615 } 616 }
616 617
617 Browser* browser = ProcessSpecifiedURLs(urls_to_open); 618 Browser* browser = ProcessSpecifiedURLs(urls_to_open);
618 if (!browser) 619 if (!browser)
619 return false; 620 return false;
620 621
621 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); 622 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP);
623
624 // Session restore may occur if the startup preference is "last" or if the
625 // crash infobar is displayed. Otherwise, it's safe for the DOM storage system
626 // to start deleting leftover data.
627 if (pref.type != SessionStartupPref::LAST &&
628 !HasPendingUncleanExit(profile_)) {
629 content::DOMStorageContext* dom_storage_context =
Peter Kasting 2012/07/16 17:41:02 Nit: Could also inline into next line and break af
marja 2012/08/06 11:53:33 Done.
630 content::BrowserContext::GetDOMStorageContext(profile_);
631 dom_storage_context->StartScavengingUnusedSessionStorage();
632 }
633
622 return true; 634 return true;
623 } 635 }
624 636
625 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( 637 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs(
626 const std::vector<GURL>& urls_to_open) { 638 const std::vector<GURL>& urls_to_open) {
627 SessionStartupPref pref = 639 SessionStartupPref pref =
628 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); 640 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_);
629 StartupTabs tabs; 641 StartupTabs tabs;
630 // Pinned tabs should not be displayed when chrome is launched in incognito 642 // Pinned tabs should not be displayed when chrome is launched in incognito
631 // mode. Also, no pages should be opened automatically if the session 643 // 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: 913 // New:
902 prefs->GetString(prefs::kHomePage), 914 prefs->GetString(prefs::kHomePage),
903 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), 915 prefs->GetBoolean(prefs::kHomePageIsNewTabPage),
904 prefs->GetBoolean(prefs::kShowHomeButton), 916 prefs->GetBoolean(prefs::kShowHomeButton),
905 // Backup: 917 // Backup:
906 backup_homepage, 918 backup_homepage,
907 backup_homepage_is_ntp, 919 backup_homepage_is_ntp,
908 backup_show_home_button)); 920 backup_show_home_button));
909 } 921 }
910 } 922 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698