Search in sources :

Example 1 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class ChildAccountFeedbackReporter method reportFeedback.

public static void reportFeedback(Activity activity, final String description, String url) {
    ThreadUtils.assertOnUiThread();
    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) {
            collector.setDescription(description);
            sFeedbackReporter.reportFeedback(collector);
        }
    });
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) FeedbackCollector(org.chromium.chrome.browser.feedback.FeedbackCollector)

Example 2 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class AccountManagementFragment method configureGoogleActivityControls.

private void configureGoogleActivityControls() {
    Preference pref = findPreference(PREF_GOOGLE_ACTIVITY_CONTROLS);
    pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            Activity activity = getActivity();
            ((ChromeApplication) (activity.getApplicationContext())).createGoogleActivityController().openWebAndAppActivitySettings(activity, ChromeSigninController.get(activity).getSignedInAccountName());
            RecordUserAction.record("Signin_AccountSettings_GoogleActivityControlsClicked");
            return true;
        }
    });
}
Also used : OnPreferenceClickListener(android.preference.Preference.OnPreferenceClickListener) ChromeApplication(org.chromium.chrome.browser.ChromeApplication) ChromeBasePreference(org.chromium.chrome.browser.preferences.ChromeBasePreference) SyncPreference(org.chromium.chrome.browser.preferences.SyncPreference) Preference(android.preference.Preference) Activity(android.app.Activity)

Example 3 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class TabWebContentsObserver method didFailLoad.

@Override
public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, int errorCode, String description, String failingUrl, boolean wasIgnoredByHandler) {
    mTab.updateThemeColorIfNeeded(true);
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidFailLoad(mTab, isProvisionalLoad, isMainFrame, errorCode, description, failingUrl);
    }
    if (isMainFrame)
        mTab.didFailPageLoad(errorCode);
    PolicyAuditor auditor = ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
    auditor.notifyAuditEvent(mTab.getApplicationContext(), AuditEvent.OPEN_URL_FAILURE, failingUrl, description);
    if (errorCode == BLOCKED_BY_ADMINISTRATOR) {
        auditor.notifyAuditEvent(mTab.getApplicationContext(), AuditEvent.OPEN_URL_BLOCKED, failingUrl, "");
    }
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) PolicyAuditor(org.chromium.chrome.browser.policy.PolicyAuditor)

Example 4 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class TabWebContentsObserver method didAttachInterstitialPage.

@Override
public void didAttachInterstitialPage() {
    mTab.getInfoBarContainer().setVisibility(View.INVISIBLE);
    mTab.showRenderedPage();
    mTab.updateThemeColorIfNeeded(false);
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidAttachInterstitialPage(mTab);
    }
    mTab.notifyLoadProgress(mTab.getProgress());
    mTab.updateFullscreenEnabledState();
    PolicyAuditor auditor = ((ChromeApplication) mTab.getApplicationContext()).getPolicyAuditor();
    auditor.notifyCertificateFailure(PolicyAuditor.nativeGetCertificateFailure(mTab.getWebContents()), mTab.getApplicationContext());
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) PolicyAuditor(org.chromium.chrome.browser.policy.PolicyAuditor)

Example 5 with ChromeApplication

use of org.chromium.chrome.browser.ChromeApplication in project AndroidChromium by JackyAndroid.

the class ProcessInitializationHandler method handleDeferredStartupTasksInitialization.

/**
 * Performs the deferred startup task initialization.
 */
protected void handleDeferredStartupTasksInitialization() {
    final ChromeApplication application = (ChromeApplication) ContextUtils.getApplicationContext();
    DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {

        @Override
        public void run() {
            ForcedSigninProcessor.start(application);
            AccountsChangedReceiver.addObserver(new AccountsChangedReceiver.AccountsChangedObserver() {

                @Override
                public void onAccountsChanged(Context context, Intent intent) {
                    ThreadUtils.runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            ForcedSigninProcessor.start(application);
                        }
                    });
                }
            });
        }
    });
    DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {

        @Override
        public void run() {
            GoogleServicesManager.get(application).onMainActivityStart();
            RevenueStats.getInstance();
        }
    });
    DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {

        @Override
        public void run() {
            mDevToolsServer = new DevToolsServer(DEV_TOOLS_SERVER_SOCKET_PREFIX);
            mDevToolsServer.setRemoteDebuggingEnabled(true, DevToolsServer.Security.ALLOW_DEBUG_PERMISSION);
        }
    });
    DeferredStartupHandler.getInstance().addDeferredTask(new Runnable() {

        @Override
        public void run() {
            // is fixed.
            assert !CommandLine.getInstance().hasSwitch(ContentSwitches.SWITCH_PROCESS_TYPE);
            if (!CommandLine.getInstance().hasSwitch(ContentSwitches.SWITCH_PROCESS_TYPE)) {
                DownloadController.setDownloadNotificationService(DownloadManagerService.getDownloadManagerService(application));
            }
            if (ApiCompatibilityUtils.isPrintingSupported()) {
                String errorText = application.getResources().getString(R.string.error_printing_failed);
                PrintingControllerImpl.create(new PrintDocumentAdapterWrapper(), errorText);
            }
        }
    });
}
Also used : Context(android.content.Context) ChromeApplication(org.chromium.chrome.browser.ChromeApplication) DevToolsServer(org.chromium.chrome.browser.DevToolsServer) PrintDocumentAdapterWrapper(org.chromium.printing.PrintDocumentAdapterWrapper) Intent(android.content.Intent)

Aggregations

ChromeApplication (org.chromium.chrome.browser.ChromeApplication)17 PolicyAuditor (org.chromium.chrome.browser.policy.PolicyAuditor)4 Activity (android.app.Activity)3 Context (android.content.Context)3 SuppressFBWarnings (org.chromium.base.annotations.SuppressFBWarnings)3 CalledByNative (org.chromium.base.annotations.CalledByNative)2 FeedbackCollector (org.chromium.chrome.browser.feedback.FeedbackCollector)2 Intent (android.content.Intent)1 Preference (android.preference.Preference)1 OnPreferenceClickListener (android.preference.Preference.OnPreferenceClickListener)1 View (android.view.View)1 ProcessInitException (org.chromium.base.library_loader.ProcessInitException)1 DevToolsServer (org.chromium.chrome.browser.DevToolsServer)1 UuidBasedUniqueIdentificationGenerator (org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator)1 ChromeBasePreference (org.chromium.chrome.browser.preferences.ChromeBasePreference)1 SyncPreference (org.chromium.chrome.browser.preferences.SyncPreference)1 TabCreator (org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator)1 ChildProcessCreationParams (org.chromium.content.browser.ChildProcessCreationParams)1 PrintDocumentAdapterWrapper (org.chromium.printing.PrintDocumentAdapterWrapper)1 UiUtils (org.chromium.ui.UiUtils)1