Fix some UI issues with omnibox extensions in incognito.

Also moved a shared method from ExtensionEventRouter to ExtensionsService.

BUG=58210
TEST=Install the extension in chrome/common/extensions/docs/examples/extensions/chrome_search. You should not see the UI artifacts described in the bug.

Review URL: http://codereview.chromium.org/4234004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64964 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 98681de..734bdef 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -1336,6 +1336,13 @@
   }
 }
 
+bool ExtensionsService::CanCrossIncognito(const Extension* extension) {
+  // We allow the extension to see events and data from another profile iff it
+  // uses "spanning" behavior and it has incognito access. "split" mode
+  // extensions only see events for a matching profile.
+  return IsIncognitoEnabled(extension) && !extension->incognito_split_mode();
+}
+
 bool ExtensionsService::AllowFileAccess(const Extension* extension) {
   return (CommandLine::ForCurrentProcess()->HasSwitch(
               switches::kDisableExtensionsFileAccessCheck) ||