| Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/BandwidthType.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/BandwidthType.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/BandwidthType.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ef6eb195c02d43bb412bd70fe2c62e136ae3f0f3
|
| --- /dev/null
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/BandwidthType.java
|
| @@ -0,0 +1,46 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.chrome.browser.preferences.privacy;
|
| +
|
| +/**
|
| + * Bandwidth options available based on network.
|
| + */
|
| +public enum BandwidthType {
|
| +
|
| + // Still using "prerender" in the strings for historical reasons: we don't want to break
|
| + // existing users' settings.
|
| + NEVER_PRERENDER ("never_prefetch"),
|
| + PRERENDER_ON_WIFI ("prefetch_on_wifi"),
|
| + ALWAYS_PRERENDER ("always_prefetch");
|
| +
|
| + public static final BandwidthType DEFAULT = PRERENDER_ON_WIFI;
|
| +
|
| + private final String mTitle;
|
| +
|
| + BandwidthType(String title) {
|
| + mTitle = title;
|
| + }
|
| +
|
| + /**
|
| + * Returns the title of the bandwidthType.
|
| + * @return title
|
| + */
|
| + public String title() {
|
| + return mTitle;
|
| + }
|
| +
|
| + /**
|
| + * Get the BandwidthType from the title.
|
| + * @param title
|
| + * @return BandwidthType
|
| + */
|
| + public static BandwidthType getBandwidthFromTitle(String title) {
|
| + for (BandwidthType b : BandwidthType.values()) {
|
| + if (b.mTitle.equals(title)) return b;
|
| + }
|
| + assert false;
|
| + return DEFAULT;
|
| + }
|
| +}
|
|
|