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

Side by Side Diff: examples/dart/camera_roll/lib/main.dart

Issue 1964193002: Dart: Refactors Proxies (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address comments Created 4 years, 7 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 | « benchmarks/mojo_rtt_benchmark/lib/main.dart ('k') | examples/dart/camera_video/lib/main.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This example makes use of mojo:camera_roll which is available only when 5 // This example makes use of mojo:camera_roll which is available only when
6 // running on Android. 6 // running on Android.
7 // 7 //
8 // Example usage: 8 // Example usage:
9 // pub get 9 // pub get
10 // pub run sky_tools build 10 // pub run sky_tools build
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 void beginFrame(double timeStamp) { 49 void beginFrame(double timeStamp) {
50 Rect paintBounds = new Rect.fromLTWH(0.0, 0.0, view.width, view.height); 50 Rect paintBounds = new Rect.fromLTWH(0.0, 0.0, view.width, view.height);
51 Picture picture = paint(paintBounds); 51 Picture picture = paint(paintBounds);
52 Scene scene = composite(picture, paintBounds); 52 Scene scene = composite(picture, paintBounds);
53 view.scene = scene; 53 view.scene = scene;
54 } 54 }
55 55
56 void getPhoto() { 56 void getPhoto() {
57 var future = cameraRoll.ptr.getPhoto(photoIndex); 57 var future = cameraRoll.getPhoto(photoIndex);
58 future.then((response) { 58 future.then((response) {
59 if (response.photo == null) { 59 if (response.photo == null) {
60 print("Photo $photoIndex not found, returning to the first photo."); 60 print("Photo $photoIndex not found, returning to the first photo.");
61 cameraRoll.ptr.update(); 61 cameraRoll.update();
62 photoIndex = 0; 62 photoIndex = 0;
63 getPhoto(); 63 getPhoto();
64 return; 64 return;
65 } 65 }
66 66
67 new ImageDecoder(response.photo.content.handle.h, (image) { 67 new ImageDecoder(response.photo.content.handle.h, (image) {
68 if (image != null) { 68 if (image != null) {
69 currentImage = image; 69 currentImage = image;
70 print("view.scheduleFrame"); 70 print("view.scheduleFrame");
71 view.scheduleFrame(); 71 view.scheduleFrame();
(...skipping 15 matching lines...) Expand all
87 87
88 return false; 88 return false;
89 } 89 }
90 90
91 void main() { 91 void main() {
92 embedder.connectToService("mojo:camera", cameraRoll); 92 embedder.connectToService("mojo:camera", cameraRoll);
93 view.setFrameCallback(beginFrame); 93 view.setFrameCallback(beginFrame);
94 view.setEventCallback(handleEvent); 94 view.setEventCallback(handleEvent);
95 getPhoto(); 95 getPhoto();
96 } 96 }
OLDNEW
« no previous file with comments | « benchmarks/mojo_rtt_benchmark/lib/main.dart ('k') | examples/dart/camera_video/lib/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698