Commit 3c7c1449 authored by marja@chromium.org's avatar marja@chromium.org

Remove the effects of --disable-restore-session-state.

The "Better Session Restore" features have been on by default for quite a while,
and there are no known problems.

This CL removes the effects of --disable-restore-session-state but keeps the
flag and the about:flags flag in place. New experimental features are ready to be
enabled by default, and this flag will be used again to disable them.

BUG=116947


Review URL: https://chromiumcodereview.appspot.com/10855022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150541 0039d316-1c4b-4281-b951-d872f2087c98
parent d0af207c
......@@ -242,13 +242,10 @@ void AttemptUserExit() {
}
void AttemptRestart() {
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableRestoreSessionState)) {
// TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead?
BrowserList::const_iterator it;
for (it = BrowserList::begin(); it != BrowserList::end(); ++it)
content::BrowserContext::SaveSessionState((*it)->profile());
}
// TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead?
BrowserList::const_iterator it;
for (it = BrowserList::begin(); it != BrowserList::end(); ++it)
content::BrowserContext::SaveSessionState((*it)->profile());
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kWasRestarted, true);
......
......@@ -263,8 +263,7 @@ ProfileImpl::ProfileImpl(const FilePath& path,
favicon_service_created_(false),
start_time_(Time::Now()),
delegate_(delegate),
predictor_(NULL),
session_restore_enabled_(false) {
predictor_(NULL) {
DCHECK(!path.empty()) << "Using an empty path will attempt to write " <<
"profile files to the root directory!";
......@@ -281,8 +280,6 @@ ProfileImpl::ProfileImpl(const FilePath& path,
!command_line->HasSwitch(switches::kDisablePreconnect),
g_browser_process->profile_manager() == NULL);
session_restore_enabled_ =
!command_line->HasSwitch(switches::kDisableRestoreSessionState);
#if defined(ENABLE_CONFIGURATION_POLICY)
// TODO(atwilson): Change these to ProfileKeyedServices once PrefService is
// a ProfileKeyedService (policy must be initialized before PrefService
......@@ -407,7 +404,6 @@ void ProfileImpl::DoFinalInit(bool is_new_profile) {
*CommandLine::ForCurrentProcess(), this).type;
#endif
bool restore_old_session_cookies =
session_restore_enabled_ &&
(!DidLastSessionExitCleanly() ||
startup_pref_type == SessionStartupPref::LAST);
......
......@@ -256,8 +256,6 @@ class ProfileImpl : public Profile,
chrome_browser_net::Predictor* predictor_;
bool session_restore_enabled_;
DISALLOW_COPY_AND_ASSIGN(ProfileImpl);
};
......
......@@ -357,8 +357,7 @@ void ProfileImplIOData::LazyInitializeInternal(
cookie_store =
new net::CookieMonster(cookie_db.get(),
profile_params->cookie_monster_delegate);
if (!command_line.HasSwitch(switches::kDisableRestoreSessionState))
cookie_store->GetCookieMonster()->SetPersistSessionCookies(true);
cookie_store->GetCookieMonster()->SetPersistSessionCookies(true);
}
net::CookieMonster* extensions_cookie_store =
......
......@@ -75,14 +75,10 @@ BaseSessionService::BaseSessionService(SessionType type,
: profile_(profile),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
pending_reset_(false),
commands_since_reset_(0),
save_post_data_(false) {
commands_since_reset_(0) {
if (profile) {
// We should never be created when incognito.
DCHECK(!profile->IsOffTheRecord());
const CommandLine* command_line = CommandLine::ForCurrentProcess();
save_post_data_ =
!command_line->HasSwitch(switches::kDisableRestoreSessionState);
}
backend_ = new SessionBackend(type, profile_ ? profile_->GetPath() : path);
DCHECK(backend_.get());
......@@ -175,13 +171,8 @@ SessionCommand* BaseSessionService::CreateUpdateTabNavigationCommand(
std::string content_state = entry.GetContentState();
if (entry.GetHasPostData()) {
if (save_post_data_) {
content_state =
webkit_glue::RemovePasswordDataFromHistoryState(content_state);
} else {
content_state =
webkit_glue::RemoveFormDataFromHistoryState(content_state);
}
content_state =
webkit_glue::RemovePasswordDataFromHistoryState(content_state);
}
WriteStringToPickle(pickle, &bytes_written, max_state_size, content_state);
......
......@@ -189,10 +189,6 @@ class BaseSessionService : public CancelableRequestProvider,
static const int max_persist_navigation_count;
private:
FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, KeepPostDataWithoutPasswords);
FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RemovePostData);
FRIEND_TEST_ALL_PREFIXES(SessionServiceTest, RemovePostDataWithPasswords);
// The profile. This may be null during testing.
Profile* profile_;
......@@ -212,9 +208,6 @@ class BaseSessionService : public CancelableRequestProvider,
// The number of commands sent to the backend before doing a reset.
int commands_since_reset_;
// Whether to save the HTTP bodies of the POST requests.
bool save_post_data_;
DISALLOW_COPY_AND_ASSIGN(BaseSessionService);
};
......
......@@ -769,44 +769,7 @@ TEST_F(SessionServiceTest, DontPersistDefault) {
EXPECT_EQ(ui::SHOW_STATE_NORMAL, windows[0]->show_state);
}
TEST_F(SessionServiceTest, RemovePostData) {
helper_.service()->save_post_data_ = false;
SessionID tab_id;
ASSERT_NE(window_id.id(), tab_id.id());
std::string content_state("dummy_content_state");
// Create a TabNavigation containing content_state and representing a POST
// request.
TabNavigation nav1(0, GURL("http://google.com"), content::Referrer(),
ASCIIToUTF16("title"), content_state,
content::PAGE_TRANSITION_QUALIFIER_MASK);
nav1.set_type_mask(TabNavigation::HAS_POST_DATA);
// Create a TabNavigation containing content_state and representing a normal
// request.
TabNavigation nav2(0, GURL("http://google.com/nopost"), content::Referrer(),
ASCIIToUTF16("title"), content_state,
content::PAGE_TRANSITION_QUALIFIER_MASK);
helper_.PrepareTabInWindow(window_id, tab_id, 0, true);
UpdateNavigation(window_id, tab_id, nav1, 0, true);
UpdateNavigation(window_id, tab_id, nav2, 1, true);
ScopedVector<SessionWindow> windows;
ReadWindows(&(windows.get()));
helper_.AssertSingleWindowWithSingleTab(windows.get(), 2);
// Expected: the HTTP body was removed from the content state of the POST
// navigation but the content state of the normal navigation is intact.
EXPECT_NE(content_state, windows[0]->tabs[0]->navigations[0].state());
helper_.AssertNavigationEquals(nav2, windows[0]->tabs[0]->navigations[1]);
}
TEST_F(SessionServiceTest, KeepPostDataWithoutPasswords) {
helper_.service()->save_post_data_ = true;
SessionID tab_id;
ASSERT_NE(window_id.id(), tab_id.id());
......@@ -848,8 +811,6 @@ TEST_F(SessionServiceTest, KeepPostDataWithoutPasswords) {
}
TEST_F(SessionServiceTest, RemovePostDataWithPasswords) {
helper_.service()->save_post_data_ = true;
SessionID tab_id;
ASSERT_NE(window_id.id(), tab_id.id());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment