本文整理汇总了Java中org.chromium.chrome.browser.util.ChromeFileProvider类的典型用法代码示例。如果您正苦于以下问题:Java ChromeFileProvider类的具体用法?Java ChromeFileProvider怎么用?Java ChromeFileProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChromeFileProvider类属于org.chromium.chrome.browser.util包,在下文中一共展示了ChromeFileProvider类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: triggerShare
import org.chromium.chrome.browser.util.ChromeFileProvider; //导入依赖的package包/类
private void triggerShare(
final Tab currentTab, final boolean shareDirectly, boolean isIncognito) {
final Activity mainActivity = this;
WebContents webContents = currentTab.getWebContents();
RecordHistogram.recordBooleanHistogram(
"OfflinePages.SharedPageWasOffline", currentTab.isOfflinePage());
boolean canShareOfflinePage = OfflinePageBridge.isPageSharingEnabled();
// Share an empty blockingUri in place of screenshot file. The file ready notification is
// sent by onScreenshotReady call below when the file is written.
final Uri blockingUri = (isIncognito || webContents == null)
? null
: ChromeFileProvider.generateUriAndBlockAccess(mainActivity);
if (canShareOfflinePage) {
OfflinePageUtils.shareOfflinePage(shareDirectly, true, mainActivity, null,
blockingUri, null, currentTab);
} else {
ShareHelper.share(shareDirectly, true, mainActivity, currentTab.getTitle(), null,
currentTab.getUrl(), null, blockingUri, null);
if (shareDirectly) {
RecordUserAction.record("MobileMenuDirectShare");
} else {
RecordUserAction.record("MobileMenuShare");
}
}
if (blockingUri == null) return;
// Start screenshot capture and notify the provider when it is ready.
ContentBitmapCallback callback = new ContentBitmapCallback() {
@Override
public void onFinishGetBitmap(Bitmap bitmap, int response) {
ShareHelper.saveScreenshotToDisk(bitmap, mainActivity,
new Callback<Uri>() {
@Override
public void onResult(Uri result) {
// Unblock the file once it is saved to disk.
ChromeFileProvider.notifyFileReady(blockingUri, result);
}
});
}
};
if (!mScreenshotCaptureSkippedForTesting) {
webContents.getContentBitmapAsync(Bitmap.Config.ARGB_8888, 1.f, EMPTY_RECT, callback);
} else {
callback.onFinishGetBitmap(null, ReadbackResponse.SURFACE_UNAVAILABLE);
}
}
示例2: triggerShare
import org.chromium.chrome.browser.util.ChromeFileProvider; //导入依赖的package包/类
private void triggerShare(
final Tab currentTab, final boolean shareDirectly, boolean isIncognito) {
final Activity mainActivity = this;
WebContents webContents = currentTab.getWebContents();
RecordHistogram.recordBooleanHistogram(
"OfflinePages.SharedPageWasOffline", OfflinePageUtils.isOfflinePage(currentTab));
boolean canShareOfflinePage = OfflinePageBridge.isPageSharingEnabled();
// Share an empty blockingUri in place of screenshot file. The file ready notification is
// sent by onScreenshotReady call below when the file is written.
final Uri blockingUri = (isIncognito || webContents == null)
? null
: ChromeFileProvider.generateUriAndBlockAccess(mainActivity);
if (canShareOfflinePage) {
OfflinePageUtils.shareOfflinePage(shareDirectly, true, mainActivity, null,
blockingUri, null, currentTab);
} else {
ShareHelper.share(shareDirectly, true, mainActivity, currentTab.getTitle(), null,
currentTab.getUrl(), null, blockingUri, null);
if (shareDirectly) {
RecordUserAction.record("MobileMenuDirectShare");
} else {
RecordUserAction.record("MobileMenuShare");
}
}
if (blockingUri == null) return;
// Start screenshot capture and notify the provider when it is ready.
ContentBitmapCallback callback = new ContentBitmapCallback() {
@Override
public void onFinishGetBitmap(Bitmap bitmap, int response) {
ShareHelper.saveScreenshotToDisk(bitmap, mainActivity,
new Callback<Uri>() {
@Override
public void onResult(Uri result) {
// Unblock the file once it is saved to disk.
ChromeFileProvider.notifyFileReady(blockingUri, result);
}
});
}
};
if (mScreenshotCaptureSkippedForTesting) {
callback.onFinishGetBitmap(null, ReadbackResponse.SURFACE_UNAVAILABLE);
} else {
webContents.getContentBitmapAsync(0, 0, callback);
}
}