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

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

Issue 1854983002: [Extensions] Add more bindings access checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 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 25 matching lines...) Expand all
36 typedef base::Callback<void(const v8::FunctionCallbackInfo<v8::Value>&)> 36 typedef base::Callback<void(const v8::FunctionCallbackInfo<v8::Value>&)>
37 HandlerFunction; 37 HandlerFunction;
38 38
39 // Installs a new 'route' from |name| to |handler_function|. This means that 39 // Installs a new 'route' from |name| to |handler_function|. This means that
40 // NewInstance()s of this ObjectBackedNativeHandler will have a property 40 // NewInstance()s of this ObjectBackedNativeHandler will have a property
41 // |name| which will be handled by |handler_function|. 41 // |name| which will be handled by |handler_function|.
42 // 42 //
43 // Routed functions are destroyed along with the destruction of this class, 43 // Routed functions are destroyed along with the destruction of this class,
44 // and are never called back into, therefore it's safe for |handler_function| 44 // and are never called back into, therefore it's safe for |handler_function|
45 // to bind to base::Unretained. 45 // to bind to base::Unretained.
46 //
47 // |feature_name| corresponds to the api feature the native handler is used
48 // for. If the associated ScriptContext does not have access to that feature,
49 // the |handler_function| is not invoked.
50 // TODO(devlin): Deprecate the version that doesn't take a |feature_name|.
46 void RouteFunction(const std::string& name, 51 void RouteFunction(const std::string& name,
47 const HandlerFunction& handler_function); 52 const HandlerFunction& handler_function);
48 void RouteFunction(const std::string& name, 53 void RouteFunction(const std::string& name,
49 const std::string& feature_name, 54 const std::string& feature_name,
50 const HandlerFunction& handler_function); 55 const HandlerFunction& handler_function);
51 56
52 ScriptContext* context() const { return context_; } 57 ScriptContext* context() const { return context_; }
53 58
54 void Invalidate() override; 59 void Invalidate() override;
55 60
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 ScriptContext* context_; 103 ScriptContext* context_;
99 104
100 v8::Global<v8::ObjectTemplate> object_template_; 105 v8::Global<v8::ObjectTemplate> object_template_;
101 106
102 DISALLOW_COPY_AND_ASSIGN(ObjectBackedNativeHandler); 107 DISALLOW_COPY_AND_ASSIGN(ObjectBackedNativeHandler);
103 }; 108 };
104 109
105 } // namespace extensions 110 } // namespace extensions
106 111
107 #endif // EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_ 112 #endif // EXTENSIONS_RENDERER_OBJECT_BACKED_NATIVE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698