org.chromium.chrome.browser.contextualsearch.ContextualSearchFieldTrial Java Examples

The following examples show how to use org.chromium.chrome.browser.contextualsearch.ContextualSearchFieldTrial. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChromeActivity.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void initializeCompositor() {
    TraceEvent.begin("ChromeActivity:CompositorInitialization");
    super.initializeCompositor();

    setTabContentManager(new TabContentManager(this, getContentOffsetProvider(),
            DeviceClassManager.enableSnapshots()));
    mCompositorViewHolder.onNativeLibraryReady(mWindowAndroid, getTabContentManager());

    if (isContextualSearchAllowed() && ContextualSearchFieldTrial.isEnabled()) {
        mContextualSearchManager = new ContextualSearchManager(this, mWindowAndroid, this);
    }

    if (ReaderModeManager.isEnabled(this)) {
        mReaderModeManager = new ReaderModeManager(getTabModelSelector(), this);
        if (mToolbarManager != null) {
            mToolbarManager.addFindToolbarObserver(
                    mReaderModeManager.getFindToolbarObserver());
        }
    }

    TraceEvent.end("ChromeActivity:CompositorInitialization");
}
 
Example #2
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void initializeCompositor() {
    TraceEvent.begin("ChromeActivity:CompositorInitialization");
    super.initializeCompositor();

    setTabContentManager(new TabContentManager(this, getContentOffsetProvider(),
            DeviceClassManager.enableSnapshots()));
    mCompositorViewHolder.onNativeLibraryReady(mWindowAndroid, getTabContentManager());

    if (isContextualSearchAllowed() && ContextualSearchFieldTrial.isEnabled()) {
        mContextualSearchManager = new ContextualSearchManager(this, mWindowAndroid, this);
    }

    if (ReaderModeManager.isEnabled(this)) {
        mReaderModeManager = new ReaderModeManager(getTabModelSelector(), this);
        if (mToolbarManager != null) {
            mToolbarManager.addFindToolbarObserver(
                    mReaderModeManager.getFindToolbarObserver());
        }
    }

    TraceEvent.end("ChromeActivity:CompositorInitialization");
}
 
Example #3
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void initializeCompositor() {
    TraceEvent.begin("ChromeActivity:CompositorInitialization");
    super.initializeCompositor();

    setTabContentManager(new TabContentManager(this, getContentOffsetProvider(),
            DeviceClassManager.enableSnapshots()));
    mCompositorViewHolder.onNativeLibraryReady(getWindowAndroid(), getTabContentManager());

    if (isContextualSearchAllowed() && ContextualSearchFieldTrial.isEnabled()) {
        mContextualSearchManager = new ContextualSearchManager(this, this);
    }

    if (ReaderModeManager.isEnabled(this)) {
        mReaderModeManager = new ReaderModeManager(getTabModelSelector(), this);
        if (mToolbarManager != null) {
            mToolbarManager.addFindToolbarObserver(
                    mReaderModeManager.getFindToolbarObserver());
        }
    }

    TraceEvent.end("ChromeActivity:CompositorInitialization");
}
 
Example #4
Source File: PrivacyPreferences.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();
    privacyPrefManager.migrateNetworkPredictionPreferences();
    addPreferencesFromResource(R.xml.privacy_preferences);
    getActivity().setTitle(R.string.prefs_privacy);
    setHasOptionsMenu(true);

    mManagedPreferenceDelegate = createManagedPreferenceDelegate();

    ChromeBaseCheckBoxPreference networkPredictionPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
    networkPredictionPref.setChecked(
            PrefServiceBridge.getInstance().getNetworkPredictionEnabled());
    networkPredictionPref.setOnPreferenceChangeListener(this);
    networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    // Display the correct settings fragment according to the user experiment group and to type
    // of the device, by removing not applicable preference fragments.
    CrashDumpUploadPreference uploadCrashDumpPref =
            (CrashDumpUploadPreference) findPreference(PREF_CRASH_DUMP_UPLOAD);
    ChromeBaseCheckBoxPreference uploadCrashDumpNoCellularPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR);

    PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (privacyPrefManager.isCellularExperimentEnabled()) {
        preferenceScreen.removePreference(uploadCrashDumpNoCellularPref);
        preferenceScreen.removePreference(uploadCrashDumpPref);
    } else {
        preferenceScreen.removePreference(findPreference(PREF_USAGE_AND_CRASH_REPORTING));
        if (privacyPrefManager.isMobileNetworkCapable()) {
            preferenceScreen.removePreference(uploadCrashDumpNoCellularPref);
            uploadCrashDumpPref.setOnPreferenceChangeListener(this);
            uploadCrashDumpPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
        } else {
            preferenceScreen.removePreference(uploadCrashDumpPref);
            uploadCrashDumpNoCellularPref.setOnPreferenceChangeListener(this);
            uploadCrashDumpNoCellularPref.setManagedPreferenceDelegate(
                    mManagedPreferenceDelegate);
        }
    }

    ChromeBaseCheckBoxPreference navigationErrorPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NAVIGATION_ERROR);
    navigationErrorPref.setOnPreferenceChangeListener(this);
    navigationErrorPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference searchSuggestionsPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
    searchSuggestionsPref.setOnPreferenceChangeListener(this);
    searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    if (!ContextualSearchFieldTrial.isEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_CONTEXTUAL_SEARCH));
    }

    ChromeBaseCheckBoxPreference safeBrowsingExtendedReportingPref =
            (ChromeBaseCheckBoxPreference) findPreference(
                    PREF_SAFE_BROWSING_EXTENDED_REPORTING);
    safeBrowsingExtendedReportingPref.setOnPreferenceChangeListener(this);
    safeBrowsingExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference safeBrowsingPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
    safeBrowsingPref.setOnPreferenceChangeListener(this);
    safeBrowsingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    if (!PhysicalWeb.featureIsEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_PHYSICAL_WEB));
    }

    updateSummaries();
}
 
Example #5
Source File: PrivacyPreferences.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();
    privacyPrefManager.migrateNetworkPredictionPreferences();
    addPreferencesFromResource(R.xml.privacy_preferences);
    getActivity().setTitle(R.string.prefs_privacy);
    setHasOptionsMenu(true);
    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();

    mManagedPreferenceDelegate = createManagedPreferenceDelegate();

    ChromeBaseCheckBoxPreference networkPredictionPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
    networkPredictionPref.setChecked(prefServiceBridge.getNetworkPredictionEnabled());
    networkPredictionPref.setOnPreferenceChangeListener(this);
    networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference navigationErrorPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NAVIGATION_ERROR);
    navigationErrorPref.setOnPreferenceChangeListener(this);
    navigationErrorPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference searchSuggestionsPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
    searchSuggestionsPref.setOnPreferenceChangeListener(this);
    searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (!ContextualSearchFieldTrial.isEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_CONTEXTUAL_SEARCH));
    }

    // Listen to changes to both Extended Reporting prefs.
    ChromeBaseCheckBoxPreference legacyExtendedReportingPref =
            (ChromeBaseCheckBoxPreference) findPreference(
                PREF_SAFE_BROWSING_EXTENDED_REPORTING);
    legacyExtendedReportingPref.setOnPreferenceChangeListener(this);
    legacyExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    ChromeBaseCheckBoxPreference scoutReportingPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_SCOUT_REPORTING);
    scoutReportingPref.setOnPreferenceChangeListener(this);
    scoutReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    // Remove the extended reporting preference that is NOT active.
    String extended_reporting_pref_to_remove =
            prefServiceBridge.isSafeBrowsingScoutReportingActive()
                ? PREF_SAFE_BROWSING_EXTENDED_REPORTING : PREF_SAFE_BROWSING_SCOUT_REPORTING;
    preferenceScreen.removePreference(findPreference(extended_reporting_pref_to_remove));

    ChromeBaseCheckBoxPreference safeBrowsingPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
    safeBrowsingPref.setOnPreferenceChangeListener(this);
    safeBrowsingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    if (!PhysicalWeb.featureIsEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_PHYSICAL_WEB));
    }

    updateSummaries();
}
 
Example #6
Source File: PrivacyPreferences.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();
    privacyPrefManager.migrateNetworkPredictionPreferences();
    PreferenceUtils.addPreferencesFromResource(this, R.xml.privacy_preferences);
    getActivity().setTitle(R.string.prefs_privacy);
    setHasOptionsMenu(true);
    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();

    mManagedPreferenceDelegate = createManagedPreferenceDelegate();

    ChromeBaseCheckBoxPreference networkPredictionPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
    networkPredictionPref.setChecked(prefServiceBridge.getNetworkPredictionEnabled());
    networkPredictionPref.setOnPreferenceChangeListener(this);
    networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference navigationErrorPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NAVIGATION_ERROR);
    navigationErrorPref.setOnPreferenceChangeListener(this);
    navigationErrorPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference searchSuggestionsPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
    searchSuggestionsPref.setOnPreferenceChangeListener(this);
    searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    if (ChromeFeatureList.isEnabled(ChromeFeatureList.CONTENT_SUGGESTIONS_SETTINGS)) {
        searchSuggestionsPref.setTitle(R.string.search_site_suggestions_title);
        searchSuggestionsPref.setSummary(R.string.search_site_suggestions_summary);
    }

    PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (!ContextualSearchFieldTrial.isEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_CONTEXTUAL_SEARCH));
    }

    // Listen to changes to both Extended Reporting prefs.
    ChromeBaseCheckBoxPreference legacyExtendedReportingPref =
            (ChromeBaseCheckBoxPreference) findPreference(
                PREF_SAFE_BROWSING_EXTENDED_REPORTING);
    legacyExtendedReportingPref.setOnPreferenceChangeListener(this);
    legacyExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    ChromeBaseCheckBoxPreference scoutReportingPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_SCOUT_REPORTING);
    scoutReportingPref.setOnPreferenceChangeListener(this);
    scoutReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    // Remove the extended reporting preference that is NOT active.
    String extended_reporting_pref_to_remove =
            prefServiceBridge.isSafeBrowsingScoutReportingActive()
                ? PREF_SAFE_BROWSING_EXTENDED_REPORTING : PREF_SAFE_BROWSING_SCOUT_REPORTING;
    preferenceScreen.removePreference(findPreference(extended_reporting_pref_to_remove));

    ChromeBaseCheckBoxPreference safeBrowsingPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
    safeBrowsingPref.setOnPreferenceChangeListener(this);
    safeBrowsingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    if (!PhysicalWeb.featureIsEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_PHYSICAL_WEB));
    }

    if (ClearBrowsingDataTabsFragment.isFeatureEnabled()) {
        findPreference(PREF_CLEAR_BROWSING_DATA)
                .setFragment(ClearBrowsingDataTabsFragment.class.getName());
    }

    updateSummaries();
}