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

Unified Diff: android_webview/native/aw_metrics_log_uploader.cc

Issue 2863233002: [WebView] Move files from native to browser (Closed)
Patch Set: Created 3 years, 7 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: android_webview/native/aw_metrics_log_uploader.cc
diff --git a/android_webview/native/aw_metrics_log_uploader.cc b/android_webview/native/aw_metrics_log_uploader.cc
deleted file mode 100644
index fb714b8b1a42fa0f284609cc1bc120b01e1b8e4a..0000000000000000000000000000000000000000
--- a/android_webview/native/aw_metrics_log_uploader.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.
-
-#include "android_webview/native/aw_metrics_log_uploader.h"
-
-#include "android_webview/jni/AwMetricsLogUploader_jni.h"
-#include "base/android/jni_array.h"
-#include "components/metrics/log_decoder.h"
-
-using base::android::ScopedJavaLocalRef;
-using base::android::ToJavaByteArray;
-
-namespace android_webview {
-
-AwMetricsLogUploader::AwMetricsLogUploader(
- const metrics::MetricsLogUploader::UploadCallback& on_upload_complete)
- : on_upload_complete_(on_upload_complete) {}
-
-AwMetricsLogUploader::~AwMetricsLogUploader() {}
-
-void AwMetricsLogUploader::UploadLog(const std::string& compressed_log_data,
- const std::string& log_hash) {
- // WebView uses the platform logging mechanism instead of the normal UMA
- // server. The platform mechanism does its own compression, so undo the
- // previous compression.
- std::string log_data;
- if (!metrics::DecodeLogData(compressed_log_data, &log_data)) {
- // If the log is corrupt, pretend the server rejected it (HTTP Bad Request).
- on_upload_complete_.Run(400, 0);
- return;
- }
-
- JNIEnv* env = base::android::AttachCurrentThread();
- ScopedJavaLocalRef<jbyteArray> java_data = ToJavaByteArray(
- env, reinterpret_cast<const uint8_t*>(log_data.data()), log_data.size());
- Java_AwMetricsLogUploader_uploadLog(env, java_data);
-
- // The platform mechanism doesn't provide a response code or any way to handle
- // failures, so we have nothing to pass to on_upload_complete. Just pass 200
- // (HTTP OK) with error code 0 and pretend everything is peachy.
- on_upload_complete_.Run(200, 0);
-}
-
-} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698