OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 log_util = (function() { | 5 log_util = (function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Creates a new log dump. |events| is a list of all events, |polledData| is | 9 * Creates a new log dump. |events| is a list of all events, |polledData| is |
10 * an object containing the results of each poll, |tabData| is an object | 10 * an object containing the results of each poll, |tabData| is an object |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 numericDate = oldLogDump.constants.clientInfo.numericDate; | 64 numericDate = oldLogDump.constants.clientInfo.numericDate; |
65 } | 65 } |
66 var logDump = createLogDump( | 66 var logDump = createLogDump( |
67 userComments, | 67 userComments, |
68 Constants, | 68 Constants, |
69 EventsTracker.getInstance().getAllCapturedEvents(), | 69 EventsTracker.getInstance().getAllCapturedEvents(), |
70 oldLogDump.polledData, | 70 oldLogDump.polledData, |
71 getTabData_(), | 71 getTabData_(), |
72 numericDate, | 72 numericDate, |
73 privacyStripping); | 73 privacyStripping); |
74 return JSON.stringify(logDump, null, ' '); | 74 return JSON.stringify(logDump); |
75 } | 75 } |
76 | 76 |
77 /** | 77 /** |
78 * Creates a full log dump using |polledData| and the return value of each | 78 * Creates a full log dump using |polledData| and the return value of each |
79 * tab's saveState function and passes it to |callback|. | 79 * tab's saveState function and passes it to |callback|. |
80 */ | 80 */ |
81 function onUpdateAllCompleted(userComments, callback, privacyStripping, | 81 function onUpdateAllCompleted(userComments, callback, privacyStripping, |
82 polledData) { | 82 polledData) { |
83 var logDump = createLogDump( | 83 var logDump = createLogDump( |
84 userComments, | 84 userComments, |
85 Constants, | 85 Constants, |
86 EventsTracker.getInstance().getAllCapturedEvents(), | 86 EventsTracker.getInstance().getAllCapturedEvents(), |
87 polledData, | 87 polledData, |
88 getTabData_(), | 88 getTabData_(), |
89 timeutil.getCurrentTime(), | 89 timeutil.getCurrentTime(), |
90 privacyStripping); | 90 privacyStripping); |
91 callback(JSON.stringify(logDump, null, ' ')); | 91 callback(JSON.stringify(logDump)); |
92 } | 92 } |
93 | 93 |
94 /** | 94 /** |
95 * Called to create a new log dump. Must not be called once a dump has been | 95 * Called to create a new log dump. Must not be called once a dump has been |
96 * loaded. Once a log dump has been created, |callback| is passed the dumped | 96 * loaded. Once a log dump has been created, |callback| is passed the dumped |
97 * text as a string. | 97 * text as a string. |
98 */ | 98 */ |
99 function createLogDumpAsync(userComments, callback, privacyStripping) { | 99 function createLogDumpAsync(userComments, callback, privacyStripping) { |
100 g_browser.updateAllInfo( | 100 g_browser.updateAllInfo( |
101 onUpdateAllCompleted.bind(null, userComments, callback, | 101 onUpdateAllCompleted.bind(null, userComments, callback, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 return loadLogDump(parsedDump, fileName); | 293 return loadLogDump(parsedDump, fileName); |
294 } | 294 } |
295 | 295 |
296 // Exports. | 296 // Exports. |
297 return { | 297 return { |
298 createUpdatedLogDump: createUpdatedLogDump, | 298 createUpdatedLogDump: createUpdatedLogDump, |
299 createLogDumpAsync: createLogDumpAsync, | 299 createLogDumpAsync: createLogDumpAsync, |
300 loadLogFile: loadLogFile | 300 loadLogFile: loadLogFile |
301 }; | 301 }; |
302 })(); | 302 })(); |
OLD | NEW |