• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Callback类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.chromium.base.Callback的典型用法代码示例。如果您正苦于以下问题:Java Callback类的具体用法?Java Callback怎么用?Java Callback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Callback类属于org.chromium.base包,在下文中一共展示了Callback类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSectionInformation

import org.chromium.base.Callback; //导入依赖的package包/类
@Override
public void getSectionInformation(@PaymentRequestUI.DataType final int optionType,
        final Callback<SectionInformation> callback) {
    mHandler.post(new Runnable() {
        @Override
        public void run() {
            if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) {
                callback.onResult(mShippingAddressesSection);
            } else if (optionType == PaymentRequestUI.TYPE_SHIPPING_OPTIONS) {
                callback.onResult(mUiShippingOptions);
            } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) {
                callback.onResult(mContactSection);
            } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) {
                assert mPaymentMethodsSection != null;
                callback.onResult(mPaymentMethodsSection);
            }
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:20,代码来源:PaymentRequestImpl.java


示例2: onSectionEditOption

import org.chromium.base.Callback; //导入依赖的package包/类
@Override
@PaymentRequestUI.SelectionResult
public int onSectionEditOption(@PaymentRequestUI.DataType int optionType, PaymentOption option,
        Callback<PaymentInformation> callback) {
    if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) {
        assert option instanceof AutofillAddress;
        editAddress((AutofillAddress) option);
        mPaymentInformationCallback = callback;
        return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION;
    }

    if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) {
        assert option instanceof AutofillContact;
        editContact((AutofillContact) option);
        return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH;
    }

    if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) {
        assert option instanceof AutofillPaymentInstrument;
        editCard((AutofillPaymentInstrument) option);
        return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH;
    }

    assert false;
    return PaymentRequestUI.SELECTION_RESULT_NONE;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:27,代码来源:PaymentRequestImpl.java


示例3: onSectionAddOption

import org.chromium.base.Callback; //导入依赖的package包/类
@Override
@PaymentRequestUI.SelectionResult
public int onSectionAddOption(
        @PaymentRequestUI.DataType int optionType, Callback<PaymentInformation> callback) {
    if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) {
        editAddress(null);
        mPaymentInformationCallback = callback;
        // Log the add of shipping address.
        mJourneyLogger.incrementSelectionAdds(
                PaymentRequestJourneyLogger.SECTION_SHIPPING_ADDRESS);
        return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION;
    } else if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS) {
        editContact(null);
        // Log the add of contact info.
        mJourneyLogger.incrementSelectionAdds(PaymentRequestJourneyLogger.SECTION_CONTACT_INFO);
        return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH;
    } else if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS) {
        editCard(null);
        // Log the add of credit card.
        mJourneyLogger.incrementSelectionAdds(PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS);
        return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH;
    }

    return PaymentRequestUI.SELECTION_RESULT_NONE;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:26,代码来源:PaymentRequestImpl.java


示例4: editAddress

import org.chromium.base.Callback; //导入依赖的package包/类
private void editAddress(final AutofillAddress toEdit) {
    if (toEdit != null) {
        // Log the edit of a shipping address.
        mJourneyLogger.incrementSelectionEdits(
                PaymentRequestJourneyLogger.SECTION_SHIPPING_ADDRESS);
    }
    mAddressEditor.edit(toEdit, new Callback<AutofillAddress>() {
        @Override
        public void onResult(AutofillAddress completeAddress) {
            if (mUI == null) return;

            if (completeAddress == null) {
                mShippingAddressesSection.setSelectedItemIndex(SectionInformation.NO_SELECTION);
                providePaymentInformation();
            } else {
                if (toEdit == null) mShippingAddressesSection.addAndSelectItem(completeAddress);
                mCardEditor.updateBillingAddressIfComplete(completeAddress);
                mClient.onShippingAddressChange(completeAddress.toPaymentAddress());
            }
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:PaymentRequestImpl.java


示例5: editContact

import org.chromium.base.Callback; //导入依赖的package包/类
private void editContact(final AutofillContact toEdit) {
    if (toEdit != null) {
        // Log the edit of a contact info.
        mJourneyLogger.incrementSelectionEdits(
                PaymentRequestJourneyLogger.SECTION_CONTACT_INFO);
    }
    mContactEditor.edit(toEdit, new Callback<AutofillContact>() {
        @Override
        public void onResult(AutofillContact completeContact) {
            if (mUI == null) return;

            if (completeContact == null) {
                mContactSection.setSelectedItemIndex(SectionInformation.NO_SELECTION);
            } else if (toEdit == null) {
                mContactSection.addAndSelectItem(completeContact);
            }

            mUI.updateSection(PaymentRequestUI.TYPE_CONTACT_DETAILS, mContactSection);
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:PaymentRequestImpl.java


示例6: editCard

import org.chromium.base.Callback; //导入依赖的package包/类
private void editCard(final AutofillPaymentInstrument toEdit) {
    if (toEdit != null) {
        // Log the edit of a credit card.
        mJourneyLogger.incrementSelectionEdits(
                PaymentRequestJourneyLogger.SECTION_CREDIT_CARDS);
    }
    mCardEditor.edit(toEdit, new Callback<AutofillPaymentInstrument>() {
        @Override
        public void onResult(AutofillPaymentInstrument completeCard) {
            if (mUI == null) return;

            if (completeCard == null) {
                mPaymentMethodsSection.setSelectedItemIndex(SectionInformation.NO_SELECTION);
            } else if (toEdit == null) {
                mPaymentMethodsSection.addAndSelectItem(completeCard);
            }

            mUI.updateSection(PaymentRequestUI.TYPE_PAYMENT_METHODS, mPaymentMethodsSection);
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:PaymentRequestImpl.java


示例7: selectPageForOnlineUrlCallback

import org.chromium.base.Callback; //导入依赖的package包/类
/**
 * Takes the offline page item from selectPageForOnlineURL. If it exists, invokes
 * |prepareForSharing| with it.  Otherwise, saves a page for the online URL and invokes
 * |prepareForSharing| with the result when it's ready.
 * @param webContents Contents of the page to save.
 * @param offlinePageBridge A static copy of the offlinePageBridge.
 * @param prepareForSharing Callback of a single OfflinePageItem that is used to call
 *                          prepareForSharing
 * @return a callback of OfflinePageItem
 */
private static Callback<OfflinePageItem> selectPageForOnlineUrlCallback(
        final WebContents webContents, final OfflinePageBridge offlinePageBridge,
        final Callback<OfflinePageItem> prepareForSharing) {
    return new Callback<OfflinePageItem>() {
        @Override
        public void onResult(OfflinePageItem item) {
            if (item == null) {
                // If the page has no offline copy, save the page offline.
                ClientId clientId = ClientId.createGuidClientIdForNamespace(
                        OfflinePageBridge.SHARE_NAMESPACE);
                offlinePageBridge.savePage(webContents, clientId,
                        savePageCallback(prepareForSharing, offlinePageBridge));
                return;
            }
            // If the online page has offline copy associated with it, use the file directly.
            prepareForSharing.onResult(item);
        }
    };
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:30,代码来源:OfflinePageUtils.java


示例8: savePageCallback

import org.chromium.base.Callback; //导入依赖的package包/类
/**
 * Saves the web page loaded into web contents. If page saved successfully, get the offline
 * page item with the save page result and use it to invoke |prepareForSharing|. Otherwise,
 * invokes |prepareForSharing| with null.
 * @param prepareForSharing Callback of a single OfflinePageItem that is used to call
 *                          prepareForSharing
 * @param offlinePageBridge A static copy of the offlinePageBridge.
 * @return a call back of a list of OfflinePageItem
 */
private static OfflinePageBridge.SavePageCallback savePageCallback(
        final Callback<OfflinePageItem> prepareForSharing,
        final OfflinePageBridge offlinePageBridge) {
    return new OfflinePageBridge.SavePageCallback() {
        @Override
        public void onSavePageDone(int savePageResult, String url, long offlineId) {
            if (savePageResult != SavePageResult.SUCCESS) {
                Log.e(TAG, "Unable to save the page.");
                prepareForSharing.onResult(null);
                return;
            }

            offlinePageBridge.getPageByOfflineId(offlineId, prepareForSharing);
        }
    };
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:26,代码来源:OfflinePageUtils.java


示例9: isUserManaged

import org.chromium.base.Callback; //导入依赖的package包/类
/**
 * Performs an asynchronous check to see if the user is a managed user.
 * @param callback A callback to be called with true if the user is a managed user and false
 *         otherwise.
 */
public static void isUserManaged(String email, final Callback<Boolean> callback) {
    if (nativeShouldLoadPolicyForUser(email)) {
        nativeIsUserManaged(email, callback);
    } else {
        // Although we know the result immediately, the caller may not be able to handle the
        // callback being executed during this method call. So we post the callback on the
        // looper.
        ThreadUtils.postOnUiThread(new Runnable() {
            @Override
            public void run() {
                callback.onResult(false);
            }
        });
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:SigninManager.java


示例10: showConfirmSigninPagePreviousAccountCheck

import org.chromium.base.Callback; //导入依赖的package包/类
private void showConfirmSigninPagePreviousAccountCheck() {
    String accountName = getSelectedAccountName();
    ConfirmSyncDataStateMachine.run(PrefServiceBridge.getInstance().getSyncLastAccountName(),
            accountName, ImportSyncType.PREVIOUS_DATA_FOUND,
            mDelegate.getFragmentManager(),
            getContext(), new ConfirmImportSyncDataDialog.Listener() {
                @Override
                public void onConfirm(boolean wipeData) {
                    SigninManager.wipeSyncUserDataIfRequired(wipeData)
                            .then(new Callback<Void>() {
                                @Override
                                public void onResult(Void v) {
                                    showConfirmSigninPage();
                                }
                            });
                }

                @Override
                public void onCancel() {
                    setButtonsEnabled(true);
                }
            });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:AccountSigninView.java


示例11: onMostVisitedURLsAvailable

import org.chromium.base.Callback; //导入依赖的package包/类
@Override
public void onMostVisitedURLsAvailable(final String[] titles, final String[] urls,
        final String[] whitelistIconPaths, final int[] sources) {
    Set<String> urlSet = new HashSet<>(Arrays.asList(urls));

    // If no Most Visited items have been built yet, this is the initial load. Build the Most
    // Visited items immediately so the layout is stable during initial rendering. They can be
    // replaced later if there are offline urls, but that will not affect the layout widths and
    // heights. A stable layout enables reliable scroll position initialization.
    if (!mHasReceivedMostVisitedSites) {
        buildMostVisitedItems(titles, urls, whitelistIconPaths, null, sources);
    }

    // TODO(https://crbug.com/607573): We should show offline-available content in a nonblocking
    // way so that responsiveness of the NTP does not depend on ready availability of offline
    // pages.
    mManager.getUrlsAvailableOffline(urlSet, new Callback<Set<String>>() {
        @Override
        public void onResult(Set<String> offlineUrls) {
            buildMostVisitedItems(titles, urls, whitelistIconPaths, offlineUrls, sources);
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:NewTabPageView.java


示例12: createGsaClientAndConnect

import org.chromium.base.Callback; //导入依赖的package包/类
private void createGsaClientAndConnect(Context context) {
    Callback<Bundle> onMessageReceived = new Callback<Bundle>() {
        @Override
        public void onResult(Bundle result) {
            boolean supportsBroadcast =
                    result.getBoolean(KEY_SSB_BROADCASTS_ACCOUNT_CHANGE_TO_CHROME);
            if (supportsBroadcast) notifyGsaBroadcastsAccountChanges();
            // If GSA doesn't support the broadcast, we connect several times to the service per
            // Chrome session (since there is a disconnect() call in
            // ChromeActivity#onStopWithNative()). Only record the histogram once per startup to
            // avoid skewing the results.
            if (!mAlreadyReportedHistogram) {
                RecordHistogram.recordBooleanHistogram(
                        "Search.GsaBroadcastsAccountChanges", supportsBroadcast);
                mAlreadyReportedHistogram = true;
            }
        }
    };
    mClient = new GSAServiceClient(context, onMessageReceived);
    mClient.connect();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:GSAAccountChangeListener.java


示例13: runAsync

import org.chromium.base.Callback; //导入依赖的package包/类
@Override
public void runAsync(final TaskQueue queue) {
    WebsitePreferenceBridge.fetchLocalStorageInfo(new Callback<HashMap>() {
        @Override
        public void onResult(HashMap result) {
            for (Object o : result.entrySet()) {
                @SuppressWarnings("unchecked")
                Map.Entry<String, LocalStorageInfo> entry =
                        (Map.Entry<String, LocalStorageInfo>) o;
                WebsiteAddress address = WebsiteAddress.create(entry.getKey());
                if (address == null) continue;
                findOrCreateSite(address, null).setLocalStorageInfo(entry.getValue());
            }
            queue.next();
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:18,代码来源:WebsitePermissionsFetcher.java


示例14: shareImageDirectly

import org.chromium.base.Callback; //导入依赖的package包/类
/**
 * Share image triggered with the current context menu directly with a specific app.
 * @param name The {@link ComponentName} of the app to share the image directly with.
 */
public void shareImageDirectly(@Nullable final ComponentName name) {
    if (mNativeContextMenuHelper == 0) return;
    Callback<byte[]> callback = new Callback<byte[]>() {
        @Override
        public void onResult(byte[] result) {
            WebContents webContents = nativeGetJavaWebContents(mNativeContextMenuHelper);
            WindowAndroid windowAndroid = webContents.getTopLevelNativeWindow();

            Activity activity = windowAndroid.getActivity().get();
            if (activity == null) return;

            ShareHelper.shareImage(activity, result, name);
        }
    };
    nativeRetrieveImage(mNativeContextMenuHelper, callback, MAX_SHARE_DIMEN_PX);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:21,代码来源:ContextMenuHelper.java


示例15: start

import org.chromium.base.Callback; //导入依赖的package包/类
/**
 * Triggers to the native VariationsService that the application has entered the foreground.
 */
public void start(Context context) {
    // If |mRestrictModeFetchStarted| is true and |mRestrictMode| is null, then async
    // initializationn is in progress and nativeStartVariationsSession() will be called
    // when it completes.
    if (mRestrictModeFetchStarted && mRestrictMode == null) {
        return;
    }

    mRestrictModeFetchStarted = true;
    getRestrictModeValue(context, new Callback<String>() {
        @Override
        public void onResult(String restrictMode) {
            nativeStartVariationsSession(mRestrictMode);
        }
    });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:20,代码来源:VariationsSession.java


示例16: getRestrictModeValue

import org.chromium.base.Callback; //导入依赖的package包/类
/**
 * Asynchronously returns the value of the "restrict" URL param that the variations service
 * should use for variation seed requests. Public version that can be called externally.
 * Uses the protected version (that could be overridden by subclasses) to actually get the
 * value and also sets that value internally when retrieved.
 * @param callback Callback that will be called with the param value when available.
 */
public final void getRestrictModeValue(Context context, final Callback<String> callback) {
    // If |mRestrictMode| is not null, the value has already been fetched and so it can
    // simply be provided to the callback.
    if (mRestrictMode != null) {
        callback.onResult(mRestrictMode);
        return;
    }
    getRestrictMode(context, new Callback<String>() {
        @Override
        public void onResult(String restrictMode) {
            assert restrictMode != null;
            mRestrictMode = restrictMode;
            callback.onResult(restrictMode);
        }
    });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:24,代码来源:VariationsSession.java


示例17: startBackgroundRequestsImpl

import org.chromium.base.Callback; //导入依赖的package包/类
/**
 * Triggers processing of background offlining requests.  This is called when
 * system conditions are appropriate for background offlining, typically from the
 * GcmTaskService onRunTask() method.  In response, we will start the
 * task processing by passing the call along to the C++ RequestCoordinator.
 * Also starts UMA collection.
 *
 * @returns Whether processing will be carried out and completion will be indicated through a
 *     callback.
 */
static boolean startBackgroundRequestsImpl(BackgroundSchedulerProcessor bridge, Context context,
        Bundle taskExtras, Callback<Boolean> callback) {
    TriggerConditions triggerConditions =
            TaskExtrasPacker.unpackTriggerConditionsFromBundle(taskExtras);
    DeviceConditions currentConditions = DeviceConditions.getCurrentConditions(context);
    if (!currentConditions.isPowerConnected()
            && currentConditions.getBatteryPercentage()
                    < triggerConditions.getMinimumBatteryPercentage()) {
        Log.d(TAG, "Battery percentage is lower than minimum to start processing");
        return false;
    }

    if (SysUtils.isLowEndDevice() && ApplicationStatus.hasVisibleActivities()) {
        Log.d(TAG, "Application visible on low-end device so deferring background processing");
        return false;
    }

    // Gather UMA data to measure how often the user's machine is amenable to background
    // loading when we wake to do a task.
    long taskScheduledTimeMillis = TaskExtrasPacker.unpackTimeFromBundle(taskExtras);
    OfflinePageUtils.recordWakeupUMA(context, taskScheduledTimeMillis);

    return bridge.startScheduledProcessing(currentConditions, callback);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:35,代码来源:BackgroundOfflinerTask.java


示例18: didCloseTab

import org.chromium.base.Callback; //导入依赖的package包/类
@Override
public void didCloseTab(int tabId, boolean incognito) {
    Profile profile = mTabModelSelector.getModel(incognito).getProfile();
    OfflinePageBridge bridge = OfflinePageBridge.getForProfile(profile);
    if (bridge == null) return;

    // First, unregister the tab with the UI.
    bridge.unregisterRecentTab(tabId);

    // Then, delete any "Last N" offline pages as well.  This is an optimization because
    // the UI will no longer show the page, and the page would also be cleaned up by GC
    // given enough time.
    ClientId clientId =
            new ClientId(OfflinePageBridge.LAST_N_NAMESPACE, Integer.toString(tabId));
    List<ClientId> clientIds = new ArrayList<>();
    clientIds.add(clientId);

    bridge.deletePagesByClientId(clientIds, new Callback<Integer>() {
        @Override
        public void onResult(Integer result) {
            // Result is ignored.
        }
    });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:25,代码来源:OfflinePageUtils.java


示例19: runAsync

import org.chromium.base.Callback; //导入依赖的package包/类
@Override
public void runAsync(final TaskQueue queue) {
    WebsitePreferenceBridge.fetchStorageInfo(new Callback<ArrayList>() {
        @Override
        public void onResult(ArrayList result) {
            @SuppressWarnings("unchecked")
            ArrayList<StorageInfo> infoArray = result;

            for (StorageInfo info : infoArray) {
                WebsiteAddress address = WebsiteAddress.create(info.getHost());
                if (address == null) continue;
                findOrCreateSite(address, null).addStorageInfo(info);
            }
            queue.next();
        }
    });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:WebsitePermissionsFetcher.java


示例20: updateAsync

import org.chromium.base.Callback; //导入依赖的package包/类
/**
 * Updates a WebAPK installation.
 * @param packageName The package name of the WebAPK to install.
 * @param version The version of WebAPK to install.
 * @param title The title of the WebAPK to display during installation.
 * @param token The token from WebAPK Server.
 * @param url The start URL of the WebAPK to install.
 */
@CalledByNative
private void updateAsync(
        String packageName, int version, String title, String token, String url) {
    if (mInstallDelegate == null) {
        notify(WebApkInstallResult.FAILURE);
        return;
    }

    Callback<Integer> callback = new Callback<Integer>() {
        @Override
        public void onResult(Integer result) {
            WebApkInstaller.this.notify(result);
        }
    };
    mInstallDelegate.updateAsync(packageName, version, title, token, url, callback);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:25,代码来源:WebApkInstaller.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MuseArtifactPacket类代码示例发布时间:2022-05-16
下一篇:
Java IExpression类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap