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

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

Issue 1778753003: Fire visibilitychange event on unload (behind the flag) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add dismissal type Created 4 years, 9 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 | « third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in ('k') | no next file » | 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) 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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 return m_webView->pagePopupWindow(); 857 return m_webView->pagePopupWindow();
858 } 858 }
859 859
860 bool ChromeClientImpl::shouldOpenModalDialogDuringPageDismissal(const DialogType & dialogType, const String& dialogMessage, Document::PageDismissalType dismissal Type) const 860 bool ChromeClientImpl::shouldOpenModalDialogDuringPageDismissal(const DialogType & dialogType, const String& dialogMessage, Document::PageDismissalType dismissal Type) const
861 { 861 {
862 const char* const kDialogs[] = { "alert", "confirm", "prompt" }; 862 const char* const kDialogs[] = { "alert", "confirm", "prompt" };
863 int dialog = static_cast<int>(dialogType); 863 int dialog = static_cast<int>(dialogType);
864 ASSERT_WITH_SECURITY_IMPLICATION(0 <= dialog); 864 ASSERT_WITH_SECURITY_IMPLICATION(0 <= dialog);
865 ASSERT_WITH_SECURITY_IMPLICATION(dialog < static_cast<int>(WTF_ARRAY_LENGTH( kDialogs))); 865 ASSERT_WITH_SECURITY_IMPLICATION(dialog < static_cast<int>(WTF_ARRAY_LENGTH( kDialogs)));
866 866
867 const char* const kDismissals[] = { "beforeunload", "pagehide", "unload" }; 867 // This array must be consistent with PageDismissalType enum defined in
dcheng 2016/03/11 04:20:38 Do we need to preserve the relative order? This is
kinuko 2016/03/11 05:12:50 Hmm, true. I removed the UMA part & changed these
868 // Document.h.
869 const char* const kDismissals[] = { "beforeunload", "pagehide", "visibilityc hange", "unload" };
868 int dismissal = static_cast<int>(dismissalType) - 1; // Exclude NoDismissal. 870 int dismissal = static_cast<int>(dismissalType) - 1; // Exclude NoDismissal.
869 ASSERT_WITH_SECURITY_IMPLICATION(0 <= dismissal); 871 ASSERT_WITH_SECURITY_IMPLICATION(0 <= dismissal);
870 ASSERT_WITH_SECURITY_IMPLICATION(dismissal < static_cast<int>(WTF_ARRAY_LENG TH(kDismissals))); 872 ASSERT_WITH_SECURITY_IMPLICATION(dismissal < static_cast<int>(WTF_ARRAY_LENG TH(kDismissals)));
871 873
872 DEFINE_STATIC_LOCAL(EnumerationHistogram, dialogDismissalHistogram, ("Render er.ModalDialogsDuringPageDismissal", WTF_ARRAY_LENGTH(kDialogs) * WTF_ARRAY_LENG TH(kDismissals))); 874 DEFINE_STATIC_LOCAL(EnumerationHistogram, dialogDismissalHistogram, ("Render er.ModalDialogsDuringPageDismissal", WTF_ARRAY_LENGTH(kDialogs) * WTF_ARRAY_LENG TH(kDismissals)));
873 dialogDismissalHistogram.count(dismissal * WTF_ARRAY_LENGTH(kDialogs) + dial og); 875 dialogDismissalHistogram.count(dismissal * WTF_ARRAY_LENGTH(kDialogs) + dial og);
874 876
875 String message = String("Blocked ") + kDialogs[dialog] + "('" + dialogMessag e + "') during " + kDismissals[dismissal] + "."; 877 String message = String("Blocked ") + kDialogs[dialog] + "('" + dialogMessag e + "') during " + kDismissals[dismissal] + ".";
876 m_webView->mainFrame()->addMessageToConsole(WebConsoleMessage(WebConsoleMess age::LevelError, message)); 878 m_webView->mainFrame()->addMessageToConsole(WebConsoleMessage(WebConsoleMess age::LevelError, message));
877 879
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 if (m_webView->pageImportanceSignals()) 1060 if (m_webView->pageImportanceSignals())
1059 m_webView->pageImportanceSignals()->setIssuedNonGetFetchFromScript(); 1061 m_webView->pageImportanceSignals()->setIssuedNonGetFetchFromScript();
1060 } 1062 }
1061 1063
1062 PassOwnPtr<WebFrameScheduler> ChromeClientImpl::createFrameScheduler() 1064 PassOwnPtr<WebFrameScheduler> ChromeClientImpl::createFrameScheduler()
1063 { 1065 {
1064 return m_webView->scheduler()->createFrameScheduler().release(); 1066 return m_webView->scheduler()->createFrameScheduler().release();
1065 } 1067 }
1066 1068
1067 } // namespace blink 1069 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698