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

Side by Side Diff: chrome/common/extensions/docs/static/background_pages.html

Issue 179027: Make a bunch of backlogged breaking changes to the extensions (Closed)
Patch Set: Put chrome.self back Created 11 years, 3 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
OLDNEW
1 <div id="pageData-title" class="pageData">Background Pages</div> 1 <div id="pageData-title" class="pageData">Background Pages</div>
2 <div id="pageData-showTOC" class="pageData">true</div> 2 <div id="pageData-showTOC" class="pageData">true</div>
3 3
4 <p> 4 <p>
5 A common need for extensions is to have 5 A common need for extensions is to have
6 a single long-running script to manage some task or state. 6 a single long-running script to manage some task or state.
7 Toolstrips don't quite fit this need, 7 Toolstrips don't quite fit this need,
8 because multiple toolstrips can be active at any one time 8 because multiple toolstrips can be active at any one time
9 (one per browser window). 9 (one per browser window).
10 Background pages to the rescue. 10 Background pages to the rescue.
(...skipping 21 matching lines...) Expand all
32 }</pre> 32 }</pre>
33 33
34 <h2>Details</h2> 34 <h2>Details</h2>
35 35
36 <p> 36 <p>
37 Your toolstrip will likely contain 37 Your toolstrip will likely contain
38 only the necessary code to display the toolstrip UI, 38 only the necessary code to display the toolstrip UI,
39 with all your extension logic contained in the background page. 39 with all your extension logic contained in the background page.
40 You can communicate between your various pages using direct script calls, 40 You can communicate between your various pages using direct script calls,
41 similar to how frames can communicate. 41 similar to how frames can communicate.
42 The chrome.self.getViews() function 42 The chrome.extension.getViews() function
43 returns a list of window objects 43 returns a list of window objects
44 for every active page belonging to your extension. 44 for every active page belonging to your extension.
45 </p> 45 </p>
46 46
47 <h2>Example</h2> 47 <h2>Example</h2>
48 48
49 <pre>background_page.html (snippet): 49 <pre>background_page.html (snippet):
50 function updateUI(checked) { 50 function updateUI(checked) {
51 var views = chrome.self.getViews(); 51 var views = chrome.extension.getViews();
52 for (var i in views) { 52 for (var i in views) {
53 if (views[i].enableCheckbox) 53 if (views[i].enableCheckbox)
54 views[i].enableCheckbox(checked); 54 views[i].enableCheckbox(checked);
55 } 55 }
56 } 56 }
57 57
58 toolstrip.html (snippet): 58 toolstrip.html (snippet):
59 function enableCheckbox(checked) { 59 function enableCheckbox(checked) {
60 var elm = document.getElementById('checkbox'); 60 var elm = document.getElementById('checkbox');
61 elm.checked = checked; 61 elm.checked = checked;
62 }</pre> 62 }</pre>
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_messages_unittest.cc ('k') | chrome/renderer/extensions/extension_process_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698