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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient); | 205 provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient); |
206 static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClie
nt(); | 206 static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClie
nt(); |
207 RefPtr<Frame> frame = Frame::create(m_page.get(), 0, emptyFrameLoaderClient)
; | 207 RefPtr<Frame> frame = Frame::create(m_page.get(), 0, emptyFrameLoaderClient)
; |
208 frame->setView(FrameView::create(frame.get())); | 208 frame->setView(FrameView::create(frame.get())); |
209 frame->init(); | 209 frame->init(); |
210 frame->view()->resize(m_popupClient->contentSize()); | 210 frame->view()->resize(m_popupClient->contentSize()); |
211 frame->view()->setTransparent(false); | 211 frame->view()->setTransparent(false); |
212 | 212 |
213 DOMWindowPagePopup::install(frame->domWindow(), m_popupClient); | 213 DOMWindowPagePopup::install(frame->domWindow(), m_popupClient); |
214 | 214 |
215 DocumentWriter* writer = frame->loader()->activeDocumentLoader()->beginWriti
ng("text/html", "UTF-8"); | 215 DocumentWriter* writer = frame->loader().activeDocumentLoader()->beginWritin
g("text/html", "UTF-8"); |
216 m_popupClient->writeDocument(*writer); | 216 m_popupClient->writeDocument(*writer); |
217 frame->loader()->activeDocumentLoader()->endWriting(writer); | 217 frame->loader().activeDocumentLoader()->endWriting(writer); |
218 return true; | 218 return true; |
219 } | 219 } |
220 | 220 |
221 void WebPagePopupImpl::destroyPage() | 221 void WebPagePopupImpl::destroyPage() |
222 { | 222 { |
223 if (!m_page) | 223 if (!m_page) |
224 return; | 224 return; |
225 | 225 |
226 if (m_page->mainFrame()) | 226 if (m_page->mainFrame()) |
227 m_page->mainFrame()->loader()->frameDetached(); | 227 m_page->mainFrame()->loader().frameDetached(); |
228 | 228 |
229 m_page.clear(); | 229 m_page.clear(); |
230 } | 230 } |
231 | 231 |
232 WebSize WebPagePopupImpl::size() | 232 WebSize WebPagePopupImpl::size() |
233 { | 233 { |
234 return m_popupClient->contentSize(); | 234 return m_popupClient->contentSize(); |
235 } | 235 } |
236 | 236 |
237 void WebPagePopupImpl::animate(double) | 237 void WebPagePopupImpl::animate(double) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 m_closing = true; | 310 m_closing = true; |
311 destroyPage(); // In case closePopup() was not called. | 311 destroyPage(); // In case closePopup() was not called. |
312 m_widgetClient = 0; | 312 m_widgetClient = 0; |
313 deref(); | 313 deref(); |
314 } | 314 } |
315 | 315 |
316 void WebPagePopupImpl::closePopup() | 316 void WebPagePopupImpl::closePopup() |
317 { | 317 { |
318 if (m_page) { | 318 if (m_page) { |
319 m_page->clearPageGroup(); | 319 m_page->clearPageGroup(); |
320 m_page->mainFrame()->loader()->stopAllLoaders(); | 320 m_page->mainFrame()->loader().stopAllLoaders(); |
321 DOMWindowPagePopup::uninstall(m_page->mainFrame()->domWindow()); | 321 DOMWindowPagePopup::uninstall(m_page->mainFrame()->domWindow()); |
322 } | 322 } |
323 m_closing = true; | 323 m_closing = true; |
324 | 324 |
325 destroyPage(); | 325 destroyPage(); |
326 | 326 |
327 // m_widgetClient might be 0 because this widget might be already closed. | 327 // m_widgetClient might be 0 because this widget might be already closed. |
328 if (m_widgetClient) { | 328 if (m_widgetClient) { |
329 // closeWidgetSoon() will call this->close() later. | 329 // closeWidgetSoon() will call this->close() later. |
330 m_widgetClient->closeWidgetSoon(); | 330 m_widgetClient->closeWidgetSoon(); |
(...skipping 11 matching lines...) Expand all Loading... |
342 // A WebPagePopupImpl instance usually has two references. | 342 // A WebPagePopupImpl instance usually has two references. |
343 // - One owned by the instance itself. It represents the visible widget. | 343 // - One owned by the instance itself. It represents the visible widget. |
344 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 344 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
345 // WebPagePopupImpl to close. | 345 // WebPagePopupImpl to close. |
346 // We need them because the closing operation is asynchronous and the widget | 346 // We need them because the closing operation is asynchronous and the widget |
347 // can be closed while the WebViewImpl is unaware of it. | 347 // can be closed while the WebViewImpl is unaware of it. |
348 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 348 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
349 } | 349 } |
350 | 350 |
351 } // namespace WebKit | 351 } // namespace WebKit |
OLD | NEW |