OLD | NEW |
1 #!mojo mojo:js_content_handler | 1 #!mojo mojo:js_content_handler |
2 // Demonstate a Mojo wrapper for the Geocoder JSON API. The application | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. |
| 5 |
| 6 // Demonstrate a Mojo wrapper for the Geocoder JSON API. The application |
3 // connects to geocoder_service.js which implements geocoder.mojom. | 7 // connects to geocoder_service.js which implements geocoder.mojom. |
4 // To run this application with mojo_shell, set DIR to be the absolute path | 8 // To run this application with mojo_shell, set DIR to be the absolute path |
5 // for this directory, then: | 9 // for this directory, then: |
6 // mojo_shell file://$DIR/demo.js | 10 // mojo_shell file://$DIR/demo.js |
7 | 11 |
8 define("main", [ | 12 define("main", [ |
9 "console", | 13 "console", |
10 "mojo/public/js/core", | 14 "mojo/public/js/core", |
11 "mojo/public/js/unicode", | 15 "mojo/public/js/unicode", |
12 "mojo/services/location/public/interfaces/geocoder.mojom", | 16 "mojo/services/location/interfaces/geocoder.mojom", |
13 "mojo/services/location/public/interfaces/location.mojom", | 17 "mojo/services/location/interfaces/location.mojom", |
14 "mojo/services/public/js/application", | 18 "mojo/services/public/js/application", |
15 "third_party/js/url", | 19 "third_party/js/url", |
16 ], function(console, core, unicode, geocoder, location, application, url) { | 20 ], function(console, core, unicode, geocoder, location, application, url) { |
17 | 21 |
18 const Application = application.Application; | 22 const Application = application.Application; |
19 const Geocoder = geocoder.Geocoder; | 23 const Geocoder = geocoder.Geocoder; |
20 const Result = geocoder.Result; | 24 const Result = geocoder.Result; |
21 const Location = location.Location; | 25 const Location = location.Location; |
22 const Status = geocoder.Status; | 26 const Status = geocoder.Status; |
23 const Options = geocoder.Options; | 27 const Options = geocoder.Options; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 var geocoderURL = new URL(this.url).resolve( | 77 var geocoderURL = new URL(this.url).resolve( |
74 "../../services/location/geocoder_service.js"); | 78 "../../services/location/geocoder_service.js"); |
75 geocoderService = this.shell.connectToService(geocoderURL, Geocoder); | 79 geocoderService = this.shell.connectToService(geocoderURL, Geocoder); |
76 demoAddressToLocation(); | 80 demoAddressToLocation(); |
77 } | 81 } |
78 } | 82 } |
79 | 83 |
80 return Demo; | 84 return Demo; |
81 }); | 85 }); |
82 | 86 |
OLD | NEW |