OLD | NEW |
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #include "chrome/common/chrome_notification_types.h" | 66 #include "chrome/common/chrome_notification_types.h" |
67 #include "chrome/common/chrome_paths.h" | 67 #include "chrome/common/chrome_paths.h" |
68 #include "chrome/common/chrome_result_codes.h" | 68 #include "chrome/common/chrome_result_codes.h" |
69 #include "chrome/common/chrome_switches.h" | 69 #include "chrome/common/chrome_switches.h" |
70 #include "chrome/common/chrome_version_info.h" | 70 #include "chrome/common/chrome_version_info.h" |
71 #include "chrome/common/extensions/extension_constants.h" | 71 #include "chrome/common/extensions/extension_constants.h" |
72 #include "chrome/common/pref_names.h" | 72 #include "chrome/common/pref_names.h" |
73 #include "chrome/common/url_constants.h" | 73 #include "chrome/common/url_constants.h" |
74 #include "chrome/installer/util/browser_distribution.h" | 74 #include "chrome/installer/util/browser_distribution.h" |
75 #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" |
76 #include "content/public/browser/notification_observer.h" | 77 #include "content/public/browser/notification_observer.h" |
77 #include "content/public/browser/notification_registrar.h" | 78 #include "content/public/browser/notification_registrar.h" |
78 #include "content/public/browser/web_contents.h" | 79 #include "content/public/browser/web_contents.h" |
79 #include "content/public/browser/web_contents_view.h" | 80 #include "content/public/browser/web_contents_view.h" |
80 #include "grit/locale_settings.h" | 81 #include "grit/locale_settings.h" |
81 #include "ui/base/l10n/l10n_util.h" | 82 #include "ui/base/l10n/l10n_util.h" |
82 #include "ui/base/resource/resource_bundle.h" | 83 #include "ui/base/resource/resource_bundle.h" |
83 | 84 |
84 #if defined(OS_MACOSX) | 85 #if defined(OS_MACOSX) |
85 #include "base/mac/mac_util.h" | 86 #include "base/mac/mac_util.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 urls_to_open); | 624 urls_to_open); |
624 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 625 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
625 return true; | 626 return true; |
626 } | 627 } |
627 | 628 |
628 Browser* browser = ProcessSpecifiedURLs(urls_to_open); | 629 Browser* browser = ProcessSpecifiedURLs(urls_to_open); |
629 if (!browser) | 630 if (!browser) |
630 return false; | 631 return false; |
631 | 632 |
632 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 633 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
| 634 |
| 635 // Session restore may occur if the startup preference is "last" or if the |
| 636 // crash infobar is displayed. Otherwise, it's safe for the DOM storage system |
| 637 // to start deleting leftover data. |
| 638 if (pref.type != SessionStartupPref::LAST && |
| 639 !HasPendingUncleanExit(profile_)) { |
| 640 content::BrowserContext::GetDefaultDOMStorageContext(profile_)-> |
| 641 StartScavengingUnusedSessionStorage(); |
| 642 } |
| 643 |
633 return true; | 644 return true; |
634 } | 645 } |
635 | 646 |
636 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( | 647 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( |
637 const std::vector<GURL>& urls_to_open) { | 648 const std::vector<GURL>& urls_to_open) { |
638 SessionStartupPref pref = | 649 SessionStartupPref pref = |
639 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 650 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
640 StartupTabs tabs; | 651 StartupTabs tabs; |
641 // Pinned tabs should not be displayed when chrome is launched in incognito | 652 // Pinned tabs should not be displayed when chrome is launched in incognito |
642 // mode. Also, no pages should be opened automatically if the session | 653 // mode. Also, no pages should be opened automatically if the session |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 // New: | 924 // New: |
914 prefs->GetString(prefs::kHomePage), | 925 prefs->GetString(prefs::kHomePage), |
915 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), | 926 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), |
916 prefs->GetBoolean(prefs::kShowHomeButton), | 927 prefs->GetBoolean(prefs::kShowHomeButton), |
917 // Backup: | 928 // Backup: |
918 backup_homepage, | 929 backup_homepage, |
919 backup_homepage_is_ntp, | 930 backup_homepage_is_ntp, |
920 backup_show_home_button)); | 931 backup_show_home_button)); |
921 } | 932 } |
922 } | 933 } |
OLD | NEW |