Chromium Code Reviews| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 #include "chrome/common/chrome_constants.h" | 63 #include "chrome/common/chrome_constants.h" |
| 64 #include "chrome/common/chrome_notification_types.h" | 64 #include "chrome/common/chrome_notification_types.h" |
| 65 #include "chrome/common/chrome_paths.h" | 65 #include "chrome/common/chrome_paths.h" |
| 66 #include "chrome/common/chrome_result_codes.h" | 66 #include "chrome/common/chrome_result_codes.h" |
| 67 #include "chrome/common/chrome_switches.h" | 67 #include "chrome/common/chrome_switches.h" |
| 68 #include "chrome/common/chrome_version_info.h" | 68 #include "chrome/common/chrome_version_info.h" |
| 69 #include "chrome/common/extensions/extension_constants.h" | 69 #include "chrome/common/extensions/extension_constants.h" |
| 70 #include "chrome/common/pref_names.h" | 70 #include "chrome/common/pref_names.h" |
| 71 #include "chrome/common/url_constants.h" | 71 #include "chrome/common/url_constants.h" |
| 72 #include "chrome/installer/util/browser_distribution.h" | 72 #include "chrome/installer/util/browser_distribution.h" |
| 73 #include "content/public/browser/browser_context.h" | |
| 73 #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" | |
| 74 #include "content/public/browser/web_contents.h" | 76 #include "content/public/browser/web_contents.h" |
| 75 #include "content/public/browser/web_contents_view.h" | 77 #include "content/public/browser/web_contents_view.h" |
| 76 #include "grit/locale_settings.h" | 78 #include "grit/locale_settings.h" |
| 77 #include "ui/base/l10n/l10n_util.h" | 79 #include "ui/base/l10n/l10n_util.h" |
| 78 #include "ui/base/resource/resource_bundle.h" | 80 #include "ui/base/resource/resource_bundle.h" |
| 79 | 81 |
| 80 #if defined(OS_MACOSX) | 82 #if defined(OS_MACOSX) |
| 81 #include "base/mac/mac_util.h" | 83 #include "base/mac/mac_util.h" |
| 82 #include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h" | 84 #include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h" |
| 83 #endif | 85 #endif |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 urls_to_open); | 573 urls_to_open); |
| 572 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 574 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
| 573 return true; | 575 return true; |
| 574 } | 576 } |
| 575 | 577 |
| 576 Browser* browser = ProcessSpecifiedURLs(urls_to_open); | 578 Browser* browser = ProcessSpecifiedURLs(urls_to_open); |
| 577 if (!browser) | 579 if (!browser) |
| 578 return false; | 580 return false; |
| 579 | 581 |
| 580 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); | 582 AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP); |
| 583 | |
| 584 // Session restore may occur if the startup preference is "last" or if the | |
| 585 // crash infobar is displayed. Otherwise, it's safe for the DOM storage system | |
| 586 // to start deleting leftover data. | |
| 587 if (pref.type != SessionStartupPref::LAST && | |
| 588 !HasPendingUncleanExit(profile_)) { | |
| 589 content::DOMStorageContext* dom_storage_context = | |
| 590 content::BrowserContext::GetDOMStorageContext(profile_); | |
| 591 dom_storage_context->StartScavengingUnusedSessionStorage(); | |
|
michaeln
2012/07/10 01:16:58
It's unfortunate there are so many places where th
marja
2012/07/10 13:40:52
Ack. The knowledge on "now we're sure that the ses
| |
| 592 } | |
| 593 | |
| 581 return true; | 594 return true; |
| 582 } | 595 } |
| 583 | 596 |
| 584 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( | 597 Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs( |
| 585 const std::vector<GURL>& urls_to_open) { | 598 const std::vector<GURL>& urls_to_open) { |
| 586 SessionStartupPref pref = | 599 SessionStartupPref pref = |
| 587 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); | 600 StartupBrowserCreator::GetSessionStartupPref(command_line_, profile_); |
| 588 StartupTabs tabs; | 601 StartupTabs tabs; |
| 589 // Pinned tabs should not be displayed when chrome is launched in incognito | 602 // Pinned tabs should not be displayed when chrome is launched in incognito |
| 590 // mode. Also, no pages should be opened automatically if the session | 603 // mode. Also, no pages should be opened automatically if the session |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 860 // New: | 873 // New: |
| 861 prefs->GetString(prefs::kHomePage), | 874 prefs->GetString(prefs::kHomePage), |
| 862 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), | 875 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), |
| 863 prefs->GetBoolean(prefs::kShowHomeButton), | 876 prefs->GetBoolean(prefs::kShowHomeButton), |
| 864 // Backup: | 877 // Backup: |
| 865 backup_homepage, | 878 backup_homepage, |
| 866 backup_homepage_is_ntp, | 879 backup_homepage_is_ntp, |
| 867 backup_show_home_button)); | 880 backup_show_home_button)); |
| 868 } | 881 } |
| 869 } | 882 } |
| OLD | NEW |