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

Side by Side Diff: Source/core/page/PageConsole.h

Issue 14320022: Warn developers about deprecated features only once per page-load. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: PageConsole. Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
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 14 matching lines...) Expand all
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef PageConsole_h 29 #ifndef PageConsole_h
30 #define PageConsole_h 30 #define PageConsole_h
31 31
32 #include "ConsoleTypes.h" 32 #include "ConsoleTypes.h"
33 #include "ScriptCallStack.h" 33 #include "ScriptCallStack.h"
34 #include "ScriptState.h" 34 #include "ScriptState.h"
35 #include <wtf/BitVector.h>
35 #include <wtf/Forward.h> 36 #include <wtf/Forward.h>
37 #include <wtf/OwnPtr.h>
36 #include <wtf/PassOwnPtr.h> 38 #include <wtf/PassOwnPtr.h>
37 39
38 namespace WebCore { 40 namespace WebCore {
39 41
40 class Document; 42 class Document;
41 class Page; 43 class Page;
42 44
43 class PageConsole { 45 class PageConsole {
44 public: 46 public:
47 enum DeprecatedFeature {
48 PrefixedContentSecurityPolicyHeader,
49
50 // Add newly deprecated features above this line.
51 NumberOfFeatures, // Sentinel.
52 };
53
45 static PassOwnPtr<PageConsole> create(Page* page) { return adoptPtr(new Page Console(page)); } 54 static PassOwnPtr<PageConsole> create(Page* page) { return adoptPtr(new Page Console(page)); }
46 virtual ~PageConsole(); 55 virtual ~PageConsole();
47 56
48 void addMessage(MessageSource, MessageLevel, const String& message, const St ring& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack> = 0, ScriptSta te* = 0, unsigned long requestIdentifier = 0); 57 void addMessage(MessageSource, MessageLevel, const String& message, const St ring& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack> = 0, ScriptSta te* = 0, unsigned long requestIdentifier = 0);
49 void addMessage(MessageSource, MessageLevel, const String& message, PassRefP tr<ScriptCallStack>); 58 void addMessage(MessageSource, MessageLevel, const String& message, PassRefP tr<ScriptCallStack>);
50 void addMessage(MessageSource, MessageLevel, const String& message, unsigned long requestIdentifier = 0, Document* = 0); 59 void addMessage(MessageSource, MessageLevel, const String& message, unsigned long requestIdentifier = 0, Document* = 0);
51 60
61 static void reportDeprecation(Document*, DeprecatedFeature);
62
52 static void mute(); 63 static void mute();
53 static void unmute(); 64 static void unmute();
54 65
55 private: 66 private:
56 PageConsole(Page*); 67 PageConsole(Page*);
57 68
69 void addDeprecationMessage(DeprecatedFeature);
70
58 Page* page() { return m_page; }; 71 Page* page() { return m_page; };
59 72
60 Page* m_page; 73 Page* m_page;
74 OwnPtr<BitVector> m_deprecationNotifications;
61 }; 75 };
62 76
63 } // namespace WebCore 77 } // namespace WebCore
64 78
65 #endif // PageConsole_h 79 #endif // PageConsole_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698