本文整理汇总了C++中Geolocation类的典型用法代码示例。如果您正苦于以下问题:C++ Geolocation类的具体用法?C++ Geolocation怎么用?C++ Geolocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Geolocation类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exceptionState
void V8Geolocation::watchPositionMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
bool succeeded = false;
ExceptionState exceptionState(ExceptionState::ExecutionContext, "watchCurrentPosition", "Geolocation", info.Holder(), info.GetIsolate());
OwnPtr<PositionCallback> positionCallback = createFunctionOnlyCallback<V8PositionCallback>(info[0], 1, succeeded, info.GetIsolate(), exceptionState);
if (!succeeded)
return;
ASSERT(positionCallback);
// Argument is optional (hence undefined is allowed), and null is allowed.
OwnPtr<PositionErrorCallback> positionErrorCallback = createFunctionOnlyCallback<V8PositionErrorCallback>(info[1], 2, succeeded, info.GetIsolate(), exceptionState, CallbackAllowUndefined | CallbackAllowNull);
if (!succeeded)
return;
RefPtrWillBeRawPtr<PositionOptions> positionOptions = createPositionOptions(info[2], info.GetIsolate(), succeeded);
if (!succeeded)
return;
ASSERT(positionOptions);
Geolocation* geolocation = V8Geolocation::toNative(info.Holder());
int watchId = geolocation->watchPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.release());
v8SetReturnValue(info, watchId);
}
示例2: clearWatchCallback
static v8::Handle<v8::Value> clearWatchCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Geolocation.clearWatch");
Geolocation* imp = V8Geolocation::toNative(args.Holder());
EXCEPTION_BLOCK(int, watchId, toInt32(args[0]));
imp->clearWatch(watchId);
return v8::Handle<v8::Value>();
}
示例3: didReceiveGeolocationPermissionDecision
void GeolocationPermissionRequestManager::didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed)
{
IDToGeolocationMap::iterator it = m_idToGeolocationMap.find(geolocationID);
if (it == m_idToGeolocationMap.end())
return;
Geolocation* geolocation = it->value;
geolocation->setIsAllowed(allowed);
m_idToGeolocationMap.remove(it);
m_geolocationToIDMap.remove(geolocation);
}
示例4: jsGeolocationPrototypeFunctionClearWatch
EncodedJSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionClearWatch(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSGeolocation::s_info))
return throwVMTypeError(exec);
JSGeolocation* castedThis = static_cast<JSGeolocation*>(asObject(thisValue));
Geolocation* imp = static_cast<Geolocation*>(castedThis->impl());
int watchId = exec->argument(0).toInt32(exec);
imp->clearWatch(watchId);
return JSValue::encode(jsUndefined());
}
示例5: setPermission
void GeolocationPermissionClientQt::setPermission(QWebFrame* webFrame, QWebPage::PermissionPolicy permission)
{
if (!m_pendingPermissionRequests.contains(webFrame))
return;
Geolocation* listener = m_pendingPermissionRequests.value(webFrame);
if (permission == QWebPage::PermissionGrantedByUser)
listener->setIsAllowed(true);
else if (permission == QWebPage::PermissionDeniedByUser)
listener->setIsAllowed(false);
else
return;
m_pendingPermissionRequests.remove(webFrame);
}
示例6: maybeCallbackFrames
void GeolocationPermissions::maybeCallbackFrames(String origin, bool allow)
{
// We can't track which frame issued the request, as frames can be deleted
// or have their contents replaced. Even uniqueChildName is not unique when
// frames are dynamically deleted and created. Instead, we simply call back
// to the Geolocation object in all frames from the correct origin.
for (Frame* frame = m_mainFrame; frame; frame = frame->tree()->traverseNext()) {
if (origin == frame->document()->securityOrigin()->toString()) {
// If the page has changed, it may no longer have a Geolocation
// object.
Geolocation* geolocation = frame->domWindow()->navigator()->optionalGeolocation();
if (geolocation)
geolocation->setIsAllowed(allow);
}
}
}
示例7: INC_STATS
v8::Handle<v8::Value> V8Geolocation::watchPositionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Geolocation.watchPosition()");
bool succeeded = false;
RefPtr<PositionCallback> positionCallback = createPositionCallback(args[0], succeeded);
if (!succeeded)
return v8::Undefined();
ASSERT(positionCallback);
RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(args[1], succeeded);
if (!succeeded)
return v8::Undefined();
RefPtr<PositionOptions> positionOptions = createPositionOptions(args[2], succeeded);
if (!succeeded)
return v8::Undefined();
ASSERT(positionOptions);
Geolocation* geolocation = V8DOMWrapper::convertToNativeObject<Geolocation>(V8ClassIndex::GEOLOCATION, args.Holder());
int watchId = geolocation->watchPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.release());
return v8::Number::New(watchId);
}
示例8: INC_STATS
v8::Handle<v8::Value> V8Geolocation::getCurrentPositionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.Geolocation.getCurrentPosition()");
bool succeeded = false;
RefPtr<PositionCallback> positionCallback = createPositionCallback(args[0], succeeded);
if (!succeeded)
return v8::Undefined();
ASSERT(positionCallback);
RefPtr<PositionErrorCallback> positionErrorCallback = createPositionErrorCallback(args[1], succeeded);
if (!succeeded)
return v8::Undefined();
RefPtr<PositionOptions> positionOptions = createPositionOptions(args[2], succeeded);
if (!succeeded)
return v8::Undefined();
ASSERT(positionOptions);
Geolocation* geolocation = V8Geolocation::toNative(args.Holder());
geolocation->getCurrentPosition(positionCallback.release(), positionErrorCallback.release(), positionOptions.release());
return v8::Undefined();
}
示例9: Geolocation
Geolocation* Geolocation::create(ExecutionContext* context)
{
Geolocation* geolocation = new Geolocation(context);
geolocation->suspendIfNeeded();
return geolocation;
}
示例10: onPermission
void GeolocationControllerClientBlackBerry::onPermission(void* context, bool isAllowed)
{
Geolocation* position = static_cast<Geolocation*>(context);
position->setIsAllowed(isAllowed);
}