summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-31 01:54:59 +0000
committermarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-31 01:54:59 +0000
commitf24bd1743a1706aa32851cbcc981cda616906921 (patch)
tree26bbe16feb2687e023eb33e49530a1c3172ce6c3 /chrome
parent98618ad4a4939b5905e83a8e302c565a6ff32754 (diff)
downloadchromium_src-f24bd1743a1706aa32851cbcc981cda616906921.zip
chromium_src-f24bd1743a1706aa32851cbcc981cda616906921.tar.gz
chromium_src-f24bd1743a1706aa32851cbcc981cda616906921.tar.bz2
Honor the "clear on exit" setting even if "continue where I left off" is selected.
This also cancels the session restore UI changes except renaming the "reopen last pages" to "continue where I left off". BUG=121072 TEST=Manual Review URL: http://codereview.chromium.org/9965012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chrome_content_browser_client.cc12
-rw-r--r--chrome/browser/profiles/profile_impl.cc12
-rw-r--r--chrome/browser/profiles/profile_io_data.h1
-rw-r--r--chrome/browser/resources/options2/browser_options.js7
-rw-r--r--chrome/browser/resources/options2/startup_section.html6
-rw-r--r--chrome/browser/ui/webui/options2/content_settings_handler2.cc6
6 files changed, 16 insertions, 28 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 69969fd..40df6d2 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -911,17 +911,7 @@ bool ChromeContentBrowserClient::AllowSaveLocalState(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
- if (!io_data->clear_local_state_on_exit()->GetValue())
- return true;
-
- // Disable clearing the local state on exit if the browsing session is going
- // to be restored on the next startup.
- SessionStartupPref::Type startup_pref =
- SessionStartupPref::PrefValueToType(
- io_data->session_startup_pref()->GetValue());
- return (startup_pref == SessionStartupPref::LAST &&
- !CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableRestoreSessionState));
+ return !io_data->clear_local_state_on_exit()->GetValue();
}
bool ChromeContentBrowserClient::AllowWorkerDatabase(
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 0c89433..772a068 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -560,15 +560,13 @@ ProfileImpl::~ProfileImpl() {
chrome::NOTIFICATION_PROFILE_DESTROYED,
content::Source<Profile>(this),
content::NotificationService::NoDetails());
- // Save the session state if we're going to restore the session during the
- // next startup.
SessionStartupPref pref = SessionStartupPref::GetStartupPref(this);
- if (pref.type == SessionStartupPref::LAST) {
- if (session_restore_enabled_)
- BrowserContext::SaveSessionState(this);
- } else if (clear_local_state_on_exit_) {
+ // Honor the "clear local state" setting. If it's not set, keep the session
+ // data if we're going to continue the session upon startup.
+ if (clear_local_state_on_exit_)
BrowserContext::ClearLocalOnDestruction(this);
- }
+ else if (session_restore_enabled_ && pref.type == SessionStartupPref::LAST)
+ BrowserContext::SaveSessionState(this);
StopCreateSessionServiceTimer();
diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h
index 4cafe09..6f16863 100644
--- a/chrome/browser/profiles/profile_io_data.h
+++ b/chrome/browser/profiles/profile_io_data.h
@@ -264,6 +264,7 @@ class ProfileIOData {
mutable BooleanPrefMember enable_referrers_;
mutable BooleanPrefMember clear_local_state_on_exit_;
mutable BooleanPrefMember safe_browsing_enabled_;
+ // TODO(marja): Remove session_startup_pref_ if no longer needed.
mutable IntegerPrefMember session_startup_pref_;
// Pointed to by NetworkDelegate.
diff --git a/chrome/browser/resources/options2/browser_options.js b/chrome/browser/resources/options2/browser_options.js
index 81b4551..0f8b6d3 100644
--- a/chrome/browser/resources/options2/browser_options.js
+++ b/chrome/browser/resources/options2/browser_options.js
@@ -107,10 +107,13 @@ cr.define('options', function() {
};
// Session restore.
+ // TODO(marja): clean up the options UI after the decision on the session
+ // restore changes has stabilized. For now, only the startup option is
+ // renamed to "continue where I left off", but the session related content
+ // settings are not disabled or overridden (because
+ // templateData.enable_restore_session_state is forced to false).
this.sessionRestoreEnabled_ = templateData.enable_restore_session_state;
if (this.sessionRestoreEnabled_) {
- $('old-startup-last-text').hidden = true;
- $('new-startup-last-text').hidden = false;
$('startup-restore-session').onchange = function(event) {
if (!BrowserOptions.getInstance().maybeShowSessionRestoreDialog_()) {
// The dialog is not shown; handle the event normally.
diff --git a/chrome/browser/resources/options2/startup_section.html b/chrome/browser/resources/options2/startup_section.html
index efc15ac..c023b09 100644
--- a/chrome/browser/resources/options2/startup_section.html
+++ b/chrome/browser/resources/options2/startup_section.html
@@ -14,11 +14,7 @@
<input id="startup-restore-session" type="radio" name="startup"
value="1" pref="session.restore_on_startup"
metric="Options_Startup_LastSession">
- <span id="old-startup-last-text"
- i18n-content="startupShowLastSession">
- </span>
- <span id="new-startup-last-text"
- i18n-content="startupRestoreLastSession" hidden>
+ <span i18n-content="startupRestoreLastSession">
</span>
</label>
</div>
diff --git a/chrome/browser/ui/webui/options2/content_settings_handler2.cc b/chrome/browser/ui/webui/options2/content_settings_handler2.cc
index 17fda03..2db3de7 100644
--- a/chrome/browser/ui/webui/options2/content_settings_handler2.cc
+++ b/chrome/browser/ui/webui/options2/content_settings_handler2.cc
@@ -287,10 +287,10 @@ void ContentSettingsHandler::GetLocalizedValues(
IDS_CONTENT_SETTINGS_TITLE);
localized_strings->SetBoolean("enable_web_intents",
web_intents::IsWebIntentsEnabled());
+ // TODO(marja): clean up the options UI after the decision on the session
+ // restore changes has stabilized.
localized_strings->SetBoolean(
- "enable_restore_session_state",
- !CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableRestoreSessionState));
+ "enable_restore_session_state", false);
}
void ContentSettingsHandler::InitializeHandler() {