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

Side by Side Diff: chrome/common/extensions/docs/templates/articles/app_intents.html

Issue 12211131: Added deprecation notice for web intents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | chrome/common/extensions/docs/templates/public/apps/app_intents.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <h1>Connect Apps with Web Intents</h1> 1 <h1>Connect Apps with Web Intents</h1>
2 2
3 <p class="warning">
4 <b>Warning: </b>
5 Deprecated in Chrome 24.
6 Web intents are no longer supported.
7 </p>
3 8
4 <p> 9 <p>
5 <a href="http://webintents.org/">Web Intents</a> 10 <a href="http://webintents.org/">Web Intents</a>
6 allow your application to quickly communicate 11 allow your application to quickly communicate
7 with other applications on the user's system and inside their browser. 12 with other applications on the user's system and inside their browser.
8 Your application can register to handle specific user actions 13 Your application can register to handle specific user actions
9 such as editing images via the <code>manifest.json</code>; 14 such as editing images via the <code>manifest.json</code>;
10 your application can also invoke actions to be handled by other applications. 15 your application can also invoke actions to be handled by other applications.
11 </p> 16 </p>
12 17
13 <p>Pacakged apps use Web Intents as their primary mechanism for inter-app 18 <p>Pacakged apps use Web Intents as their primary mechanism for inter-app
14 communication.</p> 19 communication.</p>
15 20
16 <p class="note"> 21 <p class="note">
17 <b>API Samples: </b> 22 <b>API Samples: </b>
18 Want to play with the code? 23 Want to play with the code?
19 Check out the 24 Check out the
20 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/webinten ts">webintents</a> sample. 25 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/webinten ts">webintents</a> sample.
21 </p> 26 </p>
22 27
23 <h2 id="register">Register your app to handle an action</h2> 28 <h2 id="register">Register your app to handle an action</h2>
24 29
30 <p class="warning">
31 <b>Warning: </b>
32 Deprecated in Chrome 24.
33 Web intents are no longer supported.
34 </p>
35
25 <p> 36 <p>
26 You must supply the intent in the manifest: 37 You must supply the intent in the manifest:
27 </p> 38 </p>
28 39
29 <pre> 40 <pre>
30 "intents":{ 41 "intents":{
31 "http://webintents.org/edit" : [{ 42 "http://webintents.org/edit" : [{
32 "title" : "Best Image editing app", 43 "title" : "Best Image editing app",
33 "type" : ["image/*"] 44 "type" : ["image/*"]
34 }] 45 }]
35 } 46 }
36 </pre> 47 </pre>
37 48
38 <p> 49 <p>
39 Unlike extensions and hosted apps, packaged applications do not 50 Unlike extensions and hosted apps, packaged applications do not
40 need a "href" attribute in the manifest declaration, this is 51 need a "href" attribute in the manifest declaration, this is
41 because packaged apps have a single entry point for 52 because packaged apps have a single entry point for
42 launch - the <code>onLaunched</code> event. 53 launch - the <code>onLaunched</code> event.
43 </p> 54 </p>
44 55
45 <h2 id="content">Handling content types</h2> 56 <h2 id="content">Handling content types</h2>
46 57
58 <p class="warning">
59 <b>Warning: </b>
60 Deprecated in Chrome 24.
61 Web intents are no longer supported.
62 </p>
63
47 <p> 64 <p>
48 Your application can be the user's preferred choice for handling a file type. 65 Your application can be the user's preferred choice for handling a file type.
49 For example, your application could handle viewing images or viewing pdfs. 66 For example, your application could handle viewing images or viewing pdfs.
50 You must supply the intent in the manifest 67 You must supply the intent in the manifest
51 and use the "http://webintents.org/view" action: 68 and use the "http://webintents.org/view" action:
52 </p> 69 </p>
53 <p>To be able declare your application's ability to view RSS and ATOM 70 <p>To be able declare your application's ability to view RSS and ATOM
54 feeds, you would add the following to your manifest. 71 feeds, you would add the following to your manifest.
55 </p> 72 </p>
56 <pre> 73 <pre>
(...skipping 13 matching lines...) Expand all
70 // App Launched 87 // App Launched
71 if(intent.action == "http://webinents.org/view" &amp;&amp; 88 if(intent.action == "http://webinents.org/view" &amp;&amp;
72 intent.type == "application/atom+xml") { 89 intent.type == "application/atom+xml") {
73 90
74 // obtain the ATOM feed data. 91 // obtain the ATOM feed data.
75 var data = intent.data; 92 var data = intent.data;
76 } 93 }
77 }); 94 });
78 </pre> 95 </pre>
79 96
97 <h2 id="launching">Launching an app with a file</h2>
80 98
81 <h2 id="launching">Launching an app with a file</h2> 99 <p class="warning">
100 <b>Warning: </b>
101 Deprecated in Chrome 24.
102 Web intents are no longer supported.
103 </p>
104
82 <p> 105 <p>
83 If your app handles the <code>view</code> intent, 106 If your app handles the <code>view</code> intent,
84 it is possible to launch it from the command line with a file as a parameter. 107 it is possible to launch it from the command line with a file as a parameter.
85 </p> 108 </p>
86 <pre> 109 <pre>
87 chrome.exe --app-id [app_id] [path_to_file] 110 chrome.exe --app-id [app_id] [path_to_file]
88 </pre> 111 </pre>
89 <p> 112 <p>
90 This will implicity launch your application with an intent payload populated 113 This will implicity launch your application with an intent payload populated
91 with the action set to "http://webintents.org/view", the type set to the 114 with the action set to "http://webintents.org/view", the type set to the
92 mime-type of the file and the data as a <code>FileEntry</code> object. 115 mime-type of the file and the data as a <code>FileEntry</code> object.
93 </p> 116 </p>
94 <pre> 117 <pre>
95 chrome.app.runtime.onLaunched(function(intent) { 118 chrome.app.runtime.onLaunched(function(intent) {
96 // App Launched 119 // App Launched
97 var data = intent.data; 120 var data = intent.data;
98 }); 121 });
99 </pre> 122 </pre>
100 123
101 <h2 id="launching">Manipulating the file</h2> 124 <h2 id="launching">Manipulating the file</h2>
125
126 <p class="warning">
127 <b>Warning: </b>
128 Deprecated in Chrome 24.
129 Web intents are no longer supported.
130 </p>
131
102 <p> 132 <p>
103 When your application is launched with a file as the parameter 133 When your application is launched with a file as the parameter
104 on the command-line, 134 on the command-line,
105 the <code>intent.data</code> property is a <code>FileEntry</code>. 135 the <code>intent.data</code> property is a <code>FileEntry</code>.
106 This is really cool because now you have a direct reference back to the physic al 136 This is really cool because now you have a direct reference back to the physic al
107 file on the disk, 137 file on the disk,
108 and you can write data back to it. 138 and you can write data back to it.
109 </p> 139 </p>
110 140
111 <pre> 141 <pre>
(...skipping 12 matching lines...) Expand all
124 154
125 // Create a new Blob and write it to log.txt. 155 // Create a new Blob and write it to log.txt.
126 var blob = new Blob(['Lorem Ipsum'], {type: 'text/plain'}); 156 var blob = new Blob(['Lorem Ipsum'], {type: 'text/plain'});
127 writer.write(blob); 157 writer.write(blob);
128 }); 158 });
129 } 159 }
130 }); 160 });
131 </pre> 161 </pre>
132 162
133 <h2 id="return">Returning data to calling application</h2> 163 <h2 id="return">Returning data to calling application</h2>
164
165 <p class="warning">
166 <b>Warning: </b>
167 Deprecated in Chrome 24.
168 Web intents are no longer supported.
169 </p>
170
134 <p> 171 <p>
135 Lots of applications want to cooperate 172 Lots of applications want to cooperate
136 with the app that invoked them. 173 with the app that invoked them.
137 It's easy to send data back to the calling client 174 It's easy to send data back to the calling client
138 using <code>intent.postResult</code>: 175 using <code>intent.postResult</code>:
139 </p> 176 </p>
140 177
141 <pre> 178 <pre>
142 chrome.app.runtime.onLaunched(function(intent) { 179 chrome.app.runtime.onLaunched(function(intent) {
143 // App Launched 180 // App Launched
144 console.log(intent.action); 181 console.log(intent.action);
145 console.log(intent.type); 182 console.log(intent.type);
146 var data = intent.data; 183 var data = intent.data;
147 // Do something with the data; 184 // Do something with the data;
148 185
149 intent.postResult(newData); 186 intent.postResult(newData);
150 }); 187 });
151 </pre> 188 </pre>
152 189
153 <h2 id="localize">Localizing your app title</h2> 190 <h2 id="localize">Localizing your app title</h2>
154 191
192 <p class="warning">
193 <b>Warning: </b>
194 Deprecated in Chrome 24.
195 Web intents are no longer supported.
196 </p>
197
155 <p> 198 <p>
156 If your application or extension is localized 199 If your application or extension is localized
157 as per the guidelines in 200 as per the guidelines in
158 <a href="i18n.html">Internationalization (i18n)</a>, 201 <a href="i18n.html">Internationalization (i18n)</a>,
159 you can localize the title of your intent in the picker 202 you can localize the title of your intent in the picker
160 using the exact same infrastructure: 203 using the exact same infrastructure:
161 </p> 204 </p>
162 205
163 <pre> 206 <pre>
164 "intents": { 207 "intents": {
165 "http://webintents.org/edit" : [{ 208 "http://webintents.org/edit" : [{
166 "title" : "__MSG_intent_title__", 209 "title" : "__MSG_intent_title__",
167 "type" : ["image/*"], 210 "type" : ["image/*"],
168 "disposition" : "inline" 211 "disposition" : "inline"
169 }] 212 }]
170 } 213 }
171 </pre> 214 </pre>
172 215
173 <h2 id="invoke">Invoking an action</h2> 216 <h2 id="invoke">Invoking an action</h2>
217
218 <p class="warning">
219 <b>Warning: </b>
220 Deprecated in Chrome 24.
221 Web intents are no longer supported.
222 </p>
223
174 <p> 224 <p>
175 If your application needs to be able 225 If your application needs to be able
176 to use the functionality of another application, 226 to use the functionality of another application,
177 it can simply ask the browser for it. 227 it can simply ask the browser for it.
178 To ask for an application that supports image editing, 228 To ask for an application that supports image editing,
179 it's as simple as: 229 it's as simple as:
180 </p> 230 </p>
181 231
182 <pre> 232 <pre>
183 var intent = new WebKitIntent("http://webintents.org/edit", "image/png", "dataUr i://"); 233 var intent = new WebKitIntent("http://webintents.org/edit", "image/png", "dataUr i://");
184 234
185 window.navigator.webkitStartActivity(intent, function(data) { 235 window.navigator.webkitStartActivity(intent, function(data) {
186 // The data from the remote application is returned here. 236 // The data from the remote application is returned here.
187 }); 237 });
188 </pre> 238 </pre>
189 239
190 <h2 id="errors">Handling Errors and Exceptions</h2> 240 <h2 id="errors">Handling Errors and Exceptions</h2>
241
242 <p class="warning">
243 <b>Warning: </b>
244 Deprecated in Chrome 24.
245 Web intents are no longer supported.
246 </p>
247
191 <p> 248 <p>
192 If your service application needs to signal to the client application 249 If your service application needs to signal to the client application
193 that an unrecoverable error has occurred, 250 that an unrecoverable error has occurred,
194 then your application will need 251 then your application will need
195 to call <code>postError</code> on the intent object. 252 to call <code>postError</code> on the intent object.
196 This will signal to the client’s onError callback 253 This will signal to the client’s onError callback
197 that something has gone wrong. 254 that something has gone wrong.
198 </p> 255 </p>
199 256
200 <h3 id="client">Client</h3> 257 <h3 id="client">Client</h3>
(...skipping 14 matching lines...) Expand all
215 console.log(intent.action); 272 console.log(intent.action);
216 console.log(intent.type); 273 console.log(intent.type);
217 var data = intent.data; 274 var data = intent.data;
218 // Do something with the data; 275 // Do something with the data;
219 276
220 intent.postResult(newData); 277 intent.postResult(newData);
221 }); 278 });
222 </pre> 279 </pre>
223 280
224 <p class="backtotop"><a href="#top">Back to top</a></p> 281 <p class="backtotop"><a href="#top">Back to top</a></p>
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/templates/public/apps/app_intents.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698