| 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" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 NavigatorNetworkInformation::NavigatorNetworkInformation(Navigator& navigator) | 14 NavigatorNetworkInformation::NavigatorNetworkInformation(Navigator& navigator) |
| 15 : DOMWindowProperty(navigator.frame()) {} | 15 : ContextClient(navigator.frame()) {} |
| 16 | 16 |
| 17 NavigatorNetworkInformation& NavigatorNetworkInformation::from( | 17 NavigatorNetworkInformation& NavigatorNetworkInformation::from( |
| 18 Navigator& navigator) { | 18 Navigator& navigator) { |
| 19 NavigatorNetworkInformation* supplement = | 19 NavigatorNetworkInformation* supplement = |
| 20 toNavigatorNetworkInformation(navigator); | 20 toNavigatorNetworkInformation(navigator); |
| 21 if (!supplement) { | 21 if (!supplement) { |
| 22 supplement = new NavigatorNetworkInformation(navigator); | 22 supplement = new NavigatorNetworkInformation(navigator); |
| 23 provideTo(navigator, supplementName(), supplement); | 23 provideTo(navigator, supplementName(), supplement); |
| 24 } | 24 } |
| 25 return *supplement; | 25 return *supplement; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 46 ASSERT(frame()->domWindow()); | 46 ASSERT(frame()->domWindow()); |
| 47 m_connection = | 47 m_connection = |
| 48 NetworkInformation::create(frame()->domWindow()->getExecutionContext()); | 48 NetworkInformation::create(frame()->domWindow()->getExecutionContext()); |
| 49 } | 49 } |
| 50 return m_connection.get(); | 50 return m_connection.get(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 DEFINE_TRACE(NavigatorNetworkInformation) { | 53 DEFINE_TRACE(NavigatorNetworkInformation) { |
| 54 visitor->trace(m_connection); | 54 visitor->trace(m_connection); |
| 55 Supplement<Navigator>::trace(visitor); | 55 Supplement<Navigator>::trace(visitor); |
| 56 DOMWindowProperty::trace(visitor); | 56 ContextClient::trace(visitor); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| OLD | NEW |