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

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: session only rules 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "chrome/common/chrome_constants.h" 61 #include "chrome/common/chrome_constants.h"
62 #include "chrome/common/chrome_notification_types.h" 62 #include "chrome/common/chrome_notification_types.h"
63 #include "chrome/common/chrome_paths.h" 63 #include "chrome/common/chrome_paths.h"
64 #include "chrome/common/chrome_result_codes.h" 64 #include "chrome/common/chrome_result_codes.h"
65 #include "chrome/common/chrome_switches.h" 65 #include "chrome/common/chrome_switches.h"
66 #include "chrome/common/chrome_version_info.h" 66 #include "chrome/common/chrome_version_info.h"
67 #include "chrome/common/extensions/extension_constants.h" 67 #include "chrome/common/extensions/extension_constants.h"
68 #include "chrome/common/pref_names.h" 68 #include "chrome/common/pref_names.h"
69 #include "chrome/common/url_constants.h" 69 #include "chrome/common/url_constants.h"
70 #include "chrome/installer/util/browser_distribution.h" 70 #include "chrome/installer/util/browser_distribution.h"
71 #include "content/public/browser/browser_context.h"
71 #include "content/public/browser/child_process_security_policy.h" 72 #include "content/public/browser/child_process_security_policy.h"
73 #include "content/public/browser/dom_storage_context.h"
72 #include "content/public/browser/web_contents.h" 74 #include "content/public/browser/web_contents.h"
73 #include "content/public/browser/web_contents_view.h" 75 #include "content/public/browser/web_contents_view.h"
74 #include "grit/locale_settings.h" 76 #include "grit/locale_settings.h"
75 #include "ui/base/l10n/l10n_util.h" 77 #include "ui/base/l10n/l10n_util.h"
76 #include "ui/base/resource/resource_bundle.h" 78 #include "ui/base/resource/resource_bundle.h"
77 79
78 #if defined(OS_MACOSX) 80 #if defined(OS_MACOSX)
79 #include "base/mac/mac_util.h" 81 #include "base/mac/mac_util.h"
80 #include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h" 82 #include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h"
81 #endif 83 #endif
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 urls_to_open); 558 urls_to_open);
557 AddInfoBarsIfNecessary(browser, browser::startup::IS_PROCESS_STARTUP); 559 AddInfoBarsIfNecessary(browser, browser::startup::IS_PROCESS_STARTUP);
558 return true; 560 return true;
559 } 561 }
560 562
561 Browser* browser = ProcessSpecifiedURLs(urls_to_open); 563 Browser* browser = ProcessSpecifiedURLs(urls_to_open);
562 if (!browser) 564 if (!browser)
563 return false; 565 return false;
564 566
565 AddInfoBarsIfNecessary(browser, browser::startup::IS_PROCESS_STARTUP); 567 AddInfoBarsIfNecessary(browser, browser::startup::IS_PROCESS_STARTUP);
568
569 // Session restore may occur if the startup preference is "last" or if the
570 // crash infobar is displayed. Otherwise, it's safe for the DOM storage system
571 // to start deleting leftover data.
572 if (pref.type != SessionStartupPref::LAST &&
573 !HasPendingUncleanExit(profile_)) {
574 content::DOMStorageContext* dom_storage_context =
575 content::BrowserContext::GetDOMStorageContext(profile_);
576 dom_storage_context->StartScavengingUnusedSessionStorage();
577 }
578
566 return true; 579 return true;
567 } 580 }
568 581
569 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( 582 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs(
570 const std::vector<GURL>& urls_to_open) { 583 const std::vector<GURL>& urls_to_open) {
571 SessionStartupPref pref = 584 SessionStartupPref pref =
572 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); 585 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_);
573 StartupTabs tabs; 586 StartupTabs tabs;
574 // Pinned tabs should not be displayed when chrome is launched in incognito 587 // Pinned tabs should not be displayed when chrome is launched in incognito
575 // mode. Also, no pages should be opened automatically if the session 588 // mode. Also, no pages should be opened automatically if the session
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 // New: 860 // New:
848 prefs->GetString(prefs::kHomePage), 861 prefs->GetString(prefs::kHomePage),
849 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), 862 prefs->GetBoolean(prefs::kHomePageIsNewTabPage),
850 prefs->GetBoolean(prefs::kShowHomeButton), 863 prefs->GetBoolean(prefs::kShowHomeButton),
851 // Backup: 864 // Backup:
852 backup_homepage, 865 backup_homepage,
853 backup_homepage_is_ntp, 866 backup_homepage_is_ntp,
854 backup_show_home_button)); 867 backup_show_home_button));
855 } 868 }
856 } 869 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698