| 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 /** | 5 /** |
| 6 * Dictionary of constants (Initialized soon after loading by data from browser, | 6 * Dictionary of constants (Initialized soon after loading by data from browser, |
| 7 * updated on load log). The *Types dictionaries map strings to numeric IDs, | 7 * updated on load log). The *Types dictionaries map strings to numeric IDs, |
| 8 * while the *TypeNames are the other way around. | 8 * while the *TypeNames are the other way around. |
| 9 */ | 9 */ |
| 10 var EventType = null; | 10 var EventType = null; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 var newTabHash = this.tabIdToHash_[newTabId]; | 218 var newTabHash = this.tabIdToHash_[newTabId]; |
| 219 var parsed = parseUrlHash_(window.location.hash); | 219 var parsed = parseUrlHash_(window.location.hash); |
| 220 if (parsed.tabHash != newTabHash) { | 220 if (parsed.tabHash != newTabHash) { |
| 221 window.location.hash = newTabHash; | 221 window.location.hash = newTabHash; |
| 222 } | 222 } |
| 223 }, | 223 }, |
| 224 | 224 |
| 225 onUrlHashChange_: function() { | 225 onUrlHashChange_: function() { |
| 226 var parsed = parseUrlHash_(window.location.hash); | 226 var parsed = parseUrlHash_(window.location.hash); |
| 227 | 227 |
| 228 //handle special case hash redirects |
| 229 specialCaseHashRedirects_(window.location.hash); |
| 230 |
| 228 if (!parsed) | 231 if (!parsed) |
| 229 return; | 232 return; |
| 230 | 233 |
| 231 if (!parsed.tabHash) { | 234 if (!parsed.tabHash) { |
| 232 // Default to the export tab. | 235 // Default to the export tab. |
| 233 parsed.tabHash = ExportView.TAB_HASH; | 236 parsed.tabHash = ExportView.TAB_HASH; |
| 234 } | 237 } |
| 235 | 238 |
| 236 var tabId = this.hashToTabId_[parsed.tabHash]; | 239 var tabId = this.hashToTabId_[parsed.tabHash]; |
| 237 | 240 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (paramDict == null) | 272 if (paramDict == null) |
| 270 paramDict = {}; | 273 paramDict = {}; |
| 271 var key = decodeURIComponent(paramStrings[0]); | 274 var key = decodeURIComponent(paramStrings[0]); |
| 272 var value = decodeURIComponent(paramStrings[1]); | 275 var value = decodeURIComponent(paramStrings[1]); |
| 273 paramDict[key] = value; | 276 paramDict[key] = value; |
| 274 } | 277 } |
| 275 | 278 |
| 276 return {tabHash: tabHash, parameters: paramDict}; | 279 return {tabHash: tabHash, parameters: paramDict}; |
| 277 } | 280 } |
| 278 | 281 |
| 282 /** |
| 283 * Handles special case hash redirects. |
| 284 * These hashes do not have an associated view. |
| 285 * |
| 286 */ |
| 287 function specialCaseHashRedirects_(hash) { |
| 288 // special case for chromeOS to launch built-in dignostics extension. |
| 289 if (hash == '#diagnostics' && cr.isChromeOS) { |
| 290 window.location = |
| 291 'chrome-extension://idddmepepmjcgiedknnmlbadcokidhoa/index.html'; |
| 292 } |
| 293 } |
| 294 |
| 279 return MainView; | 295 return MainView; |
| 280 })(); | 296 })(); |
| 281 | 297 |
| 282 function ConstantsObserver() {} | 298 function ConstantsObserver() {} |
| 283 | 299 |
| 284 /** | 300 /** |
| 285 * Loads all constants from |constants|. On failure, global dictionaries are | 301 * Loads all constants from |constants|. On failure, global dictionaries are |
| 286 * not modifed. | 302 * not modifed. |
| 287 * @param {Object} receivedConstants The map of received constants. | 303 * @param {Object} receivedConstants The map of received constants. |
| 288 */ | 304 */ |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 * Returns the name for sdchProblemCode. | 404 * Returns the name for sdchProblemCode. |
| 389 * | 405 * |
| 390 * Example: sdchProblemCodeToString(5) should return | 406 * Example: sdchProblemCodeToString(5) should return |
| 391 * "DECODE_BODY_ERROR". | 407 * "DECODE_BODY_ERROR". |
| 392 * @param {number} sdchProblemCode The SDCH problem code. | 408 * @param {number} sdchProblemCode The SDCH problem code. |
| 393 * @return {string} The name of the given problem code. | 409 * @return {string} The name of the given problem code. |
| 394 */ | 410 */ |
| 395 function sdchProblemCodeToString(sdchProblemCode) { | 411 function sdchProblemCodeToString(sdchProblemCode) { |
| 396 return getKeyWithValue(SdchProblemCode, sdchProblemCode); | 412 return getKeyWithValue(SdchProblemCode, sdchProblemCode); |
| 397 } | 413 } |
| OLD | NEW |