Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6027)

Unified Diff: chrome/browser/sessions/tab_restore_service.cc

Issue 10170016: Add info about user agent overrides to WebContents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Forgot to initialize bool in constructor; win_rel caught it Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sessions/tab_restore_service.h ('k') | content/browser/web_contents/navigation_entry_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/browser/sessions/tab_restore_service.h ('k') | content/browser/web_contents/navigation_entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698