OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // TODO(arv): Move to shared/js once namespaced and tested. | 5 // TODO(arv): Move to shared/js once namespaced and tested. |
6 | 6 |
7 var global = this; | 7 var global = this; |
8 const IS_MAC = /$Mac/.test(navigator.platform); | 8 const IS_MAC = /^Mac/.test(navigator.platform); |
9 | 9 |
10 function $(id) { | 10 function $(id) { |
11 return document.getElementById(id); | 11 return document.getElementById(id); |
12 } | 12 } |
13 | 13 |
14 function bind(fn, selfObj, var_args) { | 14 function bind(fn, selfObj, var_args) { |
15 var boundArgs = Array.prototype.slice.call(arguments, 2); | 15 var boundArgs = Array.prototype.slice.call(arguments, 2); |
16 return function() { | 16 return function() { |
17 var args = Array.prototype.slice.call(arguments); | 17 var args = Array.prototype.slice.call(arguments); |
18 args.unshift.apply(args, boundArgs); | 18 args.unshift.apply(args, boundArgs); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // restore | 77 // restore |
78 global[callbackName] = old; | 78 global[callbackName] = old; |
79 | 79 |
80 var args = Array.prototype.slice.call(arguments); | 80 var args = Array.prototype.slice.call(arguments); |
81 return callback.apply(global, args); | 81 return callback.apply(global, args); |
82 }; | 82 }; |
83 chrome.send(name, params); | 83 chrome.send(name, params); |
84 } | 84 } |
85 | 85 |
86 | 86 |
OLD | NEW |