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 "config.h" | 5 #include "config.h" |
6 #include "modules/battery/NavigatorBattery.h" | 6 #include "modules/battery/NavigatorBattery.h" |
7 | 7 |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "modules/battery/BatteryManager.h" | 9 #include "modules/battery/BatteryManager.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 return m_batteryManager.get(); | 30 return m_batteryManager.get(); |
31 } | 31 } |
32 | 32 |
33 const char* NavigatorBattery::supplementName() | 33 const char* NavigatorBattery::supplementName() |
34 { | 34 { |
35 return "NavigatorBattery"; | 35 return "NavigatorBattery"; |
36 } | 36 } |
37 | 37 |
38 NavigatorBattery& NavigatorBattery::from(Navigator& navigator) | 38 NavigatorBattery& NavigatorBattery::from(Navigator& navigator) |
39 { | 39 { |
40 NavigatorBattery* supplement = static_cast<NavigatorBattery*>(Supplement<Nav
igator>::from(navigator, supplementName())); | 40 NavigatorBattery* supplement = static_cast<NavigatorBattery*>(WillBeHeapSupp
lement<Navigator>::from(navigator, supplementName())); |
41 if (!supplement) { | 41 if (!supplement) { |
42 supplement = new NavigatorBattery(); | 42 supplement = new NavigatorBattery(); |
43 provideTo(navigator, supplementName(), adoptPtr(supplement)); | 43 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); |
44 } | 44 } |
45 return *supplement; | 45 return *supplement; |
46 } | 46 } |
47 | 47 |
| 48 void NavigatorBattery::trace(Visitor* visitor) |
| 49 { |
| 50 visitor->trace(m_batteryManager); |
| 51 } |
| 52 |
48 } // namespace WebCore | 53 } // namespace WebCore |
OLD | NEW |