This source file includes following definitions.
- SetDisableDriveAPI
- IsDriveAPIDisabled
#include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "chrome/browser/sync_file_system/logger.h"
namespace sync_file_system {
namespace {
const char kDisableDriveAPI[] = "disable-drive-api-for-syncfs";
bool is_drive_api_disabled = false;
}
void SetDisableDriveAPI(bool flag) {
is_drive_api_disabled = flag;
}
bool IsDriveAPIDisabled() {
return is_drive_api_disabled ||
CommandLine::ForCurrentProcess()->HasSwitch(kDisableDriveAPI);
}
ScopedDisableDriveAPI::ScopedDisableDriveAPI()
: was_disabled_(IsDriveAPIDisabled()) {
SetDisableDriveAPI(true);
}
ScopedDisableDriveAPI::~ScopedDisableDriveAPI() {
DCHECK(IsDriveAPIDisabled());
SetDisableDriveAPI(was_disabled_);
}
}