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

Side by Side Diff: chrome/common/extensions/docs/templates/intros/input_ime.html

Issue 23452019: Fix examples which uses typo function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <h2 id="manifest">Manifest</h2> 1 <h2 id="manifest">Manifest</h2>
2 <p>You must declare the "input" permission 2 <p>You must declare the "input" permission
3 in the <a href="manifest.html">extension manifest</a> 3 in the <a href="manifest.html">extension manifest</a>
4 to use the input.ime API. 4 to use the input.ime API.
5 For example:</p> 5 For example:</p>
6 <pre>{ 6 <pre>{
7 "name": "My extension", 7 "name": "My extension",
8 ... 8 ...
9 <b>"permissions": [ 9 <b>"permissions": [
10 "input" 10 "input"
11 ]</b>, 11 ]</b>,
12 ... 12 ...
13 }</pre> 13 }</pre>
14 14
15 <h2 id="overview-examples">Examples</h2> 15 <h2 id="overview-examples">Examples</h2>
16 16
17 <p> 17 <p>
18 The following code creates an IME that converts typed letters to upper case. 18 The following code creates an IME that converts typed letters to upper case.
19 </p> 19 </p>
20 20
21 <pre> 21 <pre>
22 var context_id = -1; 22 var context_id = -1;
23 23
24 chrome.input.ime.onFocus.addListener(function(context) { 24 chrome.input.ime.onFocus.addListener(function(context) {
25 context_id = context.contextID; 25 context_id = context.contextID;
26 }); 26 });
27 27
28 chrome.input.ime.onKeyEventAsync.addListener( 28 chrome.input.ime.onKeyEvent.addListener(
29 function(engineID, keyData) { 29 function(engineID, keyData) {
30 if (keyData.type == "keydown" && keyData.key.match(/^[a-z]$/)) { 30 if (keyData.type == "keydown" && keyData.key.match(/^[a-z]$/)) {
31 chrome.input.ime.commitText({"contextID": context_id, 31 chrome.input.ime.commitText({"contextID": context_id,
32 "text": keyData.key.toUpperCase()}); 32 "text": keyData.key.toUpperCase()});
33 return true; 33 return true;
34 } else { 34 } else {
35 return false; 35 return false;
36 } 36 }
37 }); 37 });
38 </pre> 38 </pre>
39 39
40 <p> 40 <p>
41 For an example of using this API, see the 41 For an example of using this API, see the
42 <a 42 <a
43 href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions /docs/examples/api/input.ime/basic/">basic input.ime sample</a>. 43 href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions /docs/examples/api/input.ime/basic/">basic input.ime sample</a>.
44 For other examples and for help in viewing the source code, see 44 For other examples and for help in viewing the source code, see
45 <a href="samples.html">Samples</a>. 45 <a href="samples.html">Samples</a>.
46 </p> 46 </p>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698