More correct window focus changes for multi-profile and incognito.

Multi-profile: treat windows from other profiles as WINDOW_ID_NONE.

Incognito: on switching between default/OTR profile windows, send WINDOW_ID_NONE to the extensions that can't see the new window.

Also make ExtensionBrowserEventRouter listen only to events from browsers and tabs for its profile, except for window focus events.

BUG=46610, 57186, 86001
TEST=Manually tested extensions in spanning and split mode.


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90143 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/extensions/extension_menu_manager_unittest.cc b/chrome/browser/extensions/extension_menu_manager_unittest.cc
index cfe2009..fff6f91 100644
--- a/chrome/browser/extensions/extension_menu_manager_unittest.cc
+++ b/chrome/browser/extensions/extension_menu_manager_unittest.cc
@@ -345,10 +345,11 @@
   explicit MockExtensionEventRouter(Profile* profile) :
       ExtensionEventRouter(profile) {}
 
-  MOCK_METHOD5(DispatchEventImpl, void(const std::string& extension_id,
+  MOCK_METHOD6(DispatchEventImpl, void(const std::string& extension_id,
                                        const std::string& event_name,
                                        const std::string& event_args,
                                        Profile* source_profile,
+                                       const std::string& cross_incognito_args,
                                        const GURL& event_url));
 
  private:
@@ -438,7 +439,7 @@
       .WillOnce(Return(mock_event_router.get()));
 
   // Use the magic of googlemock to save a parameter to our mock's
-  // DispatchEventImpl method into event_args.
+  // DispatchEventToExtension method into event_args.
   std::string event_args;
   std::string expected_event_name = "contextMenus";
   EXPECT_CALL(*mock_event_router.get(),
@@ -446,6 +447,7 @@
                                 expected_event_name,
                                 _,
                                 &profile,
+                                "",
                                 GURL()))
       .Times(1)
       .WillOnce(SaveArg<2>(&event_args));