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

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

Issue 26434002: Cleanup: Add more conversion helpers for usage. (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
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 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 1566
1567 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView) 1567 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView)
1568 { 1568 {
1569 ASSERT(client); 1569 ASSERT(client);
1570 if (hasOpenedPopup()) 1570 if (hasOpenedPopup())
1571 hidePopups(); 1571 hidePopups();
1572 ASSERT(!m_pagePopup); 1572 ASSERT(!m_pagePopup);
1573 1573
1574 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage); 1574 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage);
1575 ASSERT(popupWidget); 1575 ASSERT(popupWidget);
1576 m_pagePopup = static_cast<WebPagePopupImpl*>(popupWidget); 1576 m_pagePopup = toWebPagePopupImpl(popupWidget);
1577 if (!m_pagePopup->initialize(this, client, originBoundsInRootView)) { 1577 if (!m_pagePopup->initialize(this, client, originBoundsInRootView)) {
1578 m_pagePopup->closePopup(); 1578 m_pagePopup->closePopup();
1579 m_pagePopup = 0; 1579 m_pagePopup = 0;
1580 } 1580 }
1581 return m_pagePopup.get(); 1581 return m_pagePopup.get();
1582 } 1582 }
1583 1583
1584 void WebViewImpl::closePagePopup(PagePopup* popup) 1584 void WebViewImpl::closePagePopup(PagePopup* popup)
1585 { 1585 {
1586 ASSERT(popup); 1586 ASSERT(popup);
1587 WebPagePopupImpl* popupImpl = static_cast<WebPagePopupImpl*>(popup); 1587 WebPagePopupImpl* popupImpl = toWebPagePopupImpl(popup);
1588 ASSERT(m_pagePopup.get() == popupImpl); 1588 ASSERT(m_pagePopup.get() == popupImpl);
1589 if (m_pagePopup.get() != popupImpl) 1589 if (m_pagePopup.get() != popupImpl)
1590 return; 1590 return;
1591 m_pagePopup->closePopup(); 1591 m_pagePopup->closePopup();
1592 m_pagePopup = 0; 1592 m_pagePopup = 0;
1593 } 1593 }
1594 1594
1595 void WebViewImpl::hideAutofillPopup() 1595 void WebViewImpl::hideAutofillPopup()
1596 { 1596 {
1597 if (m_autofillPopupShowing) { 1597 if (m_autofillPopupShowing) {
1598 m_autofillPopup->hidePopup(); 1598 m_autofillPopup->hidePopup();
1599 m_autofillPopupShowing = false; 1599 m_autofillPopupShowing = false;
1600 } 1600 }
1601 } 1601 }
1602 1602
1603 WebHelperPluginImpl* WebViewImpl::createHelperPlugin(const String& pluginType, c onst WebDocument& hostDocument) 1603 WebHelperPluginImpl* WebViewImpl::createHelperPlugin(const String& pluginType, c onst WebDocument& hostDocument)
1604 { 1604 {
1605 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypeHelperPlugin) ; 1605 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypeHelperPlugin) ;
1606 ASSERT(popupWidget); 1606 ASSERT(popupWidget);
1607 WebHelperPluginImpl* helperPlugin = static_cast<WebHelperPluginImpl*>(popupW idget); 1607 WebHelperPluginImpl* helperPlugin = toWebHelperPluginImpl(popupWidget);
1608 1608
1609 if (!helperPlugin->initialize(pluginType, hostDocument, this)) { 1609 if (!helperPlugin->initialize(pluginType, hostDocument, this)) {
1610 helperPlugin->closeHelperPlugin(); 1610 helperPlugin->closeHelperPlugin();
1611 helperPlugin = 0; 1611 helperPlugin = 0;
1612 } 1612 }
1613 return helperPlugin; 1613 return helperPlugin;
1614 } 1614 }
1615 1615
1616 void WebViewImpl::closeHelperPluginSoon(PassRefPtr<WebHelperPluginImpl> helperPl ugin) 1616 void WebViewImpl::closeHelperPluginSoon(PassRefPtr<WebHelperPluginImpl> helperPl ugin)
1617 { 1617 {
(...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after
3812 ASSERT(m_autofillPopupShowing); 3812 ASSERT(m_autofillPopupShowing);
3813 3813
3814 // Hide the popup if it has become empty. 3814 // Hide the popup if it has become empty.
3815 if (!m_autofillPopupClient->listSize()) { 3815 if (!m_autofillPopupClient->listSize()) {
3816 hideAutofillPopup(); 3816 hideAutofillPopup();
3817 return; 3817 return;
3818 } 3818 }
3819 3819
3820 WebRect newWidgetRect = m_autofillPopup->refresh(focusedElement()->pixelSnap pedBoundingBox()); 3820 WebRect newWidgetRect = m_autofillPopup->refresh(focusedElement()->pixelSnap pedBoundingBox());
3821 // Let's resize the backing window if necessary. 3821 // Let's resize the backing window if necessary.
3822 WebPopupMenuImpl* popupMenu = static_cast<WebPopupMenuImpl*>(m_autofillPopup ->client()); 3822 WebPopupMenuImpl* popupMenu = toWebPopupMenuImpl(m_autofillPopup->client());
3823 if (popupMenu && popupMenu->client()->windowRect() != newWidgetRect) 3823 if (popupMenu && popupMenu->client()->windowRect() != newWidgetRect)
3824 popupMenu->client()->setWindowRect(newWidgetRect); 3824 popupMenu->client()->setWindowRect(newWidgetRect);
3825 } 3825 }
3826 3826
3827 Element* WebViewImpl::focusedElement() 3827 Element* WebViewImpl::focusedElement()
3828 { 3828 {
3829 Frame* frame = m_page->focusController().focusedFrame(); 3829 Frame* frame = m_page->focusController().focusedFrame();
3830 if (!frame) 3830 if (!frame)
3831 return 0; 3831 return 0;
3832 3832
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
4200 // the initial viewport width. 4200 // the initial viewport width.
4201 // 2. The author has disabled viewport zoom. 4201 // 2. The author has disabled viewport zoom.
4202 4202
4203 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4203 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4204 4204
4205 return fixedLayoutSize().width == m_size.width 4205 return fixedLayoutSize().width == m_size.width
4206 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4206 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4207 } 4207 }
4208 4208
4209 } // namespace WebKit 4209 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698