Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2834)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java

Issue 978623002: New UMA settings fragment for Chrome on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test fixed Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
index 57df391dc04b5f57ddb2bd2dcc541c0b2cd37a86..07e24faf4460c723e1e75de3bb3001d0e038ca9a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
@@ -25,8 +25,7 @@ import java.util.List;
* preferences should be grouped with their relevant functionality but this is a grab-bag for other
* preferences.
*/
-public final class PrefServiceBridge {
-
+public class PrefServiceBridge {
// Does not need sync with native; used for the popup settings check
public static final String EXCEPTION_SETTING_ALLOW = "allow";
public static final String EXCEPTION_SETTING_BLOCK = "block";
@@ -107,6 +106,10 @@ public final class PrefServiceBridge {
TemplateUrlService.getInstance().load();
}
+ protected PrefServiceBridge(boolean forTestingOnly) {
gone 2015/03/09 19:53:28 nit: protected & public methods require javadocs
gayane -on leave until 09-2017 2015/03/09 23:07:25 Done.
+ if (!forTestingOnly) getInstance();
+ }
+
private static PrefServiceBridge sInstance;
/**
@@ -118,6 +121,10 @@ public final class PrefServiceBridge {
return sInstance;
}
+ public static void setInstanceForTesting(PrefServiceBridge instance) {
+ sInstance = instance;
+ }
+
/**
* @return Whether the preferences have been initialized.
*/
@@ -761,6 +768,27 @@ public final class PrefServiceBridge {
return nativeGetSupervisedUserSecondCustodianProfileImageURL();
}
+ /**
+ * @return whether Metrics reporting is enabled
gone 2015/03/09 19:53:28 Add @VisibleForTesting to every method that you us
gayane -on leave until 09-2017 2015/03/09 23:07:25 I have Mock PrefServiceBridge which overrides thes
gone 2015/03/09 23:11:00 if your MockPrefServiceBridge is only used in Test
gayane -on leave until 09-2017 2015/03/10 15:56:21 Done.
+ */
+ public boolean isMetricsReportingEnabled() {
+ return nativeGetMetricsReportingEnabled();
+ }
+
+ /**
+ * Sets whether the metrics reporting should be enabled.
+ */
+ public void setMetricsReportingEnabled(boolean enabled) {
+ nativeSetMetricsReportingEnabled(enabled);
+ }
+
+ /**
+ * Sets whether the metrics reporting should be enabled.
gone 2015/03/09 19:53:28 nit: fix this comment. not sure if the name "is s
gayane -on leave until 09-2017 2015/03/09 23:07:25 Comment fixed. I renamed the function to hasSetMet
+ */
+ public boolean isSetMetricsReporting() {
+ return nativeIsSetMetricsReporting();
+ }
+
private native boolean nativeGetAcceptCookiesEnabled();
private native boolean nativeGetAcceptCookiesManaged();
private native boolean nativeGetBlockThirdPartyCookiesEnabled();
@@ -841,4 +869,7 @@ public final class PrefServiceBridge {
private native String nativeGetSupervisedUserSecondCustodianName();
private native String nativeGetSupervisedUserSecondCustodianEmail();
private native String nativeGetSupervisedUserSecondCustodianProfileImageURL();
+ private native boolean nativeGetMetricsReportingEnabled();
+ private native void nativeSetMetricsReportingEnabled(boolean enabled);
+ private native boolean nativeIsSetMetricsReporting();
}

Powered by Google App Engine
This is Rietveld 408576698