Do not pass URLs in onUpdated events to extensions unless they have the
"tabs" permission.

BUG=168442


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176406 0039d316-1c4b-4281-b951-d872f2087c98
 void BrowserEventRouter::DispatchTabUpdatedEvent(
    WebContents* contents, scoped_ptr<DictionaryValue> changed_properties) {
   DCHECK(changed_properties);
   DCHECK(contents);
 
  scoped_ptr<ListValue> args_base(new ListValue());

   args_base->AppendInteger(ExtensionTabUtil::GetTabId(contents));
 
  // Second arg: An object containing the changes to the tab state.  Filled in
  // by WillDispatchTabUpdatedEvent as a copy of changed_properties, if the
  // extension has the tabs permission.
 
  Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());

  scoped_ptr<Event> event(new Event(events::kOnTabUpdated, args_base.Pass()));
   event->restrict_to_profile = profile;
   event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED;
   event->will_dispatch_callback =
      base::Bind(&WillDispatchTabUpdatedEvent,
                 contents, changed_properties.get());
   ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass());
 }

 void BrowserEventRouter::DispatchTabUpdatedEvent(
    WebContents* contents, DictionaryValue* changed_properties) {
   DCHECK(changed_properties);
   DCHECK(contents);
 
  scoped_ptr<ListValue> args_base(new ListValue());

   args_base->AppendInteger(ExtensionTabUtil::GetTabId(contents));
 
  args_base->Append(changed_properties);
 
  Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());

  scoped_ptr<Event> event(new Event(events::kOnTabUpdated, args_base.Pass()));
   event->restrict_to_profile = profile;
   event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED;
   event->will_dispatch_callback =
      base::Bind(&WillDispatchTabUpdatedEvent, contents);
   ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass());
 }
