当前位置: 首页>>代码示例>>C++>>正文


C++ Geolocation类代码示例

本文整理汇总了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);
}
开发者ID:kublaj,项目名称:blink,代码行数:25,代码来源:V8GeolocationCustom.cpp

示例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>();
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:8,代码来源:V8Geolocation.cpp

示例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);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:12,代码来源:GeolocationPermissionRequestManager.cpp

示例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());
}
开发者ID:youtube,项目名称:h5vcc_hh,代码行数:12,代码来源:JSGeolocation.cpp

示例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);
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:16,代码来源:GeolocationPermissionClientQt.cpp

示例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);
        }
    }
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:16,代码来源:GeolocationPermissions.cpp

示例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);
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:24,代码来源:V8GeolocationCustom.cpp

示例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();
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:24,代码来源:V8GeolocationCustom.cpp

示例9: Geolocation

Geolocation* Geolocation::create(ExecutionContext* context)
{
    Geolocation* geolocation = new Geolocation(context);
    geolocation->suspendIfNeeded();
    return geolocation;
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:6,代码来源:Geolocation.cpp

示例10: onPermission

void GeolocationControllerClientBlackBerry::onPermission(void* context, bool isAllowed)
{
    Geolocation* position = static_cast<Geolocation*>(context);
    position->setIsAllowed(isAllowed);
}
开发者ID:Moondee,项目名称:Artemis,代码行数:5,代码来源:GeolocationControllerClientBlackBerry.cpp


注:本文中的Geolocation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。