Commit 8e5da691 authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

AW: move variations code into separate folder

No change to logic. This moves WebView's variations code into separate
folders with distinct OWNERS files, updates BUILD rules, and applies
automatic code formatting from git-cl format.

Test: autoninja -C out/Default system_webview_apk
Test: run_webview_instrumentation_test_apk -f *Variations*
Test: gn check out/Default android_webview/browser/variations:variations
Test: gn check out/Default android_webview/browser:browser
Change-Id: If405f2f840d37861d38f8d5b221ed5f2bc36de69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2469356Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817130}
parent d76ce9bc
...@@ -400,7 +400,6 @@ generate_jni("browser_jni_headers") { ...@@ -400,7 +400,6 @@ generate_jni("browser_jni_headers") {
"java/src/org/chromium/android_webview/AwWebResourceResponse.java", "java/src/org/chromium/android_webview/AwWebResourceResponse.java",
"java/src/org/chromium/android_webview/JsReplyProxy.java", "java/src/org/chromium/android_webview/JsReplyProxy.java",
"java/src/org/chromium/android_webview/PopupTouchHandleDrawable.java", "java/src/org/chromium/android_webview/PopupTouchHandleDrawable.java",
"java/src/org/chromium/android_webview/VariationsSeedLoader.java",
"java/src/org/chromium/android_webview/WebMessageListenerHolder.java", "java/src/org/chromium/android_webview/WebMessageListenerHolder.java",
"java/src/org/chromium/android_webview/WebMessageListenerInfo.java", "java/src/org/chromium/android_webview/WebMessageListenerInfo.java",
"java/src/org/chromium/android_webview/gfx/AwDrawFnImpl.java", "java/src/org/chromium/android_webview/gfx/AwDrawFnImpl.java",
...@@ -411,6 +410,7 @@ generate_jni("browser_jni_headers") { ...@@ -411,6 +410,7 @@ generate_jni("browser_jni_headers") {
"java/src/org/chromium/android_webview/metrics/AwMetricsServiceClient.java", "java/src/org/chromium/android_webview/metrics/AwMetricsServiceClient.java",
"java/src/org/chromium/android_webview/permission/AwPermissionRequest.java", "java/src/org/chromium/android_webview/permission/AwPermissionRequest.java",
"java/src/org/chromium/android_webview/safe_browsing/AwSafeBrowsingConfigHelper.java", "java/src/org/chromium/android_webview/safe_browsing/AwSafeBrowsingConfigHelper.java",
"java/src/org/chromium/android_webview/variations/VariationsSeedLoader.java",
] ]
deps = [ ":cancellation_signal_android_jar_jni_headers" ] deps = [ ":cancellation_signal_android_jar_jni_headers" ]
...@@ -488,7 +488,6 @@ android_library("browser_java") { ...@@ -488,7 +488,6 @@ android_library("browser_java") {
"java/src/org/chromium/android_webview/ScriptReference.java", "java/src/org/chromium/android_webview/ScriptReference.java",
"java/src/org/chromium/android_webview/ScrollAccessibilityHelper.java", "java/src/org/chromium/android_webview/ScrollAccessibilityHelper.java",
"java/src/org/chromium/android_webview/SslUtil.java", "java/src/org/chromium/android_webview/SslUtil.java",
"java/src/org/chromium/android_webview/VariationsSeedLoader.java",
"java/src/org/chromium/android_webview/ViewPositionObserver.java", "java/src/org/chromium/android_webview/ViewPositionObserver.java",
"java/src/org/chromium/android_webview/WebMessageListener.java", "java/src/org/chromium/android_webview/WebMessageListener.java",
"java/src/org/chromium/android_webview/WebMessageListenerHolder.java", "java/src/org/chromium/android_webview/WebMessageListenerHolder.java",
...@@ -510,6 +509,7 @@ android_library("browser_java") { ...@@ -510,6 +509,7 @@ android_library("browser_java") {
"java/src/org/chromium/android_webview/safe_browsing/AwSafeBrowsingConfigHelper.java", "java/src/org/chromium/android_webview/safe_browsing/AwSafeBrowsingConfigHelper.java",
"java/src/org/chromium/android_webview/safe_browsing/AwSafeBrowsingConversionHelper.java", "java/src/org/chromium/android_webview/safe_browsing/AwSafeBrowsingConversionHelper.java",
"java/src/org/chromium/android_webview/safe_browsing/AwSafeBrowsingResponse.java", "java/src/org/chromium/android_webview/safe_browsing/AwSafeBrowsingResponse.java",
"java/src/org/chromium/android_webview/variations/VariationsSeedLoader.java",
] ]
deps = [ deps = [
":common_aidl_java", ":common_aidl_java",
......
...@@ -92,8 +92,6 @@ source_set("browser") { ...@@ -92,8 +92,6 @@ source_set("browser") {
"aw_speech_recognition_manager_delegate.h", "aw_speech_recognition_manager_delegate.h",
"aw_ssl_host_state_delegate.cc", "aw_ssl_host_state_delegate.cc",
"aw_ssl_host_state_delegate.h", "aw_ssl_host_state_delegate.h",
"aw_variations_service_client.cc",
"aw_variations_service_client.h",
"aw_web_contents_delegate.cc", "aw_web_contents_delegate.cc",
"aw_web_contents_delegate.h", "aw_web_contents_delegate.h",
"aw_web_contents_view_delegate.cc", "aw_web_contents_view_delegate.cc",
...@@ -174,8 +172,6 @@ source_set("browser") { ...@@ -174,8 +172,6 @@ source_set("browser") {
"tracing/aw_tracing_controller.h", "tracing/aw_tracing_controller.h",
"tracing/aw_tracing_delegate.cc", "tracing/aw_tracing_delegate.cc",
"tracing/aw_tracing_delegate.h", "tracing/aw_tracing_delegate.h",
"variations_seed_loader.cc",
"variations_seed_loader.h",
] ]
deps = [ deps = [
...@@ -184,6 +180,7 @@ source_set("browser") { ...@@ -184,6 +180,7 @@ source_set("browser") {
"//android_webview/browser/gfx", "//android_webview/browser/gfx",
"//android_webview/browser/lifecycle", "//android_webview/browser/lifecycle",
"//android_webview/browser/metrics", "//android_webview/browser/metrics",
"//android_webview/browser/variations",
"//android_webview/common", "//android_webview/common",
"//android_webview/proto:aw_variations_seed_proto", "//android_webview/proto:aw_variations_seed_proto",
"//base", "//base",
...@@ -239,7 +236,6 @@ source_set("browser") { ...@@ -239,7 +236,6 @@ source_set("browser") {
"//components/url_formatter", "//components/url_formatter",
"//components/user_prefs", "//components/user_prefs",
"//components/variations", "//components/variations",
"//components/variations/net",
"//components/variations/service", "//components/variations/service",
"//components/version_info", "//components/version_info",
"//components/version_info/android:channel_getter", "//components/version_info/android:channel_getter",
......
...@@ -3,3 +3,9 @@ per-file aw_content_browser_receiver_bindings.cc=file://ipc/SECURITY_OWNERS ...@@ -3,3 +3,9 @@ per-file aw_content_browser_receiver_bindings.cc=file://ipc/SECURITY_OWNERS
per-file aw_browser_policy_connector.h=file://chrome/browser/policy/OWNERS per-file aw_browser_policy_connector.h=file://chrome/browser/policy/OWNERS
per-file aw_browser_policy_connector.cc=file://chrome/browser/policy/OWNERS per-file aw_browser_policy_connector.cc=file://chrome/browser/policy/OWNERS
# For metrics-related changes
per-file aw_feature_list_creator.*=file://android_webview/browser/metrics/OWNERS
# For variations-related changes
per-file aw_feature_list_creator.*=file://android_webview/browser/variations/OWNERS
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "android_webview/browser/aw_browser_process.h" #include "android_webview/browser/aw_browser_process.h"
#include "android_webview/browser/aw_metrics_service_client_delegate.h" #include "android_webview/browser/aw_metrics_service_client_delegate.h"
#include "android_webview/browser/metrics/aw_metrics_service_client.h" #include "android_webview/browser/metrics/aw_metrics_service_client.h"
#include "android_webview/browser/variations_seed_loader.h" #include "android_webview/browser/variations/variations_seed_loader.h"
#include "android_webview/proto/aw_variations_seed.pb.h" #include "android_webview/proto/aw_variations_seed.pb.h"
#include "base/base_switches.h" #include "base/base_switches.h"
#include "base/bind.h" #include "base/bind.h"
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "android_webview/browser/aw_browser_policy_connector.h" #include "android_webview/browser/aw_browser_policy_connector.h"
#include "android_webview/browser/aw_field_trials.h" #include "android_webview/browser/aw_field_trials.h"
#include "android_webview/browser/aw_variations_service_client.h" #include "android_webview/browser/variations/aw_variations_service_client.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "components/policy/core/browser/browser_policy_connector_base.h" #include "components/policy/core/browser/browser_policy_connector_base.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
......
# Copyright 2020 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.
source_set("variations") {
sources = [
"aw_variations_service_client.cc",
"aw_variations_service_client.h",
"variations_seed_loader.cc",
"variations_seed_loader.h",
]
deps = [
"//android_webview:browser_jni_headers",
"//android_webview/proto:aw_variations_seed_proto",
"//components/variations",
"//components/variations/net",
"//components/variations/service",
"//components/version_info/android:channel_getter",
]
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "android_webview/browser/aw_variations_service_client.h" #include "android_webview/browser/variations/aw_variations_service_client.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/threading/scoped_blocking_call.h" #include "base/threading/scoped_blocking_call.h"
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ANDROID_WEBVIEW_BROWSER_AW_VARIATIONS_SERVICE_CLIENT_H_ #ifndef ANDROID_WEBVIEW_BROWSER_VARIATIONS_AW_VARIATIONS_SERVICE_CLIENT_H_
#define ANDROID_WEBVIEW_BROWSER_AW_VARIATIONS_SERVICE_CLIENT_H_ #define ANDROID_WEBVIEW_BROWSER_VARIATIONS_AW_VARIATIONS_SERVICE_CLIENT_H_
#include <string> #include <string>
...@@ -37,4 +37,4 @@ class AwVariationsServiceClient : public variations::VariationsServiceClient { ...@@ -37,4 +37,4 @@ class AwVariationsServiceClient : public variations::VariationsServiceClient {
} // namespace android_webview } // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_AW_VARIATIONS_SERVICE_CLIENT_H_ #endif // ANDROID_WEBVIEW_BROWSER_VARIATIONS_AW_VARIATIONS_SERVICE_CLIENT_H_
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <jni.h> #include <jni.h>
#include <string> #include <string>
#include "android_webview/browser/variations_seed_loader.h" #include "android_webview/browser/variations/variations_seed_loader.h"
#include "android_webview/browser_jni_headers/VariationsSeedLoader_jni.h" #include "android_webview/browser_jni_headers/VariationsSeedLoader_jni.h"
#include "android_webview/proto/aw_variations_seed.pb.h" #include "android_webview/proto/aw_variations_seed.pb.h"
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef ANDROID_WEBVIEW_BROWSER_VARIATIONS_SEED_LOADER_H_ #ifndef ANDROID_WEBVIEW_BROWSER_VARIATIONS_VARIATIONS_SEED_LOADER_H_
#define ANDROID_WEBVIEW_BROWSER_VARIATIONS_SEED_LOADER_H_ #define ANDROID_WEBVIEW_BROWSER_VARIATIONS_VARIATIONS_SEED_LOADER_H_
#include <memory> #include <memory>
...@@ -15,4 +15,4 @@ std::unique_ptr<AwVariationsSeed> TakeSeed(); ...@@ -15,4 +15,4 @@ std::unique_ptr<AwVariationsSeed> TakeSeed();
} // namespace android_webview } // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_VARIATIONS_SEED_LOADER_H_ #endif // ANDROID_WEBVIEW_BROWSER_VARIATIONS_VARIATIONS_SEED_LOADER_H_
...@@ -32,11 +32,11 @@ import org.chromium.android_webview.AwTracingController; ...@@ -32,11 +32,11 @@ import org.chromium.android_webview.AwTracingController;
import org.chromium.android_webview.HttpAuthDatabase; import org.chromium.android_webview.HttpAuthDatabase;
import org.chromium.android_webview.ProductConfig; import org.chromium.android_webview.ProductConfig;
import org.chromium.android_webview.R; import org.chromium.android_webview.R;
import org.chromium.android_webview.VariationsSeedLoader;
import org.chromium.android_webview.WebViewChromiumRunQueue; import org.chromium.android_webview.WebViewChromiumRunQueue;
import org.chromium.android_webview.common.AwResource; import org.chromium.android_webview.common.AwResource;
import org.chromium.android_webview.common.AwSwitches; import org.chromium.android_webview.common.AwSwitches;
import org.chromium.android_webview.gfx.AwDrawFnImpl; import org.chromium.android_webview.gfx.AwDrawFnImpl;
import org.chromium.android_webview.variations.VariationsSeedLoader;
import org.chromium.base.BuildConfig; import org.chromium.base.BuildConfig;
import org.chromium.base.BuildInfo; import org.chromium.base.BuildInfo;
import org.chromium.base.BundleUtils; import org.chromium.base.BundleUtils;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
package org.chromium.android_webview; package org.chromium.android_webview.variations;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
...@@ -18,6 +18,7 @@ import android.os.SystemClock; ...@@ -18,6 +18,7 @@ import android.os.SystemClock;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import org.chromium.android_webview.AwBrowserProcess;
import org.chromium.android_webview.common.AwSwitches; import org.chromium.android_webview.common.AwSwitches;
import org.chromium.android_webview.common.services.IVariationsSeedServer; import org.chromium.android_webview.common.services.IVariationsSeedServer;
import org.chromium.android_webview.common.services.IVariationsSeedServerCallback; import org.chromium.android_webview.common.services.IVariationsSeedServerCallback;
...@@ -292,16 +293,17 @@ public class VariationsSeedLoader { ...@@ -292,16 +293,17 @@ public class VariationsSeedLoader {
public void start() { public void start() {
try { try {
if (!ContextUtils.getApplicationContext() if (!ContextUtils.getApplicationContext().bindService(
.bindService(getServerIntent(), this, Context.BIND_AUTO_CREATE)) { getServerIntent(), this, Context.BIND_AUTO_CREATE)) {
Log.e(TAG, "Failed to bind to WebView service"); Log.e(TAG, "Failed to bind to WebView service");
} }
// Connect to nonembedded metrics Service at the same time we connect to variation // Connect to nonembedded metrics Service at the same time we connect to variation
// service. // service.
AwBrowserProcess.collectNonembeddedMetrics(); AwBrowserProcess.collectNonembeddedMetrics();
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
Log.e(TAG, "WebView provider \"" + AwBrowserProcess.getWebViewPackageName() + Log.e(TAG,
"\" not found!"); "WebView provider \"" + AwBrowserProcess.getWebViewPackageName()
+ "\" not found!");
} }
} }
...@@ -389,8 +391,8 @@ public class VariationsSeedLoader { ...@@ -389,8 +391,8 @@ public class VariationsSeedLoader {
} }
ParcelFileDescriptor newSeedFd = null; ParcelFileDescriptor newSeedFd = null;
try { try {
newSeedFd = ParcelFileDescriptor.open( newSeedFd =
newSeedFile, ParcelFileDescriptor.MODE_WRITE_ONLY); ParcelFileDescriptor.open(newSeedFile, ParcelFileDescriptor.MODE_WRITE_ONLY);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Log.e(TAG, "Failed to open seed file " + newSeedFile); Log.e(TAG, "Failed to open seed file " + newSeedFile);
return; return;
......
...@@ -2,3 +2,7 @@ per-file AwMetricsIntegrationTest.java=ntfschr@chromium.org ...@@ -2,3 +2,7 @@ per-file AwMetricsIntegrationTest.java=ntfschr@chromium.org
per-file CookieManagerStartupTest.java=ntfschr@chromium.org per-file CookieManagerStartupTest.java=ntfschr@chromium.org
per-file CookieManagerTest.java=ntfschr@chromium.org per-file CookieManagerTest.java=ntfschr@chromium.org
per-file SafeBrowsingTest.java=ntfschr@chromium.org per-file SafeBrowsingTest.java=ntfschr@chromium.org
# Variations
per-file AwVariationsSeedFetcherTest*=file://android_webview/browser/variations/OWNERS
per-file Variations*=file://android_webview/browser/variations/OWNERS
...@@ -20,12 +20,12 @@ import org.junit.Rule; ...@@ -20,12 +20,12 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.android_webview.VariationsSeedLoader;
import org.chromium.android_webview.common.AwSwitches; import org.chromium.android_webview.common.AwSwitches;
import org.chromium.android_webview.common.variations.VariationsServiceMetricsHelper; import org.chromium.android_webview.common.variations.VariationsServiceMetricsHelper;
import org.chromium.android_webview.common.variations.VariationsUtils; import org.chromium.android_webview.common.variations.VariationsUtils;
import org.chromium.android_webview.test.services.MockVariationsSeedServer; import org.chromium.android_webview.test.services.MockVariationsSeedServer;
import org.chromium.android_webview.test.util.VariationsTestUtils; import org.chromium.android_webview.test.util.VariationsTestUtils;
import org.chromium.android_webview.variations.VariationsSeedLoader;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
......
...@@ -14,10 +14,10 @@ import org.junit.Test; ...@@ -14,10 +14,10 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.android_webview.AwFeatureList; import org.chromium.android_webview.AwFeatureList;
import org.chromium.android_webview.VariationsSeedLoader;
import org.chromium.android_webview.common.AwFeatures; import org.chromium.android_webview.common.AwFeatures;
import org.chromium.android_webview.common.variations.VariationsUtils; import org.chromium.android_webview.common.variations.VariationsUtils;
import org.chromium.android_webview.test.util.VariationsTestUtils; import org.chromium.android_webview.test.util.VariationsTestUtils;
import org.chromium.android_webview.variations.VariationsSeedLoader;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.components.variations.StudyOuterClass.Study; import org.chromium.components.variations.StudyOuterClass.Study;
......
file://android_webview/nonembedded/OWNERS file://android_webview/nonembedded/OWNERS
# Variations
per-file MockVariationsSeedServer*=file://android_webview/browser/variations/OWNERS
per-file VariationsSeedServerTest*=file://android_webview/browser/variations/OWNERS
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment