| 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/serviceworkers/NavigatorServiceWorker.h" | 6 #include "modules/serviceworkers/NavigatorServiceWorker.h" |
| 7 | 7 |
| 8 #include "core/frame/Navigator.h" | 8 #include "core/frame/Navigator.h" |
| 9 #include "modules/serviceworkers/NavigatorServiceWorkerInterface.h" | 9 #include "modules/serviceworkers/ServiceWorkerContainer.h" |
| 10 | 10 |
| 11 namespace WebCore { | 11 namespace WebCore { |
| 12 | 12 |
| 13 NavigatorServiceWorker::NavigatorServiceWorker(Navigator* navigator) | 13 NavigatorServiceWorker::NavigatorServiceWorker(Navigator* navigator) |
| 14 : DOMWindowProperty(navigator->frame()) | 14 : DOMWindowProperty(navigator->frame()) |
| 15 { | 15 { |
| 16 } | 16 } |
| 17 | 17 |
| 18 NavigatorServiceWorker::~NavigatorServiceWorker() | 18 NavigatorServiceWorker::~NavigatorServiceWorker() |
| 19 { | 19 { |
| 20 } | 20 } |
| 21 | 21 |
| 22 NavigatorServiceWorker* NavigatorServiceWorker::from(Navigator* navigator) | 22 NavigatorServiceWorker* NavigatorServiceWorker::from(Navigator* navigator) |
| 23 { | 23 { |
| 24 NavigatorServiceWorker* supplement = toNavigatorServiceWorker(navigator); | 24 NavigatorServiceWorker* supplement = toNavigatorServiceWorker(navigator); |
| 25 if (!supplement) { | 25 if (!supplement) { |
| 26 supplement = new NavigatorServiceWorker(navigator); | 26 supplement = new NavigatorServiceWorker(navigator); |
| 27 provideTo(navigator, supplementName(), adoptPtr(supplement)); | 27 provideTo(navigator, supplementName(), adoptPtr(supplement)); |
| 28 } | 28 } |
| 29 return supplement; | 29 return supplement; |
| 30 } | 30 } |
| 31 | 31 |
| 32 const char* NavigatorServiceWorker::supplementName() | 32 const char* NavigatorServiceWorker::supplementName() |
| 33 { | 33 { |
| 34 return "NavigatorServiceWorker"; | 34 return "NavigatorServiceWorker"; |
| 35 } | 35 } |
| 36 | 36 |
| 37 NavigatorServiceWorkerInterface* NavigatorServiceWorker::serviceWorker(Navigator
* navigator) | 37 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(Navigator* navigat
or) |
| 38 { | 38 { |
| 39 return NavigatorServiceWorker::from(navigator)->serviceWorker(); | 39 return NavigatorServiceWorker::from(navigator)->serviceWorker(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 NavigatorServiceWorkerInterface* NavigatorServiceWorker::serviceWorker() | 42 ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker() |
| 43 { | 43 { |
| 44 if (!m_serviceWorker && frame()) | 44 if (!m_serviceWorker && frame()) |
| 45 m_serviceWorker = NavigatorServiceWorkerInterface::create(); | 45 m_serviceWorker = ServiceWorkerContainer::create(); |
| 46 return m_serviceWorker.get(); | 46 return m_serviceWorker.get(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace WebCore | 49 } // namespace WebCore |
| OLD | NEW |