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

Side by Side Diff: chrome/renderer/extensions/native_handler.h

Issue 10879107: Move ModuleSystem and NativeHandler to extensions/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_RENDERER_NATIVE_HANDLER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
6 #define CHROME_RENDERER_NATIVE_HANDLER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "v8/include/v8.h" 10 #include "v8/include/v8.h"
11 11
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 namespace extensions {
16
15 // A NativeHandler is a factory for JS objects with functions on them that map 17 // A NativeHandler is a factory for JS objects with functions on them that map
16 // to native C++ functions. Subclasses should call RouteFunction() in their 18 // to native C++ functions. Subclasses should call RouteFunction() in their
17 // constructor to define functions on the created JS objects. 19 // constructor to define functions on the created JS objects.
18 // 20 //
19 // NativeHandlers are intended to be used with a ModuleSystem. The ModuleSystem 21 // NativeHandlers are intended to be used with a ModuleSystem. The ModuleSystem
20 // will assume ownership of the NativeHandler, and as a ModuleSystem is tied to 22 // will assume ownership of the NativeHandler, and as a ModuleSystem is tied to
21 // a single v8::Context, this implies that NativeHandlers will also be tied to 23 // a single v8::Context, this implies that NativeHandlers will also be tied to
22 // a single v8::context. 24 // a single v8::context.
23 // TODO(koz): Rename this to NativeJavaScriptModule. 25 // TODO(koz): Rename this to NativeJavaScriptModule.
24 class NativeHandler { 26 class NativeHandler {
(...skipping 21 matching lines...) Expand all
46 48
47 private: 49 private:
48 static v8::Handle<v8::Value> Router(const v8::Arguments& args); 50 static v8::Handle<v8::Value> Router(const v8::Arguments& args);
49 51
50 std::vector<linked_ptr<HandlerFunction> > handler_functions_; 52 std::vector<linked_ptr<HandlerFunction> > handler_functions_;
51 v8::Persistent<v8::ObjectTemplate> object_template_; 53 v8::Persistent<v8::ObjectTemplate> object_template_;
52 54
53 DISALLOW_COPY_AND_ASSIGN(NativeHandler); 55 DISALLOW_COPY_AND_ASSIGN(NativeHandler);
54 }; 56 };
55 57
56 #endif // CHROME_RENDERER_NATIVE_HANDLER_H_ 58 } // extensions
59
60 #endif // CHROME_RENDERER_EXTENSIONS_NATIVE_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/module_system_unittest.cc ('k') | chrome/renderer/extensions/native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698