| Index: chrome/common/extensions/docs/examples/api/webNavigation/basic/navigation_collector.js
|
| diff --git a/chrome/common/extensions/docs/examples/api/webNavigation/basic/navigation_collector.js b/chrome/common/extensions/docs/examples/api/webNavigation/basic/navigation_collector.js
|
| index 15b7fa1ac23d631e0c79e3f3d9f7204519389ab7..5493aedc66406c1adcf094f72c9e0b82b1ace936 100644
|
| --- a/chrome/common/extensions/docs/examples/api/webNavigation/basic/navigation_collector.js
|
| +++ b/chrome/common/extensions/docs/examples/api/webNavigation/basic/navigation_collector.js
|
| @@ -60,6 +60,8 @@ function NavigationCollector() {
|
| this.onErrorOccurredListener_.bind(this));
|
| chrome.webNavigation.onReferenceFragmentUpdated.addListener(
|
| this.onReferenceFragmentUpdatedListener_.bind(this));
|
| + chrome.webNavigation.onHistoryStateUpdated.addListener(
|
| + this.onHistoryStateUpdatedListener_.bind(this));
|
|
|
| // Bind handler to extension messages for communication from popup.
|
| chrome.extension.onRequest.addListener(this.onRequestListener_.bind(this));
|
| @@ -256,6 +258,40 @@ NavigationCollector.prototype = {
|
|
|
|
|
| /**
|
| + * Handler for the 'onHistoryStateUpdated' event. Updates the pending
|
| + * request with transition information.
|
| + *
|
| + * Pushes the request onto the
|
| + * 'pending_' object, and stores it for later use.
|
| + *
|
| + * @param {!Object} data The event data generated for this request.
|
| + * @private
|
| + */
|
| + onHistoryStateUpdatedListener_: function(data) {
|
| + var id = this.parseId_(data);
|
| + if (!this.pending_[id]) {
|
| + this.completed_[data.url] = this.completed_[data.url] || [];
|
| + this.completed_[data.url].push({
|
| + duration: 0,
|
| + openedInNewWindow: false,
|
| + source: {
|
| + frameId: null,
|
| + tabId: null
|
| + },
|
| + transitionQualifiers: data.transitionQualifiers,
|
| + transitionType: data.transitionType,
|
| + url: data.url
|
| + });
|
| + } else {
|
| + this.prepareDataStorage_(id, data.url);
|
| + this.pending_[id].transitionType = data.transitionType;
|
| + this.pending_[id].transitionQualifiers =
|
| + data.transitionQualifiers;
|
| + }
|
| + },
|
| +
|
| +
|
| + /**
|
| * Handler for the 'onCompleted` event. Pulls the request's data from the
|
| * 'pending_' object, combines it with the completed event's data, and pushes
|
| * a new NavigationCollector.Request object onto 'completed_'.
|
|
|