| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/page/PagePopupSupplement.h" | 31 #include "core/page/PagePopupSupplement.h" |
| 32 | 32 |
| 33 #include "core/page/PagePopupController.h" | 33 #include "core/page/PagePopupController.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 PagePopupSupplement::PagePopupSupplement(PagePopup& popup, | 37 PagePopupSupplement::PagePopupSupplement(LocalFrame& frame, |
| 38 PagePopup& popup, |
| 38 PagePopupClient* popupClient) | 39 PagePopupClient* popupClient) |
| 39 : m_controller(PagePopupController::create(popup, popupClient)) { | 40 : Supplement<LocalFrame>(frame), |
| 40 ASSERT(popupClient); | 41 m_controller(PagePopupController::create(popup, popupClient)) { |
| 42 DCHECK(popupClient); |
| 41 } | 43 } |
| 42 | 44 |
| 43 const char* PagePopupSupplement::supplementName() { | 45 const char* PagePopupSupplement::supplementName() { |
| 44 return "PagePopupSupplement"; | 46 return "PagePopupSupplement"; |
| 45 } | 47 } |
| 46 | 48 |
| 47 PagePopupController* PagePopupSupplement::pagePopupController( | 49 PagePopupSupplement& PagePopupSupplement::from(LocalFrame& frame) { |
| 48 LocalFrame& frame) { | 50 PagePopupSupplement* supplement = static_cast<PagePopupSupplement*>( |
| 49 PagePopupSupplement* supplement = | 51 Supplement<LocalFrame>::from(&frame, supplementName())); |
| 50 static_cast<PagePopupSupplement*>(from(&frame, supplementName())); | 52 DCHECK(supplement); |
| 51 ASSERT(supplement); | 53 return *supplement; |
| 52 return supplement->m_controller.get(); | 54 } |
| 55 |
| 56 PagePopupController* PagePopupSupplement::pagePopupController() const { |
| 57 return m_controller; |
| 58 } |
| 59 |
| 60 void PagePopupSupplement::dispose() { |
| 61 m_controller->clearPagePopupClient(); |
| 53 } | 62 } |
| 54 | 63 |
| 55 void PagePopupSupplement::install(LocalFrame& frame, | 64 void PagePopupSupplement::install(LocalFrame& frame, |
| 56 PagePopup& popup, | 65 PagePopup& popup, |
| 57 PagePopupClient* popupClient) { | 66 PagePopupClient* popupClient) { |
| 58 ASSERT(popupClient); | 67 ASSERT(popupClient); |
| 59 provideTo(frame, supplementName(), | 68 provideTo(frame, supplementName(), |
| 60 new PagePopupSupplement(popup, popupClient)); | 69 new PagePopupSupplement(frame, popup, popupClient)); |
| 61 } | 70 } |
| 62 | 71 |
| 63 void PagePopupSupplement::uninstall(LocalFrame& frame) { | 72 void PagePopupSupplement::uninstall(LocalFrame& frame) { |
| 64 pagePopupController(frame)->clearPagePopupClient(); | 73 PagePopupSupplement::from(frame).dispose(); |
| 65 frame.removeSupplement(supplementName()); | 74 frame.removeSupplement(supplementName()); |
| 66 } | 75 } |
| 67 | 76 |
| 68 DEFINE_TRACE(PagePopupSupplement) { | 77 DEFINE_TRACE(PagePopupSupplement) { |
| 69 visitor->trace(m_controller); | 78 visitor->trace(m_controller); |
| 70 Supplement<LocalFrame>::trace(visitor); | 79 Supplement<LocalFrame>::trace(visitor); |
| 71 } | 80 } |
| 72 | 81 |
| 73 } // namespace blink | 82 } // namespace blink |
| OLD | NEW |