本文整理汇总了Java中org.chromium.chrome.browser.physicalweb.PhysicalWeb类的典型用法代码示例。如果您正苦于以下问题:Java PhysicalWeb类的具体用法?Java PhysicalWeb怎么用?Java PhysicalWeb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PhysicalWeb类属于org.chromium.chrome.browser.physicalweb包,在下文中一共展示了PhysicalWeb类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRequestPermissionsResult
import org.chromium.chrome.browser.physicalweb.PhysicalWeb; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
int[] grantResults) {
switch (requestCode) {
case REQUEST_ID:
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
PhysicalWebUma.onPrefsLocationGranted(getActivity());
Log.d(TAG, "Location permission granted");
PhysicalWeb.startPhysicalWeb();
} else {
PhysicalWebUma.onPrefsLocationDenied(getActivity());
Log.d(TAG, "Location permission denied");
}
break;
default:
}
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:19,代码来源:PhysicalWebPreferenceFragment.java
示例2: onRequestPermissionsResult
import org.chromium.chrome.browser.physicalweb.PhysicalWeb; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
int[] grantResults) {
switch (requestCode) {
case REQUEST_ID:
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
PhysicalWebUma.onPrefsLocationGranted();
Log.d(TAG, "Location permission granted");
} else {
PhysicalWebUma.onPrefsLocationDenied();
Log.d(TAG, "Location permission denied");
}
break;
default:
}
PhysicalWeb.updateScans();
}
示例3: setPhysicalWebEnabled
import org.chromium.chrome.browser.physicalweb.PhysicalWeb; //导入依赖的package包/类
/**
* Sets the Physical Web preference, which enables background scanning for bluetooth beacons
* and displays a notification when beacons are found.
*
* @param enabled A boolean indicating whether to notify on nearby beacons.
*/
public void setPhysicalWebEnabled(boolean enabled) {
int state = enabled ? PHYSICAL_WEB_ON : PHYSICAL_WEB_OFF;
boolean isOnboarding = isPhysicalWebOnboarding();
mSharedPreferences.edit().putInt(PREF_PHYSICAL_WEB, state).apply();
if (enabled) {
if (!isOnboarding) {
PhysicalWeb.startPhysicalWeb();
}
} else {
PhysicalWeb.stopPhysicalWeb();
}
}
示例4: setPhysicalWebEnabled
import org.chromium.chrome.browser.physicalweb.PhysicalWeb; //导入依赖的package包/类
/**
* Sets the Physical Web preference, which enables background scanning for bluetooth beacons
* and displays a notification when beacons are found.
*
* @param enabled A boolean indicating whether to notify on nearby beacons.
*/
public void setPhysicalWebEnabled(boolean enabled) {
mSharedPreferences.edit()
.putInt(PREF_PHYSICAL_WEB, enabled ? PHYSICAL_WEB_ON : PHYSICAL_WEB_OFF)
.apply();
PhysicalWeb.updateScans();
}
示例5: initLaunchButton
import org.chromium.chrome.browser.physicalweb.PhysicalWeb; //导入依赖的package包/类
private void initLaunchButton() {
ButtonPreference physicalWebLaunch =
(ButtonPreference) findPreference(PREF_PHYSICAL_WEB_LAUNCH);
physicalWebLaunch.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
PhysicalWebUma.onActivityReferral(PhysicalWebUma.PREFERENCE_REFERER);
PhysicalWeb.showUrlList();
return true;
}
});
}
示例6: initDeferredStartupForApp
import org.chromium.chrome.browser.physicalweb.PhysicalWeb; //导入依赖的package包/类
/**
* Handle application level deferred startup tasks that can be lazily done after all
* the necessary initialization has been completed. Any calls requiring network access should
* probably go here.
*
* Keep these tasks short and break up long tasks into multiple smaller tasks, as they run on
* the UI thread and are blocking. Remember to follow RAIL guidelines, as much as possible, and
* that most devices are quite slow, so leave enough buffer.
*/
@UiThread
public void initDeferredStartupForApp() {
if (mDeferredStartupInitializedForApp) return;
mDeferredStartupInitializedForApp = true;
ThreadUtils.assertOnUiThread();
RecordHistogram.recordLongTimesHistogram(
"UMA.Debug.EnableCrashUpload.DeferredStartUptime2",
SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
TimeUnit.MILLISECONDS);
mDeferredTasks.add(new Runnable() {
@Override
public void run() {
// Punt all tasks that may block on disk off onto a background thread.
initAsyncDiskTask();
AfterStartupTaskUtils.setStartupComplete();
PartnerBrowserCustomizations.setOnInitializeAsyncFinished(new Runnable() {
@Override
public void run() {
String homepageUrl = HomepageManager.getHomepageUri(mAppContext);
LaunchMetrics.recordHomePageLaunchMetrics(
HomepageManager.isHomepageEnabled(mAppContext),
NewTabPage.isNTPUrl(homepageUrl), homepageUrl);
}
});
PartnerBookmarksShim.kickOffReading(mAppContext);
PowerMonitor.create(mAppContext);
ShareHelper.clearSharedImages();
OfflinePageUtils.clearSharedOfflineFiles(mAppContext);
}
});
mDeferredTasks.add(new Runnable() {
@Override
public void run() {
// Clear any media notifications that existed when Chrome was last killed.
MediaCaptureNotificationService.clearMediaNotifications(mAppContext);
startModerateBindingManagementIfNeeded();
recordKeyboardLocaleUma();
}
});
mDeferredTasks.add(new Runnable() {
@Override
public void run() {
// Start or stop Physical Web
PhysicalWeb.onChromeStart();
}
});
final ChromeApplication application = (ChromeApplication) mAppContext;
mDeferredTasks.add(new Runnable() {
@Override
public void run() {
// Starts syncing with GSA.
application.createGsaHelper().startSync();
}
});
ProcessInitializationHandler.getInstance().initializeDeferredStartupTasks();
}
示例7: onCreate
import org.chromium.chrome.browser.physicalweb.PhysicalWeb; //导入依赖的package包/类
@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();
}
示例8: onCreate
import org.chromium.chrome.browser.physicalweb.PhysicalWeb; //导入依赖的package包/类
@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();
}