use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class Tab method swapWebContents.
/** This is currently called when committing a pre-rendered page. */
@VisibleForTesting
@CalledByNative
public void swapWebContents(WebContents webContents, boolean didStartLoad, boolean didFinishLoad) {
ContentViewCore cvc = new ContentViewCore(mThemedApplicationContext, PRODUCT_VERSION);
ContentView cv = ContentView.createContentView(mThemedApplicationContext, cvc);
cv.setContentDescription(mThemedApplicationContext.getResources().getString(R.string.accessibility_content_view));
cvc.initialize(ViewAndroidDelegate.createBasicDelegate(cv), cv, webContents, getWindowAndroid());
swapContentViewCore(cvc, false, didStartLoad, didFinishLoad);
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class Tab method setPendingPrint.
@CalledByNative
public void setPendingPrint() {
PrintingController printingController = PrintingControllerImpl.getInstance();
if (printingController == null)
return;
printingController.setPendingPrint(new TabPrinter(this), new PrintManagerDelegateImpl(getActivity()));
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class PermissionUpdateInfoBarDelegate method requestPermissions.
@CalledByNative
private void requestPermissions() {
WindowAndroid windowAndroid = mContentViewCore.getWindowAndroid();
if (windowAndroid == null) {
nativeOnPermissionResult(mNativePtr, false);
return;
}
boolean canRequestAllPermissions = true;
for (int i = 0; i < mAndroidPermisisons.length; i++) {
canRequestAllPermissions &= (windowAndroid.hasPermission(mAndroidPermisisons[i]) || windowAndroid.canRequestPermission(mAndroidPermisisons[i]));
}
if (canRequestAllPermissions) {
windowAndroid.requestPermissions(mAndroidPermisisons, this);
} else {
Activity activity = windowAndroid.getActivity().get();
if (activity == null) {
nativeOnPermissionResult(mNativePtr, false);
return;
}
mActivityStateListener = new ActivityStateListener() {
@Override
public void onActivityStateChange(Activity activity, int newState) {
if (newState == ActivityState.DESTROYED) {
ApplicationStatus.unregisterActivityStateListener(this);
mActivityStateListener = null;
nativeOnPermissionResult(mNativePtr, false);
} else if (newState == ActivityState.RESUMED) {
ApplicationStatus.unregisterActivityStateListener(this);
mActivityStateListener = null;
notifyPermissionResult();
}
}
};
ApplicationStatus.registerStateListenerForActivity(mActivityStateListener, activity);
Intent settingsIntent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
settingsIntent.setData(Uri.parse("package:" + windowAndroid.getApplicationContext().getPackageName()));
settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(settingsIntent);
}
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class ChromeMediaRouter method joinRoute.
/**
* Initiates route joining with the given parameters. Notifies the native client of success
* or failure.
* @param sourceId the id of the {@link MediaSource} to route to the sink.
* @param sinkId the id of the {@link MediaSink} to route the source to.
* @param presentationId the id of the presentation to be used by the page.
* @param origin the origin of the frame requesting a new route.
* @param tabId the id of the tab the requesting frame belongs to.
* @param requestId the id of the route creation request tracked by the native side.
*/
@CalledByNative
public void joinRoute(String sourceId, String presentationId, String origin, int tabId, int requestId) {
MediaRouteProvider provider = getProviderForSource(sourceId);
if (provider == null) {
onRouteRequestError("Route not found.", requestId);
return;
}
provider.joinRoute(sourceId, presentationId, origin, tabId, requestId);
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class ChromeMediaRouter method closeRoute.
/**
* Closes the route specified by the id.
* @param routeId the id of the route to close.
*/
@CalledByNative
public void closeRoute(String routeId) {
MediaRouteProvider provider = mRouteIdsToProviders.get(routeId);
if (provider == null)
return;
provider.closeRoute(routeId);
}
Aggregations