WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Proposed patch
patch_1.txt (text/plain), 11.45 KB, created by
Eric Carlson
on 2011-02-25 21:22:48 PST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Eric Carlson
Created:
2011-02-25 21:22:48 PST
Size:
11.45 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 79757) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,39 @@ >+2011-02-25 Eric Carlson <eric.carlson@apple.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ <audio> and <video> should respect private browsing mode >+ https://bugs.webkit.org/show_bug.cgi?id=55287 >+ <rdar://problem/9057699> >+ >+ No new tests, this is just the plumbing. >+ >+ * dom/Document.cpp: >+ (WebCore::Document::privateBrowsingStateChanged): New. >+ (WebCore::Document::registerForPrivateBrowsingStateChangedCallbacks): Ditto. >+ (WebCore::Document::unregisterForPrivateBrowsingStateChangedCallbacks): Ditto. >+ * dom/Document.h: >+ >+ * dom/Element.h: >+ (WebCore::Element::privateBrowsingStateChanged): New. >+ >+ * html/HTMLMediaElement.cpp: >+ (WebCore::HTMLMediaElement::HTMLMediaElement): Register for privacy mode changes. >+ (WebCore::HTMLMediaElement::~HTMLMediaElement): Unregister for privacy mode changes. >+ (WebCore::HTMLMediaElement::loadResource): Tell player current privacy mode. >+ (WebCore::HTMLMediaElement::privateBrowsingStateChanged): New, call through to MediaPlayer. >+ * html/HTMLMediaElement.h: >+ >+ * page/Page.cpp: >+ (WebCore::Page::privateBrowsingStateChanged): Call document()->privateBrowsingStateChanged. >+ >+ * platform/graphics/MediaPlayer.cpp: >+ (WebCore::MediaPlayer::setPrivateBrowsingMode): New, call through to media engine. >+ * platform/graphics/MediaPlayer.h: >+ >+ * platform/graphics/MediaPlayerPrivate.h: >+ (WebCore::MediaPlayerPrivateInterface::setPrivateBrowsingMode): Declare new interface. >+ > 2011-02-25 Chris Fleizach <cfleizach@apple.com> > > Reviewed by Anders Carlsson. >Index: Source/WebCore/dom/Document.cpp >=================================================================== >--- Source/WebCore/dom/Document.cpp (revision 79328) >+++ Source/WebCore/dom/Document.cpp (working copy) >@@ -3,7 +3,7 @@ > * (C) 1999 Antti Koivisto (koivisto@kde.org) > * (C) 2001 Dirk Mueller (mueller@kde.org) > * (C) 2006 Alexey Proskuryakov (ap@webkit.org) >- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. >+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. > * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) > * Copyright (C) 2008, 2009 Google Inc. All rights reserved. > * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >@@ -3966,6 +3966,23 @@ void Document::unregisterForMediaVolumeC > m_mediaVolumeCallbackElements.remove(e); > } > >+void Document::privateBrowsingStateChanged(bool privateBrowsingEnabled) >+{ >+ HashSet<Element*>::iterator end = m_privateBrowsingStateChangedElements.end(); >+ for (HashSet<Element*>::iterator i = m_privateBrowsingStateChangedElements.begin(); i != end; ++i) >+ (*i)->privateBrowsingStateChanged(privateBrowsingEnabled); >+} >+ >+void Document::registerForPrivateBrowsingStateChangedCallbacks(Element* e) >+{ >+ m_privateBrowsingStateChangedElements.add(e); >+} >+ >+void Document::unregisterForPrivateBrowsingStateChangedCallbacks(Element* e) >+{ >+ m_privateBrowsingStateChangedElements.remove(e); >+} >+ > void Document::setShouldCreateRenderers(bool f) > { > m_createRenderers = f; >Index: Source/WebCore/dom/Document.h >=================================================================== >--- Source/WebCore/dom/Document.h (revision 79328) >+++ Source/WebCore/dom/Document.h (working copy) >@@ -984,6 +984,10 @@ public: > void unregisterForMediaVolumeCallbacks(Element*); > void mediaVolumeDidChange(); > >+ void registerForPrivateBrowsingStateChangedCallbacks(Element*); >+ void unregisterForPrivateBrowsingStateChangedCallbacks(Element*); >+ void privateBrowsingStateChanged(bool); >+ > void setShouldCreateRenderers(bool); > bool shouldCreateRenderers(); > >@@ -1363,6 +1367,7 @@ private: > > HashSet<Element*> m_documentActivationCallbackElements; > HashSet<Element*> m_mediaVolumeCallbackElements; >+ HashSet<Element*> m_privateBrowsingStateChangedElements; > > bool m_useSecureKeyboardEntryWhenActive; > >Index: Source/WebCore/dom/Element.h >=================================================================== >--- Source/WebCore/dom/Element.h (revision 79328) >+++ Source/WebCore/dom/Element.h (working copy) >@@ -3,7 +3,7 @@ > * (C) 1999 Antti Koivisto (koivisto@kde.org) > * (C) 2001 Peter Kelly (pmk@post.com) > * (C) 2001 Dirk Mueller (mueller@kde.org) >- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -274,6 +274,9 @@ public: > // Use Document::registerForMediaVolumeCallbacks() to subscribe to this > virtual void mediaVolumeDidChange() { } > >+ // Use Document::registerForPrivateBrowsingStateChangedCallbacks() to subscribe to this >+ virtual void privateBrowsingStateChanged(bool) { } >+ > bool isFinishedParsingChildren() const { return isParsingChildrenFinished(); } > virtual void finishParsingChildren(); > virtual void beginParsingChildren(); >Index: Source/WebCore/html/HTMLMediaElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLMediaElement.cpp (revision 79744) >+++ Source/WebCore/html/HTMLMediaElement.cpp (working copy) >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -171,6 +171,7 @@ HTMLMediaElement::HTMLMediaElement(const > LOG(Media, "HTMLMediaElement::HTMLMediaElement"); > document->registerForDocumentActivationCallbacks(this); > document->registerForMediaVolumeCallbacks(this); >+ document->registerForPrivateBrowsingStateChangedCallbacks(this); > } > > HTMLMediaElement::~HTMLMediaElement() >@@ -181,6 +182,7 @@ HTMLMediaElement::~HTMLMediaElement() > setShouldDelayLoadEvent(false); > document()->unregisterForDocumentActivationCallbacks(this); > document()->unregisterForMediaVolumeCallbacks(this); >+ document()->unregisterForPrivateBrowsingStateChangedCallbacks(this); > } > > void HTMLMediaElement::willMoveToNewOwnerDocument() >@@ -696,6 +698,10 @@ void HTMLMediaElement::loadResource(cons > if (m_sendProgressEvents) > startProgressEventTimer(); > >+ Settings* settings = document()->settings(); >+ bool privateMode = !settings || settings->privateBrowsingEnabled(); >+ m_player->setPrivateBrowsingMode(privateMode); >+ > if (!autoplay()) > m_player->setPreload(m_preload); > m_player->setPreservesPitch(m_webkitPreservesPitch); >@@ -2552,6 +2558,12 @@ void HTMLMediaElement::clearMediaCacheFo > m_player->clearMediaCacheForSite(site); > } > >+void HTMLMediaElement::privateBrowsingStateChanged(bool privateBrowsingMode) >+{ >+ if (m_player) >+ m_player->setPrivateBrowsingMode(privateBrowsingMode); >+} >+ > } > > #endif >Index: Source/WebCore/html/HTMLMediaElement.h >=================================================================== >--- Source/WebCore/html/HTMLMediaElement.h (revision 79744) >+++ Source/WebCore/html/HTMLMediaElement.h (working copy) >@@ -180,7 +180,9 @@ public: > void getSitesInMediaCache(Vector<String>&); > void clearMediaCache(); > void clearMediaCacheForSite(const String&); >- >+ >+ void privateBrowsingStateChanged(bool); >+ > protected: > HTMLMediaElement(const QualifiedName&, Document*); > virtual ~HTMLMediaElement(); >Index: Source/WebCore/page/Page.cpp >=================================================================== >--- Source/WebCore/page/Page.cpp (revision 79328) >+++ Source/WebCore/page/Page.cpp (working copy) >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All Rights Reserved. >+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. > * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) > * > * This library is free software; you can redistribute it and/or >@@ -853,6 +853,9 @@ void Page::privateBrowsingStateChanged() > { > bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled(); > >+ for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) >+ frame->document()->privateBrowsingStateChanged(privateBrowsingEnabled); >+ > // Collect the PluginViews in to a vector to ensure that action the plug-in takes > // from below privateBrowsingStateChanged does not affect their lifetime. > Vector<RefPtr<PluginViewBase>, 32> pluginViewBases; >Index: Source/WebCore/platform/graphics/MediaPlayer.cpp >=================================================================== >--- Source/WebCore/platform/graphics/MediaPlayer.cpp (revision 79744) >+++ Source/WebCore/platform/graphics/MediaPlayer.cpp (working copy) >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -733,6 +733,11 @@ void MediaPlayer::clearMediaCacheForSite > m_private->clearMediaCacheForSite(site); > } > >+void MediaPlayer::setPrivateBrowsingMode(bool privateBrowsingMode) >+{ >+ m_private->setPrivateBrowsingMode(privateBrowsingMode); >+} >+ > // Client callbacks. > void MediaPlayer::networkStateChanged() > { >Index: Source/WebCore/platform/graphics/MediaPlayer.h >=================================================================== >--- Source/WebCore/platform/graphics/MediaPlayer.h (revision 79744) >+++ Source/WebCore/platform/graphics/MediaPlayer.h (working copy) >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -291,7 +291,9 @@ public: > void getSitesInMediaCache(Vector<String>&); > void clearMediaCache(); > void clearMediaCacheForSite(const String&); >- >+ >+ void setPrivateBrowsingMode(bool); >+ > private: > MediaPlayer(MediaPlayerClient*); > void loadWithNextMediaEngine(MediaPlayerFactory*); >Index: Source/WebCore/platform/graphics/MediaPlayerPrivate.h >=================================================================== >--- Source/WebCore/platform/graphics/MediaPlayerPrivate.h (revision 79744) >+++ Source/WebCore/platform/graphics/MediaPlayerPrivate.h (working copy) >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. >+ * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -144,6 +144,8 @@ public: > void getSitesInMediaCache(Vector<String>&) { } > void clearMediaCache() { } > void clearMediaCacheForSite(const String&) { } >+ >+ void setPrivateBrowsingMode(bool) { } > }; > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 55287
: 83924