Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: chrome/common/extensions/docs/examples/api/storage/stylizr/popup.js

Issue 8916013: Added storage sample. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Storage sample and built devtools docs changes. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698