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 "modules/netinfo/NavigatorNetworkInformation.h" | 5 #include "modules/netinfo/NavigatorNetworkInformation.h" |
6 | 6 |
7 #include "core/frame/LocalDOMWindow.h" | 7 #include "core/frame/LocalDOMWindow.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/frame/Navigator.h" | 9 #include "core/frame/Navigator.h" |
10 #include "modules/netinfo/NetworkInformation.h" | 10 #include "modules/netinfo/NetworkInformation.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 NavigatorNetworkInformation* supplement = toNavigatorNetworkInformation(navi
gator); | 25 NavigatorNetworkInformation* supplement = toNavigatorNetworkInformation(navi
gator); |
26 if (!supplement) { | 26 if (!supplement) { |
27 supplement = new NavigatorNetworkInformation(navigator); | 27 supplement = new NavigatorNetworkInformation(navigator); |
28 provideTo(navigator, supplementName(), supplement); | 28 provideTo(navigator, supplementName(), supplement); |
29 } | 29 } |
30 return *supplement; | 30 return *supplement; |
31 } | 31 } |
32 | 32 |
33 NavigatorNetworkInformation* NavigatorNetworkInformation::toNavigatorNetworkInfo
rmation(Navigator& navigator) | 33 NavigatorNetworkInformation* NavigatorNetworkInformation::toNavigatorNetworkInfo
rmation(Navigator& navigator) |
34 { | 34 { |
35 return static_cast<NavigatorNetworkInformation*>(HeapSupplement<Navigator>::
from(navigator, supplementName())); | 35 return static_cast<NavigatorNetworkInformation*>(Supplement<Navigator>::from
(navigator, supplementName())); |
36 } | 36 } |
37 | 37 |
38 const char* NavigatorNetworkInformation::supplementName() | 38 const char* NavigatorNetworkInformation::supplementName() |
39 { | 39 { |
40 return "NavigatorNetworkInformation"; | 40 return "NavigatorNetworkInformation"; |
41 } | 41 } |
42 | 42 |
43 NetworkInformation* NavigatorNetworkInformation::connection(Navigator& navigator
) | 43 NetworkInformation* NavigatorNetworkInformation::connection(Navigator& navigator
) |
44 { | 44 { |
45 return NavigatorNetworkInformation::from(navigator).connection(); | 45 return NavigatorNetworkInformation::from(navigator).connection(); |
46 } | 46 } |
47 | 47 |
48 NetworkInformation* NavigatorNetworkInformation::connection() | 48 NetworkInformation* NavigatorNetworkInformation::connection() |
49 { | 49 { |
50 if (!m_connection && frame()) { | 50 if (!m_connection && frame()) { |
51 ASSERT(frame()->domWindow()); | 51 ASSERT(frame()->domWindow()); |
52 m_connection = NetworkInformation::create(frame()->domWindow()->getExecu
tionContext()); | 52 m_connection = NetworkInformation::create(frame()->domWindow()->getExecu
tionContext()); |
53 } | 53 } |
54 return m_connection.get(); | 54 return m_connection.get(); |
55 } | 55 } |
56 | 56 |
57 DEFINE_TRACE(NavigatorNetworkInformation) | 57 DEFINE_TRACE(NavigatorNetworkInformation) |
58 { | 58 { |
59 visitor->trace(m_connection); | 59 visitor->trace(m_connection); |
60 HeapSupplement<Navigator>::trace(visitor); | 60 Supplement<Navigator>::trace(visitor); |
61 DOMWindowProperty::trace(visitor); | 61 DOMWindowProperty::trace(visitor); |
62 } | 62 } |
63 | 63 |
64 } // namespace blink | 64 } // namespace blink |
OLD | NEW |