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

Side by Side Diff: examples/js/show_image.js

Issue 1391243003: Move //mojo/services/X/public/... to //mojo/services/X/... (part 4). (Closed) Base URL: https://github.com/domokit/mojo.git@no_public_3-x-no_public_2-x-no_public_1
Patch Set: copyright header Created 5 years, 2 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
« no previous file with comments | « examples/ganesh_app/ganesh_view.h ('k') | examples/keyboard_client/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!mojo mojo:js_content_handler 1 #!mojo mojo:js_content_handler
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
2 // Demonstrate using the mojo window_manager application to "embed" a view that 6 // Demonstrate using the mojo window_manager application to "embed" a view that
3 // displays an image. To run this application set BUILD_DIR to the build 7 // displays an image. To run this application set BUILD_DIR to the build
4 // directory (like "src/out/Debug") and append a PNG image URL as the url 8 // directory (like "src/out/Debug") and append a PNG image URL as the url
5 // paramaeter for: absolute path for this directory, then: 9 // paramaeter for: absolute path for this directory, then:
6 // sky/tools/mojodb start $BUILD_DIR examples/js/show_image.js?url=<PNG URL> 10 // sky/tools/mojodb start $BUILD_DIR examples/js/show_image.js?url=<PNG URL>
7 // The mojodb application starts an HTTP server that points at the build and 11 // The mojodb application starts an HTTP server that points at the build and
8 // and source directories. It starts a simple - just one view - window manager 12 // and source directories. It starts a simple - just one view - window manager
9 // and then embeds this application in its root view. This application just 13 // and then embeds this application in its root view. This application just
10 // asks the same window manager to embed the PNG viewer. Doing so effectively 14 // asks the same window manager to embed the PNG viewer. Doing so effectively
11 // removes this application from the window manager's root view. 15 // removes this application from the window manager's root view.
12 16
13 define("main", [ 17 define("main", [
14 "mojo/services/public/js/application", 18 "mojo/services/public/js/application",
15 "mojo/services/public/js/service_provider", 19 "mojo/services/public/js/service_provider",
16 "mojo/services/window_manager/public/interfaces/window_manager.mojom", 20 "mojo/services/window_manager/interfaces/window_manager.mojom",
17 "third_party/js/url", 21 "third_party/js/url",
18 ], function(application, serviceProvider, windowManager, url) { 22 ], function(application, serviceProvider, windowManager, url) {
19 23
20 const Application = application.Application; 24 const Application = application.Application;
21 const ServiceProvider = serviceProvider.ServiceProvider; 25 const ServiceProvider = serviceProvider.ServiceProvider;
22 const WindowManager = windowManager.WindowManager; 26 const WindowManager = windowManager.WindowManager;
23 const URL = url.URL; 27 const URL = url.URL;
24 const defaultImageURL = 28 const defaultImageURL =
25 "http://upload.wikimedia.org/wikipedia/commons/8/87/Google_Chrome_icon_%28 2011%29.png"; 29 "http://upload.wikimedia.org/wikipedia/commons/8/87/Google_Chrome_icon_%28 2011%29.png";
26 30
27 class ShowImage extends Application { 31 class ShowImage extends Application {
28 initialize() { 32 initialize() {
29 var imageURL = new URL(this.url, true).query.url || defaultImageURL; 33 var imageURL = new URL(this.url, true).query.url || defaultImageURL;
30 var windowManager = this.shell.connectToService( 34 var windowManager = this.shell.connectToService(
31 "mojo:window_manager", WindowManager); 35 "mojo:window_manager", WindowManager);
32 windowManager.embed(imageURL, function() { /* no ServiceProvider */ }); 36 windowManager.embed(imageURL, function() { /* no ServiceProvider */ });
33 37
34 // Displaying imageURL is now the responsibility of the Mojo application 38 // Displaying imageURL is now the responsibility of the Mojo application
35 // launched by its content handler. We're done. 39 // launched by its content handler. We're done.
36 this.quit(); 40 this.quit();
37 } 41 }
38 } 42 }
39 43
40 return ShowImage; 44 return ShowImage;
41 }); 45 });
42 46
OLDNEW
« no previous file with comments | « examples/ganesh_app/ganesh_view.h ('k') | examples/keyboard_client/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698