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

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

Issue 9274004: Take the Extension Storage API out of experimental. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 months 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
1 // Copyright (c) 2011 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 // Store settings in the synchronized repository. 5 // Store settings in the synchronized repository.
6 var storage = chrome.experimental.storage.sync; 6 var storage = chrome.storage.sync;
7 var message = document.querySelector('#message'); 7 var message = document.querySelector('#message');
8 8
9 // Check if there is CSS specified. 9 // Check if there is CSS specified.
10 storage.get('css', function(items) { 10 storage.get('css', function(items) {
11 console.log(items); 11 console.log(items);
12 // If there is CSS specified, inject it into the page. 12 // If there is CSS specified, inject it into the page.
13 if (items.css) { 13 if (items.css) {
14 chrome.tabs.insertCSS(null, {code: items.css}, function() { 14 chrome.tabs.insertCSS(null, {code: items.css}, function() {
15 if (chrome.extension.lastError) { 15 if (chrome.extension.lastError) {
16 message.innerText = 'Not allowed to inject CSS into special page.'; 16 message.innerText = 'Not allowed to inject CSS into special page.';
17 } else { 17 } else {
18 message.innerText = 'Injected style!'; 18 message.innerText = 'Injected style!';
19 } 19 }
20 }); 20 });
21 } else { 21 } else {
22 var optionsUrl = chrome.extension.getURL('options.html'); 22 var optionsUrl = chrome.extension.getURL('options.html');
23 message.innerHTML = 'Set a style in the <a target="_blank" href="' + 23 message.innerHTML = 'Set a style in the <a target="_blank" href="' +
24 optionsUrl + '">options page</a> first.'; 24 optionsUrl + '">options page</a> first.';
25 } 25 }
26 }); 26 });
27 27
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/examples/api/storage/stylizr/options.js ('k') | chrome/common/extensions/docs/experimental.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698