Fix crash when using Instant.

Steps to reproduce (on Mac OS, with Chrome Instant enabled):
1. On the NTP, type a partial query (without hitting Enter).
2. After the results preview appears, hit Alt-Enter to open it in a new
   foreground tab.
3. Without doing anything else, close the tab. The previous NTP tab is
   now the active tab again.
4. Type another partial query.
--> Previously, this would crash. This CL fixes the crash.

The root cause is that, after step 2, previewContents_ still referred to
the now committed tab. So, when that tab disappears in step 3,
previewContents_ is left dangling, causing the crash in step 4.

The bug was caused by my earlier CL (http://crrev.com/158613), which
removed the HideInstant() call that we made after every Instant commit.
HideInstant() nulls out previewContents_, which is why this crash
surfaced after that call was removed. Instead of just putting back
HideInstant(), I think the right thing to do is to adjust
previewContents_, in much the same way that
MakePreviewContentsActiveContents() does in the views UI code.

BUG=153902
R=sky@chromium.org
TEST=See steps above.


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160433 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed