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 // TODO(pedrosimonetti): document how to generate the data pseudo-automatically. | 5 // TODO(pedrosimonetti): document how to generate the data pseudo-automatically. |
6 !/^chrome:\/\/./.test(location.href) && (function() { | 6 !/^chrome:\/\/./.test(location.href) && (function() { |
7 | 7 |
8 var __chrome__ = chrome; | 8 var __chrome__ = chrome; |
9 var shouldRegisterData = !!window.chrome && !!window.chrome.send; | 9 var shouldRegisterData = !!window.chrome && !!window.chrome.send; |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 function initialize() { | 48 function initialize() { |
49 if (shouldRegisterData || !namespace('ntp')) { | 49 if (shouldRegisterData || !namespace('ntp')) { |
50 return; | 50 return; |
51 } | 51 } |
52 isInitialized = true; | 52 isInitialized = true; |
53 namespace('ntp.getThumbnailUrl', mockGetThumbnailUrl); | 53 namespace('ntp.getThumbnailUrl', mockGetThumbnailUrl); |
54 | 54 |
55 var data = loadTimeData.data_; | 55 var data = loadTimeData.data_; |
56 document.documentElement.dir = data.textdirection; | 56 document.documentElement.dir = data.textdirection; |
57 document.body.style.fontSize = data.fontsize; | 57 document.body.style.fontSize = data.fontsize; |
58 document.body.style.fontFamily = data.fontfamily; | |
59 } | 58 } |
60 | 59 |
61 function namespace(str, data) { | 60 function namespace(str, data) { |
62 var ns = str.split('.'), name, object = window; | 61 var ns = str.split('.'), name, object = window; |
63 for (var i = 0, l = ns.length; i < l; i++) { | 62 for (var i = 0, l = ns.length; i < l; i++) { |
64 name = ns[i]; | 63 name = ns[i]; |
65 if (data && i == (l - 1)) { | 64 if (data && i == (l - 1)) { |
66 object = object[name] = data; | 65 object = object[name] = data; |
67 } else { | 66 } else { |
68 object = object[name]; | 67 object = object[name]; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 }, | 179 }, |
181 }; | 180 }; |
182 | 181 |
183 //---------------------------------------------------------------------------- | 182 //---------------------------------------------------------------------------- |
184 // Debug | 183 // Debug |
185 //---------------------------------------------------------------------------- | 184 //---------------------------------------------------------------------------- |
186 | 185 |
187 var debugArgs = {}; | 186 var debugArgs = {}; |
188 var debugStylesheet = null; | 187 var debugStylesheet = null; |
189 var animationSelectorSpeedMap = { | 188 var animationSelectorSpeedMap = { |
| 189 '#card-slider-frame': 250, |
190 '.dot': 200, | 190 '.dot': 200, |
191 '.animate-page-height': 200, | 191 '.animate-page-height': 200, |
192 '.animate-grid-width': 200, | 192 '.animate-grid-width': 200, |
193 '.tile-grid-content': 200, | 193 '.tile-grid-content': 200, |
194 '.tile-row': 200, | 194 '.tile-row': 200, |
195 '.animate-grid-width .tile-cell': 200 | 195 '.animate-grid-width .tile-cell': 200 |
196 }; | 196 }; |
197 | 197 |
198 function adjustAnimationSpeed(slownessFactor) { | 198 function adjustAnimationSpeed(slownessFactor) { |
199 slownessFactor = slownessFactor || 1; | 199 slownessFactor = slownessFactor || 1; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 //---------------------------------------------------------------------------- | 248 //---------------------------------------------------------------------------- |
249 // ChromeMock initialization | 249 // ChromeMock initialization |
250 //---------------------------------------------------------------------------- | 250 //---------------------------------------------------------------------------- |
251 | 251 |
252 if (shouldRegisterData) { | 252 if (shouldRegisterData) { |
253 interceptLoadData(); | 253 interceptLoadData(); |
254 } | 254 } |
255 | 255 |
256 window.chrome = ChromeMock; | 256 window.chrome = ChromeMock; |
257 })(); | 257 })(); |
OLD | NEW |