Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.net; | |
| 6 | |
| 7 import android.content.Context; | |
| 8 | |
| 9 /** | |
| 10 * Provides a factory method to create {@link CronetEngine.Builder} instances. | |
| 11 * A {@code CronetEngine.Builder} instance can be used to create a specific {@li nk CronetEngine} | |
| 12 * implementation. To get the list of available {@link CronetProvider}s call | |
| 13 * {@link CronetProviders#getAllProviders(Context)}. | |
| 14 * <p/> | |
| 15 * Every implementation of {@code CronetProvider} <b>must</b> have a public | |
| 16 * constructor that accepts a single {@link Context} parameter. | |
|
pauljensen
2017/01/23 14:44:29
I don't think embedders should generally be extend
kapishnikov
2017/01/23 18:16:53
Removed. Also, this class is hidden now.
| |
| 17 * <p/> | |
| 18 * Since the same instance of {@code CronetProvider} can be accessed from multip le | |
| 19 * threads, all subclasses of this class should be thread-safe. | |
|
pauljensen
2017/01/23 14:44:28
I don't think this is necessary. I think APIs are
kapishnikov
2017/01/23 18:16:52
Removed.
| |
| 20 * <p/> | |
| 21 * <b>NOTE:</b> This class is for advanced users that want to select a particula r | |
| 22 * Cronet implementation. Most users should simply use {@code new} {@link | |
| 23 * CronetEngine.Builder#CronetEngine.Builder(android.content.Context)}. | |
| 24 */ | |
| 25 public abstract class CronetProvider { | |
| 26 protected final Context mContext; | |
| 27 | |
| 28 protected CronetProvider(Context context) { | |
| 29 mContext = context; | |
| 30 } | |
| 31 | |
| 32 /** | |
| 33 * Creates and returns an instance of {@link CronetEngine.Builder}. | |
|
pauljensen
2017/01/23 14:44:28
Perhaps we should restate the NOTE here:
This meth
kapishnikov
2017/01/23 18:16:52
Done.
| |
| 34 * | |
| 35 * @return {@code CronetEngine.Builder}. | |
| 36 * @throws IllegalStateException if the provider is not enabled. | |
|
pauljensen
2017/01/23 14:44:29
enabled -> enabled (see {@link #isEnabled}
kapishnikov
2017/01/23 18:16:53
Done.
| |
| 37 */ | |
| 38 public abstract CronetEngine.Builder createBuilder(); | |
| 39 | |
| 40 /** | |
| 41 * Returns the provider name. The well-know provider names include: | |
| 42 * <ul> | |
| 43 * <li>{@link CronetProviders#PROVIDER_NAME_NATIVE}</li> | |
| 44 * <li>{@link CronetProviders#PROVIDER_NAME_PLATFORM}</li> | |
| 45 * </ul> | |
| 46 * | |
| 47 * @return provider name. | |
| 48 */ | |
| 49 public abstract String getName(); | |
| 50 | |
| 51 /** | |
| 52 * Returns the provider version. The version can be used to select the newes t | |
| 53 * available provider if multiple providers are available. | |
| 54 * | |
| 55 * @return provider version. | |
| 56 */ | |
| 57 public abstract String getVersion(); | |
| 58 | |
| 59 /** | |
| 60 * Returns whether the provider is enabled and can be used to instantiate th e Cronet engine. | |
| 61 * Please read the provider documentation for the instructions how to enable it. | |
|
pauljensen
2017/01/23 14:44:28
for the instructions how to enable it-> for enable
kapishnikov
2017/01/23 18:16:52
Done.
| |
| 62 * | |
| 63 * @return true if the provider is enabled. | |
|
pauljensen
2017/01/23 14:44:28
true -> {@code true}
| |
| 64 */ | |
| 65 public abstract boolean isEnabled(); | |
| 66 | |
| 67 @Override | |
| 68 public String toString() { | |
| 69 StringBuilder b = new StringBuilder("["); | |
| 70 b.append("class=").append(getClass().getName()); | |
| 71 b.append(", ").append("name=").append(getName()); | |
| 72 b.append(", ").append("version=").append(getVersion()); | |
| 73 b.append(", ").append("enabled=").append(isEnabled()); | |
| 74 b.append("]"); | |
| 75 return b.toString(); | |
| 76 } | |
| 77 } | |
| OLD | NEW |