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

Side by Side Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 1121053002: Add metrics for dialogs triggered inside sandboxed documents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple 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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 FrameHost* host = frame()->host(); 818 FrameHost* host = frame()->host();
819 if (!host) 819 if (!host)
820 return; 820 return;
821 821
822 if (frame()->isLoading()) { 822 if (frame()->isLoading()) {
823 m_shouldPrintWhenFinishedLoading = true; 823 m_shouldPrintWhenFinishedLoading = true;
824 return; 824 return;
825 } 825 }
826 m_shouldPrintWhenFinishedLoading = false; 826 m_shouldPrintWhenFinishedLoading = false;
827 host->chrome().print(frame()); 827 host->chrome().print(frame());
828
829 if (frame()->document()->sandboxFlags())
830 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext);
828 } 831 }
829 832
830 void LocalDOMWindow::stop() 833 void LocalDOMWindow::stop()
831 { 834 {
832 if (!frame()) 835 if (!frame())
833 return; 836 return;
834 frame()->loader().stopAllLoaders(); 837 frame()->loader().stopAllLoaders();
835 } 838 }
836 839
837 void LocalDOMWindow::alert(const String& message) 840 void LocalDOMWindow::alert(const String& message)
838 { 841 {
839 if (!frame()) 842 if (!frame())
840 return; 843 return;
841 844
842 frame()->document()->updateLayoutTreeIfNeeded(); 845 frame()->document()->updateLayoutTreeIfNeeded();
843 846
844 FrameHost* host = frame()->host(); 847 FrameHost* host = frame()->host();
845 if (!host) 848 if (!host)
846 return; 849 return;
847 850
851 if (frame()->document()->sandboxFlags())
852 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext);
853
848 host->chrome().runJavaScriptAlert(frame(), message); 854 host->chrome().runJavaScriptAlert(frame(), message);
849 } 855 }
850 856
851 bool LocalDOMWindow::confirm(const String& message) 857 bool LocalDOMWindow::confirm(const String& message)
852 { 858 {
853 if (!frame()) 859 if (!frame())
854 return false; 860 return false;
855 861
856 frame()->document()->updateLayoutTreeIfNeeded(); 862 frame()->document()->updateLayoutTreeIfNeeded();
857 863
858 FrameHost* host = frame()->host(); 864 FrameHost* host = frame()->host();
859 if (!host) 865 if (!host)
860 return false; 866 return false;
861 867
868 if (frame()->document()->sandboxFlags())
869 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext);
870
862 return host->chrome().runJavaScriptConfirm(frame(), message); 871 return host->chrome().runJavaScriptConfirm(frame(), message);
863 } 872 }
864 873
865 String LocalDOMWindow::prompt(const String& message, const String& defaultValue) 874 String LocalDOMWindow::prompt(const String& message, const String& defaultValue)
866 { 875 {
867 if (!frame()) 876 if (!frame())
868 return String(); 877 return String();
869 878
870 frame()->document()->updateLayoutTreeIfNeeded(); 879 frame()->document()->updateLayoutTreeIfNeeded();
871 880
872 FrameHost* host = frame()->host(); 881 FrameHost* host = frame()->host();
873 if (!host) 882 if (!host)
874 return String(); 883 return String();
875 884
885 if (frame()->document()->sandboxFlags())
886 UseCounter::count(frame()->document(), UseCounter::DialogInSandboxedCont ext);
887
876 String returnValue; 888 String returnValue;
877 if (host->chrome().runJavaScriptPrompt(frame(), message, defaultValue, retur nValue)) 889 if (host->chrome().runJavaScriptPrompt(frame(), message, defaultValue, retur nValue))
878 return returnValue; 890 return returnValue;
879 891
880 return String(); 892 return String();
881 } 893 }
882 894
883 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const 895 bool LocalDOMWindow::find(const String& string, bool caseSensitive, bool backwar ds, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const
884 { 896 {
885 if (!isCurrentlyDisplayedInFrame()) 897 if (!isCurrentlyDisplayedInFrame())
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 DOMWindow::trace(visitor); 1582 DOMWindow::trace(visitor);
1571 DOMWindowLifecycleNotifier::trace(visitor); 1583 DOMWindowLifecycleNotifier::trace(visitor);
1572 } 1584 }
1573 1585
1574 LocalFrame* LocalDOMWindow::frame() const 1586 LocalFrame* LocalDOMWindow::frame() const
1575 { 1587 {
1576 return m_frameObserver->frame(); 1588 return m_frameObserver->frame();
1577 } 1589 }
1578 1590
1579 } // namespace blink 1591 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698