Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_ |
| 6 #define CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_ | 6 #define CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_ |
| 7 | 7 |
| 8 #include <string> | |
| 9 | |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 12 #include "content/public/browser/resource_throttle.h" | 14 #include "content/public/browser/resource_throttle.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 class PowerSaveBlocker; | 18 class PowerSaveBlocker; |
| 17 | 19 |
| 18 // This ResourceThrottle blocks power save until large upload request finishes. | 20 // This ResourceThrottle blocks power save until large upload request finishes. |
| 19 class PowerSaveBlockResourceThrottle : public ResourceThrottle { | 21 class PowerSaveBlockResourceThrottle : public ResourceThrottle { |
| 20 public: | 22 public: |
| 21 PowerSaveBlockResourceThrottle(); | 23 explicit PowerSaveBlockResourceThrottle(const std::string& host); |
| 22 ~PowerSaveBlockResourceThrottle() override; | 24 ~PowerSaveBlockResourceThrottle() override; |
| 23 | 25 |
| 24 // ResourceThrottle overrides: | 26 // ResourceThrottle overrides: |
| 25 void WillStartRequest(bool* defer) override; | 27 void WillStartRequest(bool* defer) override; |
| 26 void WillProcessResponse(bool* defer) override; | 28 void WillProcessResponse(bool* defer) override; |
| 27 const char* GetNameForLogging() const override; | 29 const char* GetNameForLogging() const override; |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 void ActivatePowerSaveBlocker(); | 32 void ActivatePowerSaveBlocker(); |
| 31 | 33 |
| 34 std::string host_; | |
|
Lei Zhang
2015/12/27 22:42:38
const?
Avi (use Gerrit)
2015/12/27 22:47:55
Sure.
| |
| 32 base::OneShotTimer timer_; | 35 base::OneShotTimer timer_; |
| 33 scoped_ptr<PowerSaveBlocker> power_save_blocker_; | 36 scoped_ptr<PowerSaveBlocker> power_save_blocker_; |
| 34 | 37 |
| 35 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockResourceThrottle); | 38 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockResourceThrottle); |
| 36 }; | 39 }; |
| 37 | 40 |
| 38 } // namespace content | 41 } // namespace content |
| 39 | 42 |
| 40 #endif // CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_ | 43 #endif // CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_ |
| OLD | NEW |