1 // Copyright (c) 2013 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.
5 #ifndef CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_
6 #define CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/timer/timer.h"
12 #include "content/public/browser/resource_throttle.h"
16 class PowerSaveBlocker;
18 // This ResourceThrottle blocks power save until large upload request finishes.
19 class PowerSaveBlockResourceThrottle : public ResourceThrottle {
21 PowerSaveBlockResourceThrottle();
22 virtual ~PowerSaveBlockResourceThrottle();
24 // ResourceThrottle overrides:
25 virtual void WillStartRequest(bool* defer) OVERRIDE;
26 virtual void WillProcessResponse(bool* defer) OVERRIDE;
29 void ActivatePowerSaveBlocker();
31 base::OneShotTimer<PowerSaveBlockResourceThrottle> timer_;
32 scoped_ptr<PowerSaveBlocker> power_save_blocker_;
34 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockResourceThrottle);
37 } // namespace content
39 #endif // CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_