This source file includes following definitions.
- WillStartRequest
- WillProcessResponse
- GetNameForLogging
- ActivatePowerSaveBlocker
#include "content/browser/loader/power_save_block_resource_throttle.h"
#include "content/public/browser/power_save_blocker.h"
namespace content {
namespace {
const int kPowerSaveBlockDelaySeconds = 30;
}
PowerSaveBlockResourceThrottle::PowerSaveBlockResourceThrottle() {
}
PowerSaveBlockResourceThrottle::~PowerSaveBlockResourceThrottle() {
}
void PowerSaveBlockResourceThrottle::WillStartRequest(bool* defer) {
timer_.Start(FROM_HERE,
base::TimeDelta::FromSeconds(kPowerSaveBlockDelaySeconds),
this,
&PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker);
}
void PowerSaveBlockResourceThrottle::WillProcessResponse(bool* defer) {
power_save_blocker_.reset();
timer_.Stop();
}
const char* PowerSaveBlockResourceThrottle::GetNameForLogging() const {
return "PowerSaveBlockResourceThrottle";
}
void PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker() {
power_save_blocker_ = PowerSaveBlocker::Create(
PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
"Uploading data.");
}
}