Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Store settings in the local, un-synchronized repository. | |
|
not at google - send to devlin
2011/12/14 23:04:13
Why not use the synced storage?
An interesting fe
not at google - send to devlin
2011/12/14 23:16:07
Or just always use sync, local should be an except
Boris Smus
2011/12/14 23:29:35
Switched to sync for now. Option could be interest
| |
| 6 var storage = chrome.experimental.storage.local; | |
| 7 var message = document.querySelector('#message'); | |
| 8 | |
| 9 // Check if there is CSS specified. | |
| 10 storage.get('css', function(items) { | |
| 11 console.log(items); | |
| 12 // If there is CSS specified, inject it into the page. | |
| 13 if (items.css) { | |
| 14 chrome.tabs.insertCSS(null, {code: items.css}, function() { | |
| 15 if (chrome.extension.lastError) { | |
| 16 message.innerText = 'Not allowed to inject CSS into special page.'; | |
| 17 } | |
| 18 message.innerText = 'Injected style!'; | |
|
not at google - send to devlin
2011/12/14 23:04:13
shouldn't this be in an else, or a "return" after
Boris Smus
2011/12/14 23:29:35
Done.
| |
| 19 }); | |
| 20 } else { | |
| 21 var optionsUrl = chrome.extension.getURL('options.html'); | |
| 22 message.innerHTML = 'Set a style in the <a target="_blank" href="' + | |
| 23 optionsUrl + '">options page</a> first.'; | |
| 24 } | |
| 25 }); | |
| 26 | |
| OLD | NEW |