Chromium Code Reviews| Index: components/cronet/android/api/src/org/chromium/net/CronetProvider.java |
| diff --git a/components/cronet/android/api/src/org/chromium/net/CronetProvider.java b/components/cronet/android/api/src/org/chromium/net/CronetProvider.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7a709b3c9ae21c451a96c86550e608e5d6a4aebb |
| --- /dev/null |
| +++ b/components/cronet/android/api/src/org/chromium/net/CronetProvider.java |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2017 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.net; |
| + |
| +import android.content.Context; |
| + |
| +/** |
| + * |
|
pauljensen
2017/01/20 17:13:35
empty line
kapishnikov
2017/01/20 21:48:38
Done.
|
| + * A Cronet implementation provider. Note: every implementation of CronetProvider |
|
pauljensen
2017/01/20 17:13:35
I don't understand the "Note"...there is only one
pauljensen
2017/01/20 17:13:35
I think we need to add more description here. Lik
kapishnikov
2017/01/20 21:48:38
A subclass can have a different constructor that a
|
| + * must have a public constructor that accepts a single {@link Context} parameter. |
| + * <p/> |
| + * <b>NOTE:</b> This class is for advanced users that want to select a particular |
| + * Cronet implementation. Most users should simply use {@code new} {@link |
| + * CronetEngine.Builder#CronetEngine.Builder(android.content.Context)}. |
|
pauljensen
2017/01/20 17:13:35
Might want to put this NOTE at the top.
kapishnikov
2017/01/20 21:48:38
Javadoc uses the first sentence to create the shor
|
| + */ |
| +public abstract class CronetProvider { |
| + protected final Context mContext; |
| + |
| + protected CronetProvider(Context context) { |
| + mContext = context; |
| + } |
| + |
| + /** |
| + * Creates and returns {@link CronetEngine.Builder}. |
|
pauljensen
2017/01/20 17:13:35
returns->returns an instance of
kapishnikov
2017/01/20 21:48:38
Done.
|
| + * |
| + * @return {@code CronetEngine.Builder}. |
| + */ |
| + public abstract CronetEngine.Builder createBuilder(); |
| + |
| + /** |
| + * Returns the provider name. |
|
pauljensen
2017/01/20 17:13:35
Include @links to statically defined names.
kapishnikov
2017/01/20 21:48:38
Done.
|
| + * |
| + * @return provider name. |
| + */ |
| + public abstract String getName(); |
| + |
| + /** |
| + * Returns the provider version. |
|
pauljensen
2017/01/20 17:13:35
Mention that this can be used to select newest (i.
kapishnikov
2017/01/20 21:48:38
Done.
|
| + * |
| + * @return provider version. |
| + */ |
| + public abstract String getVersion(); |
| + |
| + /** |
| + * Returns whether the provider is enabled and can be used to instantiate the Cronet engine. |
|
pauljensen
2017/01/20 17:13:35
Mention that if isEnabled() returns false there ar
kapishnikov
2017/01/20 21:48:38
Done.
|
| + * |
| + * @return true if the provider is enabled. |
| + */ |
| + public abstract boolean isEnabled(); |
| + |
| + @Override |
| + public String toString() { |
| + StringBuilder b = new StringBuilder("["); |
| + b.append("class=").append(getClass().getName()); |
| + b.append(", ").append("name=").append(getName()); |
| + b.append(", ").append("version=").append(getVersion()); |
| + b.append(", ").append("enabled=").append(isEnabled()); |
| + b.append("]"); |
| + return b.toString(); |
| + } |
| +} |