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

Side by Side Diff: extensions/renderer/object_backed_native_handler.h

Issue 1083663004: Revert of Move the event attach/detach logic on unload from event.js to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ 5 #ifndef EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_
6 #define EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ 6 #define EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 v8::Isolate* GetIsolate() const; 32 v8::Isolate* GetIsolate() const;
33 33
34 protected: 34 protected:
35 typedef base::Callback<void(const v8::FunctionCallbackInfo<v8::Value>&)> 35 typedef base::Callback<void(const v8::FunctionCallbackInfo<v8::Value>&)>
36 HandlerFunction; 36 HandlerFunction;
37 37
38 // Installs a new 'route' from |name| to |handler_function|. This means that 38 // Installs a new 'route' from |name| to |handler_function|. This means that
39 // NewInstance()s of this ObjectBackedNativeHandler will have a property 39 // NewInstance()s of this ObjectBackedNativeHandler will have a property
40 // |name| which will be handled by |handler_function|. 40 // |name| which will be handled by |handler_function|.
41 //
42 // Routed functions are destroyed along with the destruction of this class,
43 // and are never called back into, therefore it's safe for |handler_function|
44 // to bind to base::Unretained.
45 void RouteFunction(const std::string& name, 41 void RouteFunction(const std::string& name,
46 const HandlerFunction& handler_function); 42 const HandlerFunction& handler_function);
47 43
48 ScriptContext* context() const { return context_; } 44 ScriptContext* context() const { return context_; }
49 45
50 void Invalidate() override; 46 void Invalidate() override;
51 47
52 private: 48 private:
53 // Callback for RouteFunction which routes the V8 call to the correct 49 // Callback for RouteFunction which routes the V8 call to the correct
54 // base::Bound callback. 50 // base::Bound callback.
(...skipping 18 matching lines...) Expand all
73 ScriptContext* context_; 69 ScriptContext* context_;
74 70
75 v8::Global<v8::ObjectTemplate> object_template_; 71 v8::Global<v8::ObjectTemplate> object_template_;
76 72
77 DISALLOW_COPY_AND_ASSIGN(ObjectBackedNativeHandler); 73 DISALLOW_COPY_AND_ASSIGN(ObjectBackedNativeHandler);
78 }; 74 };
79 75
80 } // namespace extensions 76 } // namespace extensions
81 77
82 #endif // EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ 78 #endif // EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_
OLDNEW
« no previous file with comments | « extensions/renderer/native_handler.cc ('k') | extensions/renderer/object_backed_native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698