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

Unified Diff: Source/core/page/DeprecationAgent.h

Issue 14320022: Warn developers about deprecated features only once per page-load. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/page/DeprecationAgent.h
diff --git a/Source/core/page/WindowFocusAllowedIndicator.h b/Source/core/page/DeprecationAgent.h
similarity index 53%
copy from Source/core/page/WindowFocusAllowedIndicator.h
copy to Source/core/page/DeprecationAgent.h
index 86598d7d64fefe8f46fc99ad7d1a1ab99f3467b1..13cd736a780be215a2602dc2676bfaf5593da27f 100644
--- a/Source/core/page/WindowFocusAllowedIndicator.h
+++ b/Source/core/page/DeprecationAgent.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Google, Inc. All rights reserved.
+ * Copyright (C) 2013 Google, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,26 +23,51 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WindowFocusAllowedIndicator_h
-#define WindowFocusAllowedIndicator_h
+#ifndef DeprecationAgent_h
+#define DeprecationAgent_h
+#include <wtf/BitVector.h>
#include <wtf/Noncopyable.h>
-#include <wtf/RefPtr.h>
+#include <wtf/OwnPtr.h>
namespace WebCore {
-class WindowFocusAllowedIndicator {
- WTF_MAKE_NONCOPYABLE(WindowFocusAllowedIndicator);
+class DOMWindow;
+class Document;
+class PageConsole;
+
+// DeprecationAgent is used to notify developers about the deprecation of APIs
+// they make use of on pages. This notification would generally be the first
+// step towards dropping support for a feature from Blink entirely.
+//
+// To notify developers that a feature they're making use of is deprecated:
+//
+// 1. Add the feature to the Feature enum below.
+// 2. Add a deprecation message to DeprecationAgent.cpp.
+// 3. Call DeprecationAgent::notify(FEATURE_TYPE, "Deprecation message.");
+// 4. There is no step 4.
+
+class DeprecationAgent {
pfeldman 2013/04/19 13:04:22 It is so small that it feels like deprecation coul
+ WTF_MAKE_NONCOPYABLE(DeprecationAgent);
public:
- WindowFocusAllowedIndicator();
- ~WindowFocusAllowedIndicator();
+ DeprecationAgent();
+ ~DeprecationAgent();
+
+ enum Feature {
+ PrefixedContentSecurityPolicyHeader,
- static bool windowFocusAllowed();
+ // Add new features above this line.
+ NumberOfFeatures, // This enum value must be last.
+ };
+
+ static void notify(Document*, Feature);
private:
- bool m_previousWindowFocusAllowed;
+ void sendNotification(PageConsole*, Feature feature);
+
+ OwnPtr<BitVector> m_countBits;
};
} // namespace WebCore
-#endif // WindowFocusAllowedIndicator_h
+#endif // DeprecationAgent_h

Powered by Google App Engine
This is Rietveld 408576698