| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Namespace for utility functions. | 8 * Namespace for utility functions. |
| 9 */ | 9 */ |
| 10 var util = {}; | 10 var util = {}; |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 */ | 808 */ |
| 809 v2: function() { | 809 v2: function() { |
| 810 try { | 810 try { |
| 811 return !!(chrome.app && chrome.app.runtime); | 811 return !!(chrome.app && chrome.app.runtime); |
| 812 } catch (e) { | 812 } catch (e) { |
| 813 return false; | 813 return false; |
| 814 } | 814 } |
| 815 }, | 815 }, |
| 816 | 816 |
| 817 /** | 817 /** |
| 818 * @return {boolean} True for the new ui. |
| 819 */ |
| 820 newUI: function() { |
| 821 if (!util.platform.v2()) |
| 822 return false; |
| 823 var manifest = chrome.runtime.getManifest(); |
| 824 return manifest.version >= 3.0; |
| 825 }, |
| 826 |
| 827 /** |
| 818 * @param {function(Object)} callback Function accepting a preference map. | 828 * @param {function(Object)} callback Function accepting a preference map. |
| 819 */ | 829 */ |
| 820 getPreferences: function(callback) { | 830 getPreferences: function(callback) { |
| 821 try { | 831 try { |
| 822 callback(window.localStorage); | 832 callback(window.localStorage); |
| 823 } catch (ignore) { | 833 } catch (ignore) { |
| 824 chrome.storage.local.get(callback); | 834 chrome.storage.local.get(callback); |
| 825 } | 835 } |
| 826 }, | 836 }, |
| 827 | 837 |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 * | 1328 * |
| 1319 * @param {Document} document Document to be toggled. | 1329 * @param {Document} document Document to be toggled. |
| 1320 * @param {boolean} enabled True for enabling, false for disabling. | 1330 * @param {boolean} enabled True for enabling, false for disabling. |
| 1321 */ | 1331 */ |
| 1322 util.toggleFullScreen = function(document, enabled) { | 1332 util.toggleFullScreen = function(document, enabled) { |
| 1323 if (!enabled) | 1333 if (!enabled) |
| 1324 document.webkitCancelFullScreen(); | 1334 document.webkitCancelFullScreen(); |
| 1325 else | 1335 else |
| 1326 document.body.webkitRequestFullScreen(); | 1336 document.body.webkitRequestFullScreen(); |
| 1327 }; | 1337 }; |
| OLD | NEW |