InstantExtended: add support for turning on with only local resources.

This change adds a new command-line flag (--enable-local-instant-extended-api)
and a new field trial (local_only:1), either of which will turn on
InstantExtended using only the local NTP and omnibox popup. Either flag, if
specified, will override the existing InstantExtended flags.

Also, fixes two small bugs with the local NTP:\

(1) Don't "switch" to the local NTP if we're already using the local NTP.
    Otherwise in |local_overlay_only| mode, we unnecessarily reload the
    local NTP twice.

(2) Explicitly check for incognito when deciding to wire up InstantTab instead
    of just inferring it from use_local_overlay_only_. Otherwise, the local NTP
    is not wired up as an InstantTab.
    (Besides fixing the bug, this seems generally safer since it makes the
     case when we don't want to wire up the InstantTab explicit.)


BUG=none
TESTED=InstantExtendedTest.*,InstantExtendedAPIEnabledTest.*

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194081 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc
index f97fb03..93db0dc 100644
--- a/chrome/browser/ui/browser_instant_controller.cc
+++ b/chrome/browser/ui/browser_instant_controller.cc
@@ -231,6 +231,7 @@
 
   bool instant_pref_enabled = chrome::IsInstantPrefEnabled(profile());
   bool use_local_overlay_only = profile()->IsOffTheRecord() ||
+      chrome::IsLocalOnlyInstantExtendedAPIEnabled() ||
       (!instant_pref_enabled &&
        !profile()->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled));
   instant_.SetInstantEnabled(instant_pref_enabled, use_local_overlay_only);