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

Unified Diff: fpdfsdk/javascript/cjs_runtime.h

Issue 2322743002: Replace CJS_Runtime::Observer with CFX_Runtime<CJS_Runtime>::Observer (Closed)
Patch Set: Order matters Created 4 years, 3 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
« no previous file with comments | « fpdfsdk/javascript/app.cpp ('k') | fpdfsdk/javascript/cjs_runtime.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/cjs_runtime.h
diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h
index 33d2956ce3d973e465876ae7add68d2276acbff5..5157c416ad6063c00fd7490e66eec8ee93edd0d4 100644
--- a/fpdfsdk/javascript/cjs_runtime.h
+++ b/fpdfsdk/javascript/cjs_runtime.h
@@ -13,6 +13,7 @@
#include <utility>
#include <vector>
+#include "core/fxcrt/include/cfx_observable.h"
#include "core/fxcrt/include/fx_basic.h"
#include "fpdfsdk/javascript/JS_EventHandler.h"
#include "fpdfsdk/javascript/ijs_runtime.h"
@@ -20,16 +21,10 @@
class CJS_Context;
-class CJS_Runtime : public IJS_Runtime, public CFXJS_Engine {
+class CJS_Runtime : public IJS_Runtime,
+ public CFXJS_Engine,
+ public CFX_Observable<CJS_Runtime> {
public:
- class Observer {
- public:
- virtual void OnDestroyed() = 0;
-
- protected:
- virtual ~Observer() {}
- };
-
using FieldEvent = std::pair<CFX_WideString, JS_EVENT_T>;
static CJS_Runtime* FromContext(const IJS_Context* cc);
@@ -64,9 +59,6 @@ class CJS_Runtime : public IJS_Runtime, public CFXJS_Engine {
CFXJSE_Value* pValue) override;
#endif // PDF_ENABLE_XFA
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
-
private:
void DefineJSObjects();
@@ -76,7 +68,6 @@ class CJS_Runtime : public IJS_Runtime, public CFXJS_Engine {
bool m_bBlocking;
bool m_isolateManaged;
std::set<FieldEvent> m_FieldEventSet;
- std::set<Observer*> m_observers;
};
#endif // FPDFSDK_JAVASCRIPT_CJS_RUNTIME_H_
« no previous file with comments | « fpdfsdk/javascript/app.cpp ('k') | fpdfsdk/javascript/cjs_runtime.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698