| 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/presentation/NavigatorPresentation.h" | 6 #include "modules/presentation/NavigatorPresentation.h" |
| 7 | 7 |
| 8 #include "core/frame/Navigator.h" | 8 #include "core/frame/Navigator.h" |
| 9 #include "modules/presentation/Presentation.h" | 9 #include "modules/presentation/Presentation.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 NavigatorPresentation::NavigatorPresentation() | 13 NavigatorPresentation::NavigatorPresentation() |
| 14 { | 14 { |
| 15 } | 15 } |
| 16 | 16 |
| 17 NavigatorPresentation::~NavigatorPresentation() | |
| 18 { | |
| 19 } | |
| 20 | |
| 21 // static | 17 // static |
| 22 const char* NavigatorPresentation::supplementName() | 18 const char* NavigatorPresentation::supplementName() |
| 23 { | 19 { |
| 24 return "NavigatorPresentation"; | 20 return "NavigatorPresentation"; |
| 25 } | 21 } |
| 26 | 22 |
| 27 // static | 23 // static |
| 28 NavigatorPresentation& NavigatorPresentation::from(Navigator& navigator) | 24 NavigatorPresentation& NavigatorPresentation::from(Navigator& navigator) |
| 29 { | 25 { |
| 30 NavigatorPresentation* supplement = static_cast<NavigatorPresentation*>(Will
BeHeapSupplement<Navigator>::from(navigator, supplementName())); | 26 NavigatorPresentation* supplement = static_cast<NavigatorPresentation*>(Heap
Supplement<Navigator>::from(navigator, supplementName())); |
| 31 if (!supplement) { | 27 if (!supplement) { |
| 32 supplement = new NavigatorPresentation(); | 28 supplement = new NavigatorPresentation(); |
| 33 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); | 29 provideTo(navigator, supplementName(), supplement); |
| 34 } | 30 } |
| 35 return *supplement; | 31 return *supplement; |
| 36 } | 32 } |
| 37 | 33 |
| 38 // static | 34 // static |
| 39 Presentation* NavigatorPresentation::presentation(Navigator& navigator) | 35 Presentation* NavigatorPresentation::presentation(Navigator& navigator) |
| 40 { | 36 { |
| 41 NavigatorPresentation& self = NavigatorPresentation::from(navigator); | 37 NavigatorPresentation& self = NavigatorPresentation::from(navigator); |
| 42 if (!self.m_presentation) { | 38 if (!self.m_presentation) { |
| 43 if (!navigator.frame()) | 39 if (!navigator.frame()) |
| 44 return nullptr; | 40 return nullptr; |
| 45 self.m_presentation = Presentation::create(navigator.frame()); | 41 self.m_presentation = Presentation::create(navigator.frame()); |
| 46 } | 42 } |
| 47 return self.m_presentation.get(); | 43 return self.m_presentation; |
| 48 } | 44 } |
| 49 | 45 |
| 50 DEFINE_TRACE(NavigatorPresentation) | 46 DEFINE_TRACE(NavigatorPresentation) |
| 51 { | 47 { |
| 52 visitor->trace(m_presentation); | 48 visitor->trace(m_presentation); |
| 53 WillBeHeapSupplement<Navigator>::trace(visitor); | 49 HeapSupplement<Navigator>::trace(visitor); |
| 54 } | 50 } |
| 55 | 51 |
| 56 } // namespace blink | 52 } // namespace blink |
| OLD | NEW |