use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class ChromeMediaRouter method createRoute.
/**
* Initiates route creation with the given parameters. Notifies the native client of success
* and 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 isIncognito whether the route is being requested from an Incognito profile.
* @param requestId the id of the route creation request tracked by the native side.
*/
@CalledByNative
public void createRoute(String sourceId, String sinkId, String presentationId, String origin, int tabId, boolean isIncognito, int requestId) {
MediaRouteProvider provider = getProviderForSource(sourceId);
if (provider == null) {
onRouteRequestError("No provider supports createRoute with source: " + sourceId + " and sink: " + sinkId, requestId);
return;
}
provider.createRoute(sourceId, sinkId, presentationId, origin, tabId, isIncognito, requestId);
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class ChromeMediaRouterDialogController method openRouteChooserDialog.
/**
* Shows the {@link MediaRouteChooserDialogFragment} if it's not shown yet.
* @param sourceUrn the URN identifying the media source to filter the devices with.
*/
@CalledByNative
public void openRouteChooserDialog(String sourceUrn) {
if (isShowingDialog())
return;
MediaSource source = MediaSource.from(sourceUrn);
if (source == null)
return;
mDialogManager = new MediaRouteChooserDialogManager(source, mApplicationContext, this);
mDialogManager.openDialog();
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class WebApkInstaller method installAsyncAndMonitorInstallationFromNative.
/**
* Installs a WebAPK and monitors the installation process.
* @param filePath File to install.
* @param packageName Package name to install WebAPK at.
* @return True if the install was started. A "true" return value does not guarantee that the
* install succeeds.
*/
@CalledByNative
private boolean installAsyncAndMonitorInstallationFromNative(String filePath, String packageName) {
if (!installingFromUnknownSourcesAllowed()) {
Log.e(TAG, "WebAPK install failed because installation from unknown sources is disabled.");
return false;
}
mIsInstall = true;
mWebApkPackageName = packageName;
// Start monitoring the installation.
PackageManager packageManager = ContextUtils.getApplicationContext().getPackageManager();
mInstallTask = new InstallerDelegate(Looper.getMainLooper(), packageManager, createInstallerDelegateObserver(), mWebApkPackageName);
mInstallTask.start();
// Start monitoring the application state changes.
mListener = createApplicationStateListener();
ApplicationStatus.registerApplicationStateListener(mListener);
return installDownloadedWebApk(filePath);
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class IntentHelper method openDateAndTimeSettings.
/**
* Opens date and time in Android settings.
*
* @param context The context for issuing the intent.
*/
@CalledByNative
static void openDateAndTimeSettings(Context context) {
Intent intent = new Intent(android.provider.Settings.ACTION_DATE_SETTINGS);
try {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} catch (android.content.ActivityNotFoundException ex) {
// If it doesn't work, avoid crashing.
}
}
use of org.chromium.base.annotations.CalledByNative in project AndroidChromium by JackyAndroid.
the class JavascriptAppModalDialog method showJavascriptAppModalDialog.
@CalledByNative
void showJavascriptAppModalDialog(WindowAndroid window, long nativeDialogPointer) {
assert window != null;
Context context = window.getActivity().get();
// If the activity has gone away, then just clean up the native pointer.
if (context == null) {
nativeDidCancelAppModalDialog(nativeDialogPointer, false);
return;
}
// Cache the native dialog pointer so that we can use it to return the response.
mNativeDialogPointer = nativeDialogPointer;
LayoutInflater inflater = LayoutInflater.from(context);
ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.js_modal_dialog, null);
mSuppressCheckBox = (CheckBox) layout.findViewById(R.id.suppress_js_modal_dialogs);
mPromptTextView = (TextView) layout.findViewById(R.id.js_modal_dialog_prompt);
prepare(layout);
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AlertDialogTheme).setView(layout).setTitle(mTitle).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
cancel(false);
}
});
if (mPositiveButtonTextId != 0)
builder.setPositiveButton(mPositiveButtonTextId, this);
if (mNegativeButtonTextId != 0)
builder.setNegativeButton(mNegativeButtonTextId, this);
mDialog = builder.create();
mDialog.setCanceledOnTouchOutside(false);
mDialog.getDelegate().setHandleNativeActionModesEnabled(false);
mDialog.show();
}
Aggregations