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

Unified Diff: components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java

Issue 2660963002: Cronet: a framework to provide alternative Cronet implementations (Closed)
Patch Set: Created 3 years, 11 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: components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java
diff --git a/components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java b/components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..911bd041886ab0b5ce8c89fe3e466bcffcfb77ae
--- /dev/null
+++ b/components/cronet/android/java/src/org/chromium/net/impl/NativeCronetEngineBuilderImpl.java
@@ -0,0 +1,40 @@
+// 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.impl;
+
+import android.content.Context;
+
+import org.chromium.net.ExperimentalCronetEngine;
+import org.chromium.net.ICronetEngineBuilder;
+
+/**
+ * Implementation of {@link ICronetEngineBuilder} that builds native Cronet engine.
+ */
+public class NativeCronetEngineBuilderImpl extends CronetEngineBuilderImpl {
+ /**
+ * Builder for Native Cronet Engine.
+ * Default config enables SPDY, disables QUIC, SDCH and HTTP cache.
+ *
+ * @param context Android {@link Context} for engine to use.
+ */
+ public NativeCronetEngineBuilderImpl(Context context) {
+ super(context);
+ }
+
+ @Override
+ public ExperimentalCronetEngine build() {
+ if (getUserAgent() == null) {
+ setUserAgent(getDefaultUserAgent());
+ }
+
+ ExperimentalCronetEngine builder = new CronetUrlRequestContext(this);
+
+ // Clear MOCK_CERT_VERIFIER reference if there is any, since
+ // the ownership has been transferred to the engine.
+ mMockCertVerifier = 0;
+
+ return builder;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698