| Index: chrome/browser/sessions/tab_restore_service.cc
|
| diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc
|
| index 701b0a30db928c720aa4b1c22b32121937709d97..7d660339af2ed6f65e7ae0e5c466f797e754a7e5 100644
|
| --- a/chrome/browser/sessions/tab_restore_service.cc
|
| +++ b/chrome/browser/sessions/tab_restore_service.cc
|
| @@ -68,7 +68,8 @@ const size_t TabRestoreService::kMaxEntries = 25;
|
| // . When the user closes a tab a command of type
|
| // kCommandSelectedNavigationInTab is written identifying the tab and
|
| // the selected index, then a kCommandPinnedState command if the tab was
|
| -// pinned and kCommandSetExtensionAppID if the tab has an app id. This is
|
| +// pinned and kCommandSetExtensionAppID if the tab has an app id and
|
| +// the user agent override if it was using one. This is
|
| // followed by any number of kCommandUpdateTabNavigation commands (1 per
|
| // navigation entry).
|
| // . When the user closes a window a kCommandSelectedNavigationInTab command
|
| @@ -83,6 +84,7 @@ static const SessionCommand::id_type kCommandSelectedNavigationInTab = 4;
|
| static const SessionCommand::id_type kCommandPinnedState = 5;
|
| static const SessionCommand::id_type kCommandSetExtensionAppID = 6;
|
| static const SessionCommand::id_type kCommandSetWindowAppName = 7;
|
| +static const SessionCommand::id_type kCommandSetTabUserAgentOverride = 8;
|
|
|
| // Number of entries (not commands) before we clobber the file and write
|
| // everything.
|
| @@ -686,6 +688,12 @@ void TabRestoreService::ScheduleCommandsForTab(const Tab& tab,
|
| tab.extension_app_id));
|
| }
|
|
|
| + if (!tab.user_agent_override.empty()) {
|
| + ScheduleCommand(
|
| + CreateSetTabUserAgentOverrideCommand(kCommandSetTabUserAgentOverride,
|
| + tab.id, tab.user_agent_override));
|
| + }
|
| +
|
| // Then write the navigations.
|
| for (int i = first_index_to_persist, wrote_count = 0;
|
| i < max_index && wrote_count < 2 * max_persist_navigation_count; ++i) {
|
| @@ -948,6 +956,21 @@ void TabRestoreService::CreateEntriesFromCommands(
|
| break;
|
| }
|
|
|
| + case kCommandSetTabUserAgentOverride: {
|
| + if (!current_tab) {
|
| + // Should be in a tab when we get this.
|
| + return;
|
| + }
|
| + SessionID::id_type tab_id;
|
| + std::string user_agent_override;
|
| + if (!RestoreSetTabUserAgentOverrideCommand(command, &tab_id,
|
| + &user_agent_override)) {
|
| + return;
|
| + }
|
| + current_tab->user_agent_override.swap(user_agent_override);
|
| + break;
|
| + }
|
| +
|
| default:
|
| // Unknown type, usually indicates corruption of file. Ignore it.
|
| return;
|
|
|