| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 frame->setPagePopupOwner(m_popupClient->ownerElement()); | 297 frame->setPagePopupOwner(m_popupClient->ownerElement()); |
| 298 frame->setView(FrameView::create(*frame)); | 298 frame->setView(FrameView::create(*frame)); |
| 299 frame->init(); | 299 frame->init(); |
| 300 frame->view()->setParentVisible(true); | 300 frame->view()->setParentVisible(true); |
| 301 frame->view()->setSelfVisible(true); | 301 frame->view()->setSelfVisible(true); |
| 302 frame->view()->setTransparent(false); | 302 frame->view()->setTransparent(false); |
| 303 if (AXObjectCache* cache = | 303 if (AXObjectCache* cache = |
| 304 m_popupClient->ownerElement().document().existingAXObjectCache()) | 304 m_popupClient->ownerElement().document().existingAXObjectCache()) |
| 305 cache->childrenChanged(&m_popupClient->ownerElement()); | 305 cache->childrenChanged(&m_popupClient->ownerElement()); |
| 306 | 306 |
| 307 DCHECK(frame->localDOMWindow()); | 307 DCHECK(frame->domWindow()); |
| 308 PagePopupSupplement::install(*frame, *this, m_popupClient); | 308 PagePopupSupplement::install(*frame, *this, m_popupClient); |
| 309 DCHECK_EQ(m_popupClient->ownerElement().document().existingAXObjectCache(), | 309 DCHECK_EQ(m_popupClient->ownerElement().document().existingAXObjectCache(), |
| 310 frame->document()->existingAXObjectCache()); | 310 frame->document()->existingAXObjectCache()); |
| 311 | 311 |
| 312 RefPtr<SharedBuffer> data = SharedBuffer::create(); | 312 RefPtr<SharedBuffer> data = SharedBuffer::create(); |
| 313 m_popupClient->writeDocument(data.get()); | 313 m_popupClient->writeDocument(data.get()); |
| 314 frame->loader().load(FrameLoadRequest( | 314 frame->loader().load(FrameLoadRequest( |
| 315 0, blankURL(), SubstituteData(data, "text/html", "UTF-8", KURL(), | 315 0, blankURL(), SubstituteData(data, "text/html", "UTF-8", KURL(), |
| 316 ForceSynchronousLoad))); | 316 ForceSynchronousLoad))); |
| 317 frame->setPageZoomFactor(m_popupClient->zoomFactor()); | 317 frame->setPageZoomFactor(m_popupClient->zoomFactor()); |
| 318 return true; | 318 return true; |
| 319 } | 319 } |
| 320 | 320 |
| 321 void WebPagePopupImpl::postMessage(const String& message) { | 321 void WebPagePopupImpl::postMessage(const String& message) { |
| 322 if (!m_page) | 322 if (!m_page) |
| 323 return; | 323 return; |
| 324 ScriptForbiddenScope::AllowUserAgentScript allowScript; | 324 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
| 325 if (LocalDOMWindow* window = | 325 if (LocalDOMWindow* window = toLocalFrame(m_page->mainFrame())->domWindow()) |
| 326 toLocalFrame(m_page->mainFrame())->localDOMWindow()) | |
| 327 window->dispatchEvent(MessageEvent::create(message)); | 326 window->dispatchEvent(MessageEvent::create(message)); |
| 328 } | 327 } |
| 329 | 328 |
| 330 void WebPagePopupImpl::destroyPage() { | 329 void WebPagePopupImpl::destroyPage() { |
| 331 if (!m_page) | 330 if (!m_page) |
| 332 return; | 331 return; |
| 333 | 332 |
| 334 m_page->willBeDestroyed(); | 333 m_page->willBeDestroyed(); |
| 335 m_page.clear(); | 334 m_page.clear(); |
| 336 } | 335 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 if (m_widgetClient && !closeAlreadyCalled) { | 537 if (m_widgetClient && !closeAlreadyCalled) { |
| 539 // closeWidgetSoon() will call this->close() later. | 538 // closeWidgetSoon() will call this->close() later. |
| 540 m_widgetClient->closeWidgetSoon(); | 539 m_widgetClient->closeWidgetSoon(); |
| 541 } | 540 } |
| 542 } | 541 } |
| 543 m_popupClient->didClosePopup(); | 542 m_popupClient->didClosePopup(); |
| 544 m_webView->cleanupPagePopup(); | 543 m_webView->cleanupPagePopup(); |
| 545 } | 544 } |
| 546 | 545 |
| 547 LocalDOMWindow* WebPagePopupImpl::window() { | 546 LocalDOMWindow* WebPagePopupImpl::window() { |
| 548 return m_page->deprecatedLocalMainFrame()->localDOMWindow(); | 547 return m_page->deprecatedLocalMainFrame()->domWindow(); |
| 549 } | 548 } |
| 550 | 549 |
| 551 void WebPagePopupImpl::layoutAndPaintAsync( | 550 void WebPagePopupImpl::layoutAndPaintAsync( |
| 552 WebLayoutAndPaintAsyncCallback* callback) { | 551 WebLayoutAndPaintAsyncCallback* callback) { |
| 553 m_layerTreeView->layoutAndPaintAsync(callback); | 552 m_layerTreeView->layoutAndPaintAsync(callback); |
| 554 } | 553 } |
| 555 | 554 |
| 556 void WebPagePopupImpl::compositeAndReadbackAsync( | 555 void WebPagePopupImpl::compositeAndReadbackAsync( |
| 557 WebCompositeAndReadbackAsyncCallback* callback) { | 556 WebCompositeAndReadbackAsyncCallback* callback) { |
| 558 DCHECK(isAcceleratedCompositingActive()); | 557 DCHECK(isAcceleratedCompositingActive()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 583 // A WebPagePopupImpl instance usually has two references. | 582 // A WebPagePopupImpl instance usually has two references. |
| 584 // - One owned by the instance itself. It represents the visible widget. | 583 // - One owned by the instance itself. It represents the visible widget. |
| 585 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 584 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
| 586 // WebPagePopupImpl to close. | 585 // WebPagePopupImpl to close. |
| 587 // We need them because the closing operation is asynchronous and the widget | 586 // We need them because the closing operation is asynchronous and the widget |
| 588 // can be closed while the WebViewImpl is unaware of it. | 587 // can be closed while the WebViewImpl is unaware of it. |
| 589 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 588 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
| 590 } | 589 } |
| 591 | 590 |
| 592 } // namespace blink | 591 } // namespace blink |
| OLD | NEW |