[Runtime] Fix application event router observer detach iteration bug
[Runtime] Add calls to ApplicationEventManager

ApplicationProcessManager will calls OnMainDocumentCreated when main document is
created. ApplicationService will calls OnAppLoaded when Application object is
instantiated.
[Runtime] Add application event extension support

Currently application event extension API follows Chrome.events definition
(https://developer.chrome.com/apps/events.html).

Implementation details:
The event extension is implemented as an internal extension running on UI
thread. Its instance implements application::EventObserver interface to observe
registered events.

When a listener of an event is added for the first time, the extension instance
will save the wrapped dispatchEvent callback. Then when such event is notified,
the extension instance will call the wrapped callback to run all added
listeners. When all listeners are removed from an event, the extension instance
will detach itself from the event through event manager, the corresponding saved
callback will also be removed.

To provide a method to get the event dispatching status a new event
("onJavaScriptEventAck") is introduced. Other observers can attach to it and get
notification when "xxx" event has finished its dispatching in JS as "xxx" in the
arguments.
[Runtime] Add application event API browser test
Merge pull request #963 from seanlong/event_dev

[Runtime] Add application event API support