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 26 matching lines...) Expand all Loading... | |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 DOMWindowPagePopup::DOMWindowPagePopup(PagePopupClient* popupClient) | 39 DOMWindowPagePopup::DOMWindowPagePopup(PagePopupClient* popupClient) |
40 : m_controller(PagePopupController::create(popupClient)) | 40 : m_controller(PagePopupController::create(popupClient)) |
41 { | 41 { |
42 ASSERT(popupClient); | 42 ASSERT(popupClient); |
43 } | 43 } |
44 | 44 |
45 DOMWindowPagePopup::~DOMWindowPagePopup() | 45 DOMWindowPagePopup::~DOMWindowPagePopup() |
46 { | 46 { |
47 m_controller->clearPagePopupClient(); | |
48 } | 47 } |
49 | 48 |
50 const char* DOMWindowPagePopup::supplementName() | 49 const char* DOMWindowPagePopup::supplementName() |
51 { | 50 { |
52 return "DOMWindowPagePopup"; | 51 return "DOMWindowPagePopup"; |
53 } | 52 } |
54 | 53 |
55 PagePopupController* DOMWindowPagePopup::pagePopupController(DOMWindow& window) | 54 PagePopupController* DOMWindowPagePopup::pagePopupController(DOMWindow& window) |
56 { | 55 { |
57 DOMWindowPagePopup* supplement = static_cast<DOMWindowPagePopup*>(from(&wind ow, supplementName())); | 56 DOMWindowPagePopup* supplement = static_cast<DOMWindowPagePopup*>(from(&wind ow, supplementName())); |
58 ASSERT(supplement); | 57 ASSERT(supplement); |
59 return supplement->m_controller.get(); | 58 return supplement->m_controller.get(); |
60 } | 59 } |
61 | 60 |
62 void DOMWindowPagePopup::install(DOMWindow& window, PagePopupClient* popupClient ) | 61 void DOMWindowPagePopup::install(DOMWindow& window, PagePopupClient* popupClient ) |
63 { | 62 { |
64 ASSERT(popupClient); | 63 ASSERT(popupClient); |
65 provideTo(window, supplementName(), adoptPtr(new DOMWindowPagePopup(popupCli ent))); | 64 provideTo(window, supplementName(), adoptPtrWillBeNoop(new DOMWindowPagePopu p(popupClient))); |
66 } | 65 } |
67 | 66 |
68 void DOMWindowPagePopup::uninstall(DOMWindow& window) | 67 void DOMWindowPagePopup::uninstall(DOMWindow& window) |
69 { | 68 { |
69 DOMWindowPagePopup* supplement = static_cast<DOMWindowPagePopup*>(from(&wind ow, supplementName())); | |
70 if (supplement) | |
haraken
2014/03/27 00:59:03
Is it possible that supplement is 0 ?
If no, I'd
sof
2014/03/27 07:25:51
Much better that way; done.
| |
71 supplement->m_controller->clearPagePopupClient(); | |
70 window.removeSupplement(supplementName()); | 72 window.removeSupplement(supplementName()); |
71 } | 73 } |
72 | 74 |
75 void DOMWindowPagePopup::trace(Visitor* visitor) | |
76 { | |
77 visitor->trace(m_controller); | |
73 } | 78 } |
79 | |
80 } | |
OLD | NEW |