use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.
the class ProcessInitializationHandler method handlePostNativeInitialization.
/**
* Performs the post native initialization.
*/
protected void handlePostNativeInitialization() {
final ChromeApplication application = (ChromeApplication) ContextUtils.getApplicationContext();
DataReductionProxySettings.reconcileDataReductionProxyEnabledState(application);
ChromeActivitySessionTracker.getInstance().initializeWithNative();
ChromeApplication.removeSessionCookies();
AppBannerManager.setAppDetailsDelegate(application.createAppDetailsDelegate());
ChromeLifetimeController.initialize();
PrefServiceBridge.getInstance().migratePreferences(application);
}
use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.
the class DomDistillerUIUtils method reportFeedbackWithWebContents.
/**
* A static method for native code to open the external feedback form UI.
* @param webContents The WebContents containing the distilled content.
* @param url The URL to report feedback for.
* @param good True if the feedback is good and false if not.
*/
@CalledByNative
public static void reportFeedbackWithWebContents(WebContents webContents, String url, final boolean good) {
ThreadUtils.assertOnUiThread();
// TODO(mdjones): It would be better to get the WebContents from the manager so that the
// native code does not need to depend on RenderFrame.
Activity activity = getActivityFromWebContents(webContents);
if (activity == null)
return;
if (sFeedbackReporter == null) {
ChromeApplication application = (ChromeApplication) activity.getApplication();
sFeedbackReporter = application.createFeedbackReporter();
}
FeedbackCollector.create(activity, Profile.getLastUsedProfile(), url, new FeedbackCollector.FeedbackResult() {
@Override
public void onResult(FeedbackCollector collector) {
String quality = good ? DISTILLATION_QUALITY_GOOD : DISTILLATION_QUALITY_BAD;
collector.add(DISTILLATION_QUALITY_KEY, quality);
sFeedbackReporter.reportFeedback(collector);
}
});
}
use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.
the class RevenueStats method getInstance.
/**
* Returns the singleton instance of ExternalAuthUtils, creating it if needed.
*/
public static RevenueStats getInstance() {
if (sInstance.get() == null) {
ChromeApplication application = (ChromeApplication) ContextUtils.getApplicationContext();
sInstance.compareAndSet(null, application.createRevenueStatsInstance());
}
return sInstance.get();
}
use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.
the class TabWebContentsDelegateAndroid method addNewContents.
@CalledByNative
public boolean addNewContents(WebContents sourceWebContents, WebContents webContents, int disposition, Rect initialPosition, boolean userGesture) {
assert mWebContentsUrlMapping.first == webContents;
TabCreator tabCreator = mTab.getActivity().getTabCreator(mTab.isIncognito());
assert tabCreator != null;
// Grab the URL, which might not be available via the Tab.
String url = mWebContentsUrlMapping.second;
mWebContentsUrlMapping = null;
// Skip opening a new Tab if it doesn't make sense.
if (mTab.isClosing())
return false;
// Creating new Tabs asynchronously requires starting a new Activity to create the Tab,
// so the Tab returned will always be null. There's no way to know synchronously
// whether the Tab is created, so assume it's always successful.
boolean createdSuccessfully = tabCreator.createTabWithWebContents(mTab, webContents, mTab.getId(), TabLaunchType.FROM_LONGPRESS_FOREGROUND, url);
boolean success = tabCreator.createsTabsAsynchronously() || createdSuccessfully;
if (success && disposition == WindowOpenDisposition.NEW_POPUP) {
PolicyAuditor auditor = ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
auditor.notifyAuditEvent(mTab.getApplicationContext(), AuditEvent.OPEN_POPUP_URL_SUCCESS, url, "");
}
return success;
}
use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.
the class TabWebContentsObserver method didFinishLoad.
@Override
public void didFinishLoad(long frameId, String validatedUrl, boolean isMainFrame) {
if (isMainFrame)
mTab.didFinishPageLoad();
PolicyAuditor auditor = ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
auditor.notifyAuditEvent(mTab.getApplicationContext(), AuditEvent.OPEN_URL_SUCCESS, validatedUrl, "");
}
Aggregations