Hello andreip,
I'd like you to do a code review. Please execute
g4 diff -c 8797898
or point your web browser to
http://mondrian/8797898
to review the following code:
Change 8797898 by [EMAIL PROTECTED] on 2008/10/30 17:38:31 *pending*
Adds geolocation.hasPermission, to match factory.hasPermission.
R=andreip
[EMAIL PROTECTED]
DELTA=20 (19 added, 0 deleted, 1 changed)
OCL=8797898
Affected files ...
... //depot/googleclient/gears/opensource/gears/geolocation/geolocation.cc#58
edit
... //depot/googleclient/gears/opensource/gears/geolocation/geolocation.h#25
edit
... //depot/googleclient/gears/opensource/gears/sdk/api_geolocation.html#8 edit
20 delta lines: 19 added, 0 deleted, 1 changed
Also consider running:
g4 lint -c 8797898
which verifies that the changelist doesn't introduce new style violations.
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 8797898 by [EMAIL PROTECTED] on 2008/10/30 17:38:31 *pending*
Adds geolocation.hasPermission, to match factory.hasPermission.
Affected files ...
... //depot/googleclient/gears/opensource/gears/geolocation/geolocation.cc#58
edit
... //depot/googleclient/gears/opensource/gears/geolocation/geolocation.h#25
edit
... //depot/googleclient/gears/opensource/gears/sdk/api_geolocation.html#8 edit
==== //depot/googleclient/gears/opensource/gears/geolocation/geolocation.cc#58
-
c:\MyDocs\Gears3/googleclient/gears/opensource/gears/geolocation/geolocation.cc
====
# action=edit type=text
--- googleclient/gears/opensource/gears/geolocation/geolocation.cc
2008-10-30 18:15:57.000000000 +0000
+++ googleclient/gears/opensource/gears/geolocation/geolocation.cc
2008-10-30 17:27:45.000000000 +0000
@@ -182,6 +182,7 @@
template<>
void Dispatcher<GearsGeolocation>::Init() {
RegisterProperty("lastPosition", &GearsGeolocation::GetLastPosition, NULL);
+ RegisterProperty("hasPermission", &GearsGeolocation::GetHasPermission, NULL);
RegisterMethod("getCurrentPosition", &GearsGeolocation::GetCurrentPosition);
RegisterMethod("watchPosition", &GearsGeolocation::WatchPosition);
RegisterMethod("clearWatch", &GearsGeolocation::ClearWatch);
@@ -312,6 +313,12 @@
IntegerToString16(id) +
STRING16(L"."));
}
+}
+
+void GearsGeolocation::GetHasPermission(JsCallContext *context) {
+ bool has_permission = GetPermissionsManager()->HasPermission(
+ PermissionsDB::PERMISSION_LOCATION_DATA);
+ context->SetReturnValue(JSPARAM_BOOL, &has_permission);
}
void GearsGeolocation::GetPermission(JsCallContext *context) {
==== //depot/googleclient/gears/opensource/gears/geolocation/geolocation.h#25 -
c:\MyDocs\Gears3/googleclient/gears/opensource/gears/geolocation/geolocation.h
====
# action=edit type=text
--- googleclient/gears/opensource/gears/geolocation/geolocation.h
2008-10-30 18:15:57.000000000 +0000
+++ googleclient/gears/opensource/gears/geolocation/geolocation.h
2008-10-30 17:40:11.000000000 +0000
@@ -174,6 +174,11 @@
// OUT: nothing
void ClearWatch(JsCallContext *context);
+ // Getter for location permissions.
+ // IN: nothing
+ // OUT: boolean location_permission_state
+ void GearsGeolocation::GetHasPermission(JsCallContext *context);
+
// Triggers the geolocation-specific permissions dialog.
// IN: string siteName, string imageUrl, string extraMessage
// OUT: boolean permission
==== //depot/googleclient/gears/opensource/gears/sdk/api_geolocation.html#8 -
c:\MyDocs\Gears3/googleclient/gears/opensource/gears/sdk/api_geolocation.html
====
# action=edit type=text
--- googleclient/gears/opensource/gears/sdk/api_geolocation.html
2008-10-30 18:15:57.000000000 +0000
+++ googleclient/gears/opensource/gears/sdk/api_geolocation.html
2008-10-30 17:34:47.000000000 +0000
@@ -110,6 +110,7 @@
<pre><code><a href="#geolocation">Geolocation class</a>
readonly attribute Position lastPosition
+ readonly attribute boolean hasPermission
void getCurrentPosition(successCallback, [errorCallback], [options])
int watchPosition(successCallback, [errorCallback], [options])
void clearWatch(int watchId)
@@ -277,11 +278,17 @@
<th width="432">Description</th>
</tr>
<tr class="odd">
- <td><strong><code><a name="lastPosition"
id="lastPosition"></a></code>lastPosition</strong></td>
+ <td><strong><a name="lastPosition"
id="lastPosition"></a>lastPosition</strong></td>
<td class="odd">readonly Position</td>
<td class="odd">The last known position, or null if there is no last known
position. This does not actively trigger obtaining a new position fix,
so it is quick and does not consume power or computational resources.</td>
+</tr>
+<tr class="odd">
+ <td><strong>hasPermission</strong></td>
+ <td class="odd">readonly boolean</td>
+ <td class="odd">Returns true if the site already has permission to access
the user's
+ location through Gears.</td>
</tr>
</table>