#include "data_saver.h"
#include <optional>
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#if BUILDFLAG(IS_ANDROID)
#include "chrome/android/chrome_jni_headers/DataSaverOSSetting_jni.h"
#endif
namespace {
std::optional<bool> g_override_data_saver_for_testing;
#if BUILDFLAG(IS_ANDROID)
std::optional<bool> g_cached_data_saver_setting;
base::TimeTicks g_last_setting_check_time;
bool IsDataSaverEnabledBlockingCall() {
JNIEnv* env = jni_zero::AttachCurrentThread();
return datareduction::android::Java_DataSaverOSSetting_isDataSaverEnabled(
env);
}
#endif
}
namespace data_saver {
void OverrideIsDataSaverEnabledForTesting(bool flag) { … }
void ResetIsDataSaverEnabledForTesting() { … }
void FetchDataSaverOSSettingAsynchronously() { … }
bool IsDataSaverEnabled() { … }
}