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

Unified Diff: chrome/common/extensions/docs/templates/intros/location.html

Issue 19763008: Adding dev documentation for chrome.location (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/templates/intros/location.html
diff --git a/chrome/common/extensions/docs/templates/intros/location.html b/chrome/common/extensions/docs/templates/intros/location.html
new file mode 100644
index 0000000000000000000000000000000000000000..3ab1db89d083396e04b61290920f2d0ef066871a
--- /dev/null
+++ b/chrome/common/extensions/docs/templates/intros/location.html
@@ -0,0 +1,41 @@
+<p id="classSummary">
+Use the <code>chrome.location</code> API to retrieve geographical location of
Jeffrey Yasskin 2013/07/23 20:37:29 I suspect this paragraph belongs in the "descripti
not at google - send to devlin 2013/07/23 20:41:04 There is a README in chrome/common/extensions/docs
vadimt 2013/07/24 19:36:45 Running preview.py results in: D:\src\Chromium1\sr
+ the hosting machine.</p>
+
+<h2 id="manifest">Manifest</h2>
Jeffrey Yasskin 2013/07/23 20:37:29 Since there's nothing for someone to do in the man
not at google - send to devlin 2013/07/23 20:41:04 We are supposed to be automatically generating the
vadimt 2013/07/24 19:36:45 Done.
+<p>You must declare the "location" permission
+ in the <a href="manifest.html">extension manifest</a>
+ to use the location API.
+ For example:
+</p>
+<pre>{
+ "name": "My extension",
+ ...
+ <b>"permissions": [
+ "location"
+ ]</b>,
+ ...
+}</pre>
+
+<h2 id="description">Objects and properties</h2>
+<p>
+ To create a location watch, call $ref:chrome.location.watchLocation passing in
+ the location watch details via the <code>requestInfo</code> parameter:
+</p>
+<pre>chrome.location.watchLocation(name, requestInfo);</pre>
+<p>
+ You'll also need to add a listener
+ to its <code>onChanged</code> event.
+ Chrome will fire this event after you create your location watch. After this,
+ it will keep firing the event every time the geographical location of your
+ computer changes until you call $ref:chrome.location.clearWatch.
+</p>
+<p>
+ Here's sample code
+ to listen for location updates:
+</p>
+<pre>
+ chrome.location.onLocationUpdate.addListener(function(position) {
+ console.log(JSON.stringify(position));
+ });
+</pre>

Powered by Google App Engine
This is Rietveld 408576698