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

Side by Side Diff: third_party/WebKit/Source/web/ChromeClientImpl.cpp

Issue 1839643009: RELEASE_ASSERT -> CHECK and ASSERT -> DCHECK in web. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Return DCHECK_IS_ON checks. Created 4 years, 8 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 } // namespace 337 } // namespace
338 338
339 Page* ChromeClientImpl::createWindow(LocalFrame* frame, const FrameLoadRequest& r, const WindowFeatures& features, 339 Page* ChromeClientImpl::createWindow(LocalFrame* frame, const FrameLoadRequest& r, const WindowFeatures& features,
340 NavigationPolicy navigationPolicy, ShouldSetOpener shouldSetOpener) 340 NavigationPolicy navigationPolicy, ShouldSetOpener shouldSetOpener)
341 { 341 {
342 if (!m_webView->client()) 342 if (!m_webView->client())
343 return nullptr; 343 return nullptr;
344 344
345 WebNavigationPolicy policy = effectiveNavigationPolicy(navigationPolicy, fea tures); 345 WebNavigationPolicy policy = effectiveNavigationPolicy(navigationPolicy, fea tures);
346 ASSERT(frame->document()); 346 DCHECK(frame->document());
347 Fullscreen::fullyExitFullscreen(*frame->document()); 347 Fullscreen::fullyExitFullscreen(*frame->document());
348 348
349 WebViewImpl* newView = toWebViewImpl( 349 WebViewImpl* newView = toWebViewImpl(
350 m_webView->client()->createView(WebLocalFrameImpl::fromFrame(frame), Wra ppedResourceRequest(r.resourceRequest()), features, r.frameName(), policy, shoul dSetOpener == NeverSetOpener)); 350 m_webView->client()->createView(WebLocalFrameImpl::fromFrame(frame), Wra ppedResourceRequest(r.resourceRequest()), features, r.frameName(), policy, shoul dSetOpener == NeverSetOpener));
351 if (!newView) 351 if (!newView)
352 return nullptr; 352 return nullptr;
353 return newView->page(); 353 return newView->page();
354 } 354 }
355 355
356 void ChromeClientImpl::didOverscroll(const FloatSize& unusedDelta, const FloatSi ze& accumulatedRootOverScroll, const FloatPoint& position, const FloatSize& velo city) 356 void ChromeClientImpl::didOverscroll(const FloatSize& unusedDelta, const FloatSi ze& accumulatedRootOverScroll, const FloatPoint& position, const FloatSize& velo city)
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 } 520 }
521 521
522 void ChromeClientImpl::invalidateRect(const IntRect& updateRect) 522 void ChromeClientImpl::invalidateRect(const IntRect& updateRect)
523 { 523 {
524 if (!updateRect.isEmpty()) 524 if (!updateRect.isEmpty())
525 m_webView->invalidateRect(updateRect); 525 m_webView->invalidateRect(updateRect);
526 } 526 }
527 527
528 void ChromeClientImpl::scheduleAnimation(Widget* widget) 528 void ChromeClientImpl::scheduleAnimation(Widget* widget)
529 { 529 {
530 ASSERT(widget->isFrameView()); 530 DCHECK(widget->isFrameView());
531 FrameView* view = toFrameView(widget); 531 FrameView* view = toFrameView(widget);
532 LocalFrame* frame = view->frame().localFrameRoot(); 532 LocalFrame* frame = view->frame().localFrameRoot();
533 533
534 // If the frame is still being created, it might not yet have a WebWidget. 534 // If the frame is still being created, it might not yet have a WebWidget.
535 // FIXME: Is this the right thing to do? Is there a way to avoid having 535 // FIXME: Is this the right thing to do? Is there a way to avoid having
536 // a local frame root that doesn't have a WebWidget? During initialization 536 // a local frame root that doesn't have a WebWidget? During initialization
537 // there is no content to draw so this call serves no purpose. 537 // there is no content to draw so this call serves no purpose.
538 if (WebLocalFrameImpl::fromFrame(frame) && WebLocalFrameImpl::fromFrame(fram e)->frameWidget()) { 538 if (WebLocalFrameImpl::fromFrame(frame) && WebLocalFrameImpl::fromFrame(fram e)->frameWidget()) {
539 WebLocalFrameImpl::fromFrame(frame)->frameWidget()->scheduleAnimation(); 539 WebLocalFrameImpl::fromFrame(frame)->frameWidget()->scheduleAnimation();
540 } else { 540 } else {
541 // TODO(lfg): We need to keep this for now because we still have some 541 // TODO(lfg): We need to keep this for now because we still have some
542 // WebViews who don't have a WebViewFrameWidget. This should be 542 // WebViews who don't have a WebViewFrameWidget. This should be
543 // removed once the WebViewFrameWidget refactor is complete. 543 // removed once the WebViewFrameWidget refactor is complete.
544 m_webView->scheduleAnimation(); 544 m_webView->scheduleAnimation();
545 } 545 }
546 } 546 }
547 547
548 IntRect ChromeClientImpl::viewportToScreen(const IntRect& rectInViewport, const Widget* widget) const 548 IntRect ChromeClientImpl::viewportToScreen(const IntRect& rectInViewport, const Widget* widget) const
549 { 549 {
550 WebRect screenRect(rectInViewport); 550 WebRect screenRect(rectInViewport);
551 551
552 ASSERT(widget->isFrameView()); 552 DCHECK(widget->isFrameView());
553 const FrameView* view = toFrameView(widget); 553 const FrameView* view = toFrameView(widget);
554 LocalFrame* frame = view->frame().localFrameRoot(); 554 LocalFrame* frame = view->frame().localFrameRoot();
555 WebWidgetClient* client = nullptr; 555 WebWidgetClient* client = nullptr;
556 556
557 // TODO(kenrb): Consolidate this to a single case when WebViewFrameWidget re factor is complete. 557 // TODO(kenrb): Consolidate this to a single case when WebViewFrameWidget re factor is complete.
558 if (WebLocalFrameImpl::fromFrame(frame) && WebLocalFrameImpl::fromFrame(fram e)->frameWidget() && WebLocalFrameImpl::fromFrame(frame)->frameWidget()->forSubf rame()) 558 if (WebLocalFrameImpl::fromFrame(frame) && WebLocalFrameImpl::fromFrame(fram e)->frameWidget() && WebLocalFrameImpl::fromFrame(frame)->frameWidget()->forSubf rame())
559 client = toWebFrameWidgetImpl(WebLocalFrameImpl::fromFrame(frame)->frame Widget())->client(); 559 client = toWebFrameWidgetImpl(WebLocalFrameImpl::fromFrame(frame)->frame Widget())->client();
560 else 560 else
561 client = m_webView->client(); 561 client = m_webView->client();
562 562
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 } 705 }
706 706
707 void ChromeClientImpl::enumerateChosenDirectory(FileChooser* fileChooser) 707 void ChromeClientImpl::enumerateChosenDirectory(FileChooser* fileChooser)
708 { 708 {
709 WebViewClient* client = m_webView->client(); 709 WebViewClient* client = m_webView->client();
710 if (!client) 710 if (!client)
711 return; 711 return;
712 712
713 WebFileChooserCompletionImpl* chooserCompletion = new WebFileChooserCompleti onImpl(fileChooser); 713 WebFileChooserCompletionImpl* chooserCompletion = new WebFileChooserCompleti onImpl(fileChooser);
714 714
715 ASSERT(fileChooser); 715 DCHECK(fileChooser);
716 ASSERT(fileChooser->settings().selectedFiles.size()); 716 DCHECK(fileChooser->settings().selectedFiles.size());
717 717
718 // If the enumeration can't happen, call the callback with an empty list. 718 // If the enumeration can't happen, call the callback with an empty list.
719 if (!client->enumerateChosenDirectory(fileChooser->settings().selectedFiles[ 0], chooserCompletion)) 719 if (!client->enumerateChosenDirectory(fileChooser->settings().selectedFiles[ 0], chooserCompletion))
720 chooserCompletion->didChooseFile(WebVector<WebString>()); 720 chooserCompletion->didChooseFile(WebVector<WebString>());
721 } 721 }
722 722
723 Cursor ChromeClientImpl::lastSetCursorForTesting() const 723 Cursor ChromeClientImpl::lastSetCursorForTesting() const
724 { 724 {
725 return m_lastSetMouseCursorForTesting; 725 return m_lastSetMouseCursorForTesting;
726 } 726 }
(...skipping 17 matching lines...) Expand all
744 #endif 744 #endif
745 if (!m_webView->client()) 745 if (!m_webView->client())
746 return; 746 return;
747 // TODO(kenrb, dcheng): For top-level frames we still use the WebView as 747 // TODO(kenrb, dcheng): For top-level frames we still use the WebView as
748 // a WebWidget. This special case will be removed when top-level frames 748 // a WebWidget. This special case will be removed when top-level frames
749 // get WebFrameWidgets. 749 // get WebFrameWidgets.
750 if (localRoot->isMainFrame()) { 750 if (localRoot->isMainFrame()) {
751 m_webView->client()->didChangeCursor(cursor); 751 m_webView->client()->didChangeCursor(cursor);
752 } else { 752 } else {
753 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot); 753 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
754 ASSERT(webFrame); 754 DCHECK(webFrame);
755 ASSERT(webFrame->frameWidget()); 755 DCHECK(webFrame->frameWidget());
756 if (toWebFrameWidgetImpl(webFrame->frameWidget())->client()) 756 if (toWebFrameWidgetImpl(webFrame->frameWidget())->client())
757 toWebFrameWidgetImpl(webFrame->frameWidget())->client()->didChangeCu rsor(cursor); 757 toWebFrameWidgetImpl(webFrame->frameWidget())->client()->didChangeCu rsor(cursor);
758 } 758 }
759 } 759 }
760 760
761 void ChromeClientImpl::setCursorForPlugin(const WebCursorInfo& cursor, LocalFram e* localRoot) 761 void ChromeClientImpl::setCursorForPlugin(const WebCursorInfo& cursor, LocalFram e* localRoot)
762 { 762 {
763 setCursor(cursor, localRoot); 763 setCursor(cursor, localRoot);
764 } 764 }
765 765
(...skipping 25 matching lines...) Expand all
791 if (localRoot->isMainFrame()) { 791 if (localRoot->isMainFrame()) {
792 m_webView->setRootGraphicsLayer(rootLayer); 792 m_webView->setRootGraphicsLayer(rootLayer);
793 } else { 793 } else {
794 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot); 794 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
795 // FIXME: The following conditional is only needed for staging until the 795 // FIXME: The following conditional is only needed for staging until the
796 // Chromium patch lands that instantiates a WebFrameWidget. 796 // Chromium patch lands that instantiates a WebFrameWidget.
797 if (!webFrame->frameWidget()) { 797 if (!webFrame->frameWidget()) {
798 m_webView->setRootGraphicsLayer(rootLayer); 798 m_webView->setRootGraphicsLayer(rootLayer);
799 return; 799 return;
800 } 800 }
801 ASSERT(webFrame); 801 DCHECK(webFrame);
802 ASSERT(webFrame->frameWidget()); 802 DCHECK(webFrame->frameWidget());
803 toWebFrameWidgetImpl(webFrame->frameWidget())->setRootGraphicsLayer(root Layer); 803 toWebFrameWidgetImpl(webFrame->frameWidget())->setRootGraphicsLayer(root Layer);
804 } 804 }
805 } 805 }
806 806
807 void ChromeClientImpl::didPaint(const PaintArtifact& paintArtifact) 807 void ChromeClientImpl::didPaint(const PaintArtifact& paintArtifact)
808 { 808 {
809 // TODO(jbroman): This doesn't handle OOPIF correctly. We probably need a 809 // TODO(jbroman): This doesn't handle OOPIF correctly. We probably need a
810 // branch for WebFrameWidget, like attachRootGraphicsLayer. 810 // branch for WebFrameWidget, like attachRootGraphicsLayer.
811 m_webView->getPaintArtifactCompositor().update(paintArtifact); 811 m_webView->getPaintArtifactCompositor().update(paintArtifact);
812 } 812 }
813 813
814 void ChromeClientImpl::attachCompositorAnimationTimeline(CompositorAnimationTime line* compositorTimeline, LocalFrame* localRoot) 814 void ChromeClientImpl::attachCompositorAnimationTimeline(CompositorAnimationTime line* compositorTimeline, LocalFrame* localRoot)
815 { 815 {
816 // FIXME: For top-level frames we still use the WebView as a WebWidget. This 816 // FIXME: For top-level frames we still use the WebView as a WebWidget. This
817 // special case will be removed when top-level frames get WebFrameWidgets. 817 // special case will be removed when top-level frames get WebFrameWidgets.
818 if (localRoot->isMainFrame()) { 818 if (localRoot->isMainFrame()) {
819 m_webView->attachCompositorAnimationTimeline(compositorTimeline); 819 m_webView->attachCompositorAnimationTimeline(compositorTimeline);
820 } else { 820 } else {
821 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot); 821 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
822 // FIXME: The following conditional is only needed for staging until the 822 // FIXME: The following conditional is only needed for staging until the
823 // Chromium patch lands that instantiates a WebFrameWidget. 823 // Chromium patch lands that instantiates a WebFrameWidget.
824 if (!webFrame->frameWidget()) { 824 if (!webFrame->frameWidget()) {
825 m_webView->attachCompositorAnimationTimeline(compositorTimeline); 825 m_webView->attachCompositorAnimationTimeline(compositorTimeline);
826 return; 826 return;
827 } 827 }
828 ASSERT(webFrame); 828 DCHECK(webFrame);
829 ASSERT(webFrame->frameWidget()); 829 DCHECK(webFrame->frameWidget());
830 toWebFrameWidgetImpl(webFrame->frameWidget())->attachCompositorAnimation Timeline(compositorTimeline); 830 toWebFrameWidgetImpl(webFrame->frameWidget())->attachCompositorAnimation Timeline(compositorTimeline);
831 } 831 }
832 } 832 }
833 833
834 void ChromeClientImpl::detachCompositorAnimationTimeline(CompositorAnimationTime line* compositorTimeline, LocalFrame* localRoot) 834 void ChromeClientImpl::detachCompositorAnimationTimeline(CompositorAnimationTime line* compositorTimeline, LocalFrame* localRoot)
835 { 835 {
836 // FIXME: For top-level frames we still use the WebView as a WebWidget. This 836 // FIXME: For top-level frames we still use the WebView as a WebWidget. This
837 // special case will be removed when top-level frames get WebFrameWidgets. 837 // special case will be removed when top-level frames get WebFrameWidgets.
838 if (localRoot->isMainFrame()) { 838 if (localRoot->isMainFrame()) {
839 m_webView->detachCompositorAnimationTimeline(compositorTimeline); 839 m_webView->detachCompositorAnimationTimeline(compositorTimeline);
840 } else { 840 } else {
841 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot); 841 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
842 // FIXME: The following conditional is only needed for staging until the 842 // FIXME: The following conditional is only needed for staging until the
843 // Chromium patch lands that instantiates a WebFrameWidget. 843 // Chromium patch lands that instantiates a WebFrameWidget.
844 if (!webFrame->frameWidget()) { 844 if (!webFrame->frameWidget()) {
845 m_webView->detachCompositorAnimationTimeline(compositorTimeline); 845 m_webView->detachCompositorAnimationTimeline(compositorTimeline);
846 return; 846 return;
847 } 847 }
848 ASSERT(webFrame); 848 DCHECK(webFrame);
849 ASSERT(webFrame->frameWidget()); 849 DCHECK(webFrame->frameWidget());
850 toWebFrameWidgetImpl(webFrame->frameWidget())->detachCompositorAnimation Timeline(compositorTimeline); 850 toWebFrameWidgetImpl(webFrame->frameWidget())->detachCompositorAnimation Timeline(compositorTimeline);
851 } 851 }
852 } 852 }
853 853
854 void ChromeClientImpl::enterFullScreenForElement(Element* element) 854 void ChromeClientImpl::enterFullScreenForElement(Element* element)
855 { 855 {
856 m_webView->enterFullScreenForElement(element); 856 m_webView->enterFullScreenForElement(element);
857 } 857 }
858 858
859 void ChromeClientImpl::exitFullScreenForElement(Element* element) 859 void ChromeClientImpl::exitFullScreenForElement(Element* element)
(...skipping 15 matching lines...) Expand all
875 { 875 {
876 return m_webView->hasOpenedPopup(); 876 return m_webView->hasOpenedPopup();
877 } 877 }
878 878
879 RawPtr<PopupMenu> ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectE lement& select) 879 RawPtr<PopupMenu> ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectE lement& select)
880 { 880 {
881 notifyPopupOpeningObservers(); 881 notifyPopupOpeningObservers();
882 if (WebViewImpl::useExternalPopupMenus()) 882 if (WebViewImpl::useExternalPopupMenus())
883 return new ExternalPopupMenu(frame, select, *m_webView); 883 return new ExternalPopupMenu(frame, select, *m_webView);
884 884
885 ASSERT(RuntimeEnabledFeatures::pagePopupEnabled()); 885 DCHECK(RuntimeEnabledFeatures::pagePopupEnabled());
886 return PopupMenuImpl::create(this, select); 886 return PopupMenuImpl::create(this, select);
887 } 887 }
888 888
889 PagePopup* ChromeClientImpl::openPagePopup(PagePopupClient* client) 889 PagePopup* ChromeClientImpl::openPagePopup(PagePopupClient* client)
890 { 890 {
891 return m_webView->openPagePopup(client); 891 return m_webView->openPagePopup(client);
892 } 892 }
893 893
894 void ChromeClientImpl::closePagePopup(PagePopup* popup) 894 void ChromeClientImpl::closePagePopup(PagePopup* popup)
895 { 895 {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 m_webView->page()->frameHost().visualViewport().registerLayersWithTreeVi ew(m_webView->layerTreeView()); 1054 m_webView->page()->frameHost().visualViewport().registerLayersWithTreeVi ew(m_webView->layerTreeView());
1055 } 1055 }
1056 1056
1057 void ChromeClientImpl::didUpdateTopControls() const 1057 void ChromeClientImpl::didUpdateTopControls() const
1058 { 1058 {
1059 m_webView->didUpdateTopControls(); 1059 m_webView->didUpdateTopControls();
1060 } 1060 }
1061 1061
1062 void ChromeClientImpl::registerPopupOpeningObserver(PopupOpeningObserver* observ er) 1062 void ChromeClientImpl::registerPopupOpeningObserver(PopupOpeningObserver* observ er)
1063 { 1063 {
1064 ASSERT(observer); 1064 DCHECK(observer);
1065 m_popupOpeningObservers.append(observer); 1065 m_popupOpeningObservers.append(observer);
1066 } 1066 }
1067 1067
1068 void ChromeClientImpl::unregisterPopupOpeningObserver(PopupOpeningObserver* obse rver) 1068 void ChromeClientImpl::unregisterPopupOpeningObserver(PopupOpeningObserver* obse rver)
1069 { 1069 {
1070 size_t index = m_popupOpeningObservers.find(observer); 1070 size_t index = m_popupOpeningObservers.find(observer);
1071 ASSERT(index != kNotFound); 1071 DCHECK_NE(index, kNotFound);
1072 m_popupOpeningObservers.remove(index); 1072 m_popupOpeningObservers.remove(index);
1073 } 1073 }
1074 1074
1075 void ChromeClientImpl::notifyPopupOpeningObservers() const 1075 void ChromeClientImpl::notifyPopupOpeningObservers() const
1076 { 1076 {
1077 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers); 1077 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers);
1078 for (const auto& observer : observers) 1078 for (const auto& observer : observers)
1079 observer->willOpenPopup(); 1079 observer->willOpenPopup();
1080 } 1080 }
1081 1081
1082 FloatSize ChromeClientImpl::elasticOverscroll() const 1082 FloatSize ChromeClientImpl::elasticOverscroll() const
1083 { 1083 {
1084 return m_webView->elasticOverscroll(); 1084 return m_webView->elasticOverscroll();
1085 } 1085 }
1086 1086
1087 void ChromeClientImpl::didObserveNonGetFetchFromScript() const 1087 void ChromeClientImpl::didObserveNonGetFetchFromScript() const
1088 { 1088 {
1089 if (m_webView->pageImportanceSignals()) 1089 if (m_webView->pageImportanceSignals())
1090 m_webView->pageImportanceSignals()->setIssuedNonGetFetchFromScript(); 1090 m_webView->pageImportanceSignals()->setIssuedNonGetFetchFromScript();
1091 } 1091 }
1092 1092
1093 PassOwnPtr<WebFrameScheduler> ChromeClientImpl::createFrameScheduler(BlameContex t* blameContext) 1093 PassOwnPtr<WebFrameScheduler> ChromeClientImpl::createFrameScheduler(BlameContex t* blameContext)
1094 { 1094 {
1095 return m_webView->scheduler()->createFrameScheduler(blameContext).release(); 1095 return m_webView->scheduler()->createFrameScheduler(blameContext).release();
1096 } 1096 }
1097 1097
1098 } // namespace blink 1098 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698