Update viewport_meta setting on any navigation.

In http://crrev.com/1785953002 I tied a setting to the
is_overriding_user_agent property of NavigationEntry, but I forgot to
keep the preference updated during arbitrary navigation entry changes
(e.g. back button).

BUG=671580
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2619063003
Cr-Commit-Position: refs/heads/master@{#443399}
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 06c2fb1..8b528d0 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -803,9 +803,14 @@
   is_initial_navigation_ = false;
 
   // Save the previous state before we clobber it.
+  bool overriding_user_agent_changed = false;
   if (GetLastCommittedEntry()) {
     details->previous_url = GetLastCommittedEntry()->GetURL();
     details->previous_entry_index = GetLastCommittedEntryIndex();
+    if (pending_entry_ &&
+        pending_entry_->GetIsOverridingUserAgent() !=
+            GetLastCommittedEntry()->GetIsOverridingUserAgent())
+      overriding_user_agent_changed = true;
   } else {
     details->previous_url = GURL();
     details->previous_entry_index = -1;
@@ -953,6 +958,9 @@
 
   NotifyNavigationEntryCommitted(details);
 
+  if (overriding_user_agent_changed)
+    delegate_->UpdateOverridingUserAgent();
+
   // Update the nav_entry_id for each RenderFrameHost in the tree, so that each
   // one knows the latest NavigationEntry it is showing (whether it has
   // committed anything in this navigation or not). This allows things like