Natalie Chouinard | 8f550d97 | 2019-03-11 20:28:05 | [diff] [blame] | 1 | // Copyright 2019 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 | #include "chrome/browser/android/feed/feed_debugging_bridge.h" |
| 6 | |
| 7 | #include "base/android/jni_string.h" |
| 8 | #include "jni/FeedDebuggingBridge_jni.h" |
| 9 | #include "url/gurl.h" |
| 10 | |
| 11 | namespace feed { |
| 12 | |
| 13 | GURL GetFeedFetchUrlForDebugging() { |
| 14 | JNIEnv* env = base::android::AttachCurrentThread(); |
| 15 | base::android::ScopedJavaLocalRef<jstring> j_string = |
| 16 | Java_FeedDebuggingBridge_getFeedFetchUrl(env); |
| 17 | return GURL(ConvertJavaStringToUTF8(env, j_string)); |
| 18 | } |
| 19 | |
Natalie Chouinard | b9529ab | 2019-03-12 16:46:08 | [diff] [blame] | 20 | std::string GetFeedProcessScopeDumpForDebugging() { |
| 21 | JNIEnv* env = base::android::AttachCurrentThread(); |
| 22 | base::android::ScopedJavaLocalRef<jstring> j_string = |
| 23 | Java_FeedDebuggingBridge_getFeedProcessScopeDump(env); |
| 24 | return ConvertJavaStringToUTF8(env, j_string); |
| 25 | } |
| 26 | |
Natalie Chouinard | a8eec11 | 2019-03-20 23:23:16 | [diff] [blame] | 27 | void TriggerRefreshForDebugging() { |
| 28 | JNIEnv* env = base::android::AttachCurrentThread(); |
| 29 | Java_FeedDebuggingBridge_triggerRefresh(env); |
| 30 | } |
| 31 | |
Natalie Chouinard | 8f550d97 | 2019-03-11 20:28:05 | [diff] [blame] | 32 | } // namespace feed |