| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/browser/battery_status/battery_status_manager.h" | |
| 6 | |
| 7 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "content/child/webcrypto/openssl/aes_key_openssl.h" |
| 7 #include "content/child/webcrypto/status.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| 11 namespace webcrypto { |
| 12 |
| 11 namespace { | 13 namespace { |
| 12 | 14 |
| 13 class BatteryStatusManagerDefault : public BatteryStatusManager { | 15 class AesKwImplementation : public AesAlgorithm { |
| 14 public: | 16 public: |
| 15 explicit BatteryStatusManagerDefault( | 17 AesKwImplementation() : AesAlgorithm("KW") {} |
| 16 const BatteryStatusService::BatteryUpdateCallback& callback) {} | |
| 17 virtual ~BatteryStatusManagerDefault() {} | |
| 18 | 18 |
| 19 private: | 19 virtual Status Encrypt(const blink::WebCryptoAlgorithm& algorithm, |
| 20 // BatteryStatusManager: | 20 const blink::WebCryptoKey& key, |
| 21 virtual bool StartListeningBatteryChange() OVERRIDE { | 21 const CryptoData& data, |
| 22 NOTIMPLEMENTED(); | 22 std::vector<uint8>* buffer) const OVERRIDE { |
| 23 return false; | 23 // TODO(eroman): |
| 24 return Status::ErrorUnsupported(); |
| 24 } | 25 } |
| 25 | 26 |
| 26 virtual void StopListeningBatteryChange() OVERRIDE { NOTIMPLEMENTED(); } | 27 virtual Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, |
| 27 | 28 const blink::WebCryptoKey& key, |
| 28 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerDefault); | 29 const CryptoData& data, |
| 30 std::vector<uint8>* buffer) const OVERRIDE { |
| 31 // TODO(eroman): |
| 32 return Status::ErrorUnsupported(); |
| 33 } |
| 29 }; | 34 }; |
| 30 | 35 |
| 31 } // namespace | 36 } // namespace |
| 32 | 37 |
| 33 // static | 38 AlgorithmImplementation* CreatePlatformAesKwImplementation() { |
| 34 scoped_ptr<BatteryStatusManager> BatteryStatusManager::Create( | 39 return new AesKwImplementation; |
| 35 const BatteryStatusService::BatteryUpdateCallback& callback) { | |
| 36 return scoped_ptr<BatteryStatusManager>( | |
| 37 new BatteryStatusManagerDefault(callback)); | |
| 38 } | 40 } |
| 39 | 41 |
| 42 } // namespace webcrypto |
| 43 |
| 40 } // namespace content | 44 } // namespace content |
| OLD | NEW |