Hello nicolasroard,

I'd like you to do a code review.  Please execute
        g4 diff -c 8164030

or point your web browser to
        http://mondrian/8164030

to review the following code:

Change 8164030 by [EMAIL PROTECTED] on 2008/09/03 11:29:25 *pending*

        Updates Geolocation sample app to handle case where page does not have 
location permissions.
        
        R=nicolasroard
        [EMAIL PROTECTED]
        DELTA=32  (13 added, 8 deleted, 11 changed)
        OCL=8164030

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/sdk/samples/hello_world_geolocation.html#1
 edit

32 delta lines: 13 added, 8 deleted, 11 changed

If you can't do the review, please let me know as soon as possible.  During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately.  Visit
http://www/eng/code_review.html for more information.

This is a semiautomated message from "g4 mail".  Complaints or suggestions?
Mail [EMAIL PROTECTED]
Change 8164030 by [EMAIL PROTECTED] on 2008/09/03 11:29:25 *pending*

        Updates Geolocation sample app to handle case where page does not have 
location permissions.

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/sdk/samples/hello_world_geolocation.html#1
 edit

==== 
//depot/googleclient/gears/opensource/gears/sdk/samples/hello_world_geolocation.html#1
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/sdk/samples/hello_world_geolocation.html
 ====
# action=edit type=text
--- 
googleclient/gears/opensource/gears/sdk/samples/hello_world_geolocation.html    
    2008-09-03 11:53:20.000000000 +0100
+++ 
googleclient/gears/opensource/gears/sdk/samples/hello_world_geolocation.html    
    2008-09-03 11:39:06.000000000 +0100
@@ -55,32 +55,37 @@
     addStatus('Gears is not installed', 'error');
     return;
   }
-  
+
   addStatus('Getting location...');
-    
+
   var geolocation = google.gears.factory.create('beta.geolocation');
-  geolocation.getCurrentPosition(
-    function(p) {
-      var address = p.gearsAddress.city + ', ' 
-                    + p.gearsAddress.region + ', ' 
-                    + p.gearsAddress.country + ' (' 
-                    + p.latitude + ', ' 
-                    + p.longitude + ')';
-      
-      clearStatus();
-      addStatus('Your address is: ' + address);
-    },
 
-    function(err) {
-      var msg = 'Error retrieving your location: ' + err.message;
-      setError(msg);
-    },
-  
-    {
-      enableHighAccuracy: true, 
-      gearsRequestAddress: true 
-    }
-  );
+  function successCallback(p) {
+    var address = p.gearsAddress.city + ', '
+                  + p.gearsAddress.region + ', '
+                  + p.gearsAddress.country + ' ('
+                  + p.latitude + ', '
+                  + p.longitude + ')';
+
+    clearStatus();
+    addStatus('Your address is: ' + address);
+  }
+
+  function errorCallback(err) {
+    var msg = 'Error retrieving your location: ' + err.message;
+    setError(msg);
+  }
+
+  try {
+    geolocation.getCurrentPosition(successCallback,
+                                   errorCallback,
+                                   { enableHighAccuracy: true,
+                                     gearsRequestAddress: true });
+  } catch (e) {
+    setError('Could not create Geolocation object: ' + e.message);
+    return;
+  }
+
 }
 </script>
 </body>

Reply via email to