Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 26564006: Cleanup: Add conversion interface for WebWidget derived classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/WebPopupMenuImpl.h ('k') | public/web/WebWidget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 1570
1571 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView) 1571 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView)
1572 { 1572 {
1573 ASSERT(client); 1573 ASSERT(client);
1574 if (hasOpenedPopup()) 1574 if (hasOpenedPopup())
1575 hidePopups(); 1575 hidePopups();
1576 ASSERT(!m_pagePopup); 1576 ASSERT(!m_pagePopup);
1577 1577
1578 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage); 1578 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage);
1579 ASSERT(popupWidget); 1579 ASSERT(popupWidget);
1580 m_pagePopup = static_cast<WebPagePopupImpl*>(popupWidget); 1580 m_pagePopup = toWebPagePopupImpl(popupWidget);
1581 if (!m_pagePopup->initialize(this, client, originBoundsInRootView)) { 1581 if (!m_pagePopup->initialize(this, client, originBoundsInRootView)) {
1582 m_pagePopup->closePopup(); 1582 m_pagePopup->closePopup();
1583 m_pagePopup = 0; 1583 m_pagePopup = 0;
1584 } 1584 }
1585 return m_pagePopup.get(); 1585 return m_pagePopup.get();
1586 } 1586 }
1587 1587
1588 void WebViewImpl::closePagePopup(PagePopup* popup) 1588 void WebViewImpl::closePagePopup(PagePopup* popup)
1589 { 1589 {
1590 ASSERT(popup); 1590 ASSERT(popup);
1591 WebPagePopupImpl* popupImpl = static_cast<WebPagePopupImpl*>(popup); 1591 WebPagePopupImpl* popupImpl = toWebPagePopupImpl(popup);
1592 ASSERT(m_pagePopup.get() == popupImpl); 1592 ASSERT(m_pagePopup.get() == popupImpl);
1593 if (m_pagePopup.get() != popupImpl) 1593 if (m_pagePopup.get() != popupImpl)
1594 return; 1594 return;
1595 m_pagePopup->closePopup(); 1595 m_pagePopup->closePopup();
1596 m_pagePopup = 0; 1596 m_pagePopup = 0;
1597 } 1597 }
1598 1598
1599 void WebViewImpl::hideAutofillPopup() 1599 void WebViewImpl::hideAutofillPopup()
1600 { 1600 {
1601 if (m_autofillPopupShowing) { 1601 if (m_autofillPopupShowing) {
1602 m_autofillPopup->hidePopup(); 1602 m_autofillPopup->hidePopup();
1603 m_autofillPopupShowing = false; 1603 m_autofillPopupShowing = false;
1604 } 1604 }
1605 } 1605 }
1606 1606
1607 WebHelperPluginImpl* WebViewImpl::createHelperPlugin(const String& pluginType, c onst WebDocument& hostDocument) 1607 WebHelperPluginImpl* WebViewImpl::createHelperPlugin(const String& pluginType, c onst WebDocument& hostDocument)
1608 { 1608 {
1609 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypeHelperPlugin) ; 1609 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypeHelperPlugin) ;
1610 ASSERT(popupWidget); 1610 ASSERT(popupWidget);
1611 WebHelperPluginImpl* helperPlugin = static_cast<WebHelperPluginImpl*>(popupW idget); 1611 WebHelperPluginImpl* helperPlugin = toWebHelperPluginImpl(popupWidget);
1612 1612
1613 if (!helperPlugin->initialize(pluginType, hostDocument, this)) { 1613 if (!helperPlugin->initialize(pluginType, hostDocument, this)) {
1614 helperPlugin->closeHelperPlugin(); 1614 helperPlugin->closeHelperPlugin();
1615 helperPlugin = 0; 1615 helperPlugin = 0;
1616 } 1616 }
1617 return helperPlugin; 1617 return helperPlugin;
1618 } 1618 }
1619 1619
1620 void WebViewImpl::closeHelperPluginSoon(PassRefPtr<WebHelperPluginImpl> helperPl ugin) 1620 void WebViewImpl::closeHelperPluginSoon(PassRefPtr<WebHelperPluginImpl> helperPl ugin)
1621 { 1621 {
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after
3821 ASSERT(m_autofillPopupShowing); 3821 ASSERT(m_autofillPopupShowing);
3822 3822
3823 // Hide the popup if it has become empty. 3823 // Hide the popup if it has become empty.
3824 if (!m_autofillPopupClient->listSize()) { 3824 if (!m_autofillPopupClient->listSize()) {
3825 hideAutofillPopup(); 3825 hideAutofillPopup();
3826 return; 3826 return;
3827 } 3827 }
3828 3828
3829 WebRect newWidgetRect = m_autofillPopup->refresh(focusedElement()->pixelSnap pedBoundingBox()); 3829 WebRect newWidgetRect = m_autofillPopup->refresh(focusedElement()->pixelSnap pedBoundingBox());
3830 // Let's resize the backing window if necessary. 3830 // Let's resize the backing window if necessary.
3831 WebPopupMenuImpl* popupMenu = static_cast<WebPopupMenuImpl*>(m_autofillPopup ->client()); 3831 WebPopupMenuImpl* popupMenu = toWebPopupMenuImpl(m_autofillPopup->client());
3832 if (popupMenu && popupMenu->client()->windowRect() != newWidgetRect) 3832 if (popupMenu && popupMenu->client()->windowRect() != newWidgetRect)
3833 popupMenu->client()->setWindowRect(newWidgetRect); 3833 popupMenu->client()->setWindowRect(newWidgetRect);
3834 } 3834 }
3835 3835
3836 Element* WebViewImpl::focusedElement() 3836 Element* WebViewImpl::focusedElement()
3837 { 3837 {
3838 Frame* frame = m_page->focusController().focusedFrame(); 3838 Frame* frame = m_page->focusController().focusedFrame();
3839 if (!frame) 3839 if (!frame)
3840 return 0; 3840 return 0;
3841 3841
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
4229 // the initial viewport width. 4229 // the initial viewport width.
4230 // 2. The author has disabled viewport zoom. 4230 // 2. The author has disabled viewport zoom.
4231 4231
4232 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4232 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4233 4233
4234 return fixedLayoutSize().width == m_size.width 4234 return fixedLayoutSize().width == m_size.width
4235 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4235 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4236 } 4236 }
4237 4237
4238 } // namespace WebKit 4238 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/WebPopupMenuImpl.h ('k') | public/web/WebWidget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698