Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2966)

Unified Diff: chrome/browser/resources/sync_internals/chrome_sync.js

Issue 1334173006: Move sync_internals resources and constants to //components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcmInternals
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/sync_internals/about.js ('k') | chrome/browser/resources/sync_internals/data.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/sync_internals/chrome_sync.js
diff --git a/chrome/browser/resources/sync_internals/chrome_sync.js b/chrome/browser/resources/sync_internals/chrome_sync.js
deleted file mode 100644
index 93121fde889e76c39f8d4a0655b192a78ced7492..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/sync_internals/chrome_sync.js
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// require cr.js
-// require cr/event_target.js
-// require cr/util.js
-
-cr.define('chrome.sync', function() {
- 'use strict';
-
- /**
- * A simple timer to measure elapsed time.
- * @constructor
- */
- function Timer() {
- /**
- * The time that this Timer was created.
- * @type {number}
- * @private
- * @const
- */
- this.start_ = Date.now();
- }
-
- /**
- * @return {number} The elapsed seconds since this Timer was created.
- */
- Timer.prototype.getElapsedSeconds = function() {
- return (Date.now() - this.start_) / 1000;
- };
-
- /** @return {!Timer} An object which measures elapsed time. */
- var makeTimer = function() {
- return new Timer;
- };
-
- /**
- * @param {string} name The name of the event type.
- * @param {!Object} details A collection of event-specific details.
- */
- var dispatchEvent = function(name, details) {
- var e = new Event(name);
- e.details = details;
- chrome.sync.events.dispatchEvent(e);
- };
-
- /**
- * Registers to receive a stream of events through
- * chrome.sync.dispatchEvent().
- */
- var registerForEvents = function() {
- chrome.send('registerForEvents');
- };
-
- /**
- * Registers to receive a stream of status counter update events
- * chrome.sync.dispatchEvent().
- */
- var registerForPerTypeCounters = function() {
- chrome.send('registerForPerTypeCounters');
- }
-
- /**
- * Asks the browser to refresh our snapshot of sync state. Should result
- * in an onAboutInfoUpdated event being emitted.
- */
- var requestUpdatedAboutInfo = function() {
- chrome.send('requestUpdatedAboutInfo');
- };
-
- /**
- * Asks the browser to send us the list of registered types. Should result
- * in an onReceivedListOfTypes event being emitted.
- */
- var requestListOfTypes = function() {
- chrome.send('requestListOfTypes');
- };
-
- /**
- * Counter to uniquely identify requests while they're in progress.
- * Used in the implementation of GetAllNodes.
- */
- var requestId = 0;
-
- /**
- * A map from counter values to asynchronous request callbacks.
- * Used in the implementation of GetAllNodes.
- * @type {{number: !Function}}
- */
- var requestCallbacks = {};
-
- /**
- * Asks the browser to send us a copy of all existing sync nodes.
- * Will eventually invoke the given callback with the results.
- *
- * @param {function(!Object)} callback The function to call with the response.
- */
- var getAllNodes = function(callback) {
- requestId++;
- requestCallbacks[requestId] = callback;
- chrome.send('getAllNodes', [requestId]);
- };
-
- /**
- * Called from C++ with the response to a getAllNodes request.
- * @param {number} id The requestId passed in with the request.
- * @param {Object} response The response to the request.
- */
- var getAllNodesCallback = function(id, response) {
- requestCallbacks[id](response);
- requestCallbacks[id] = undefined;
- };
-
- return {
- makeTimer: makeTimer,
- dispatchEvent: dispatchEvent,
- events: new cr.EventTarget(),
- getAllNodes: getAllNodes,
- getAllNodesCallback: getAllNodesCallback,
- registerForEvents: registerForEvents,
- registerForPerTypeCounters: registerForPerTypeCounters,
- requestUpdatedAboutInfo: requestUpdatedAboutInfo,
- requestListOfTypes: requestListOfTypes,
- };
-});
« no previous file with comments | « chrome/browser/resources/sync_internals/about.js ('k') | chrome/browser/resources/sync_internals/data.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698