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

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

Issue 10821133: Move c/r/extensions/* into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 4 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 (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_EXTENSIONS_CHROME_V8_EXTENSION_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_
6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
11 #include "chrome/renderer/extensions/chrome_v8_extension_handler.h" 11 #include "chrome/renderer/extensions/chrome_v8_extension_handler.h"
12 #include "chrome/renderer/native_handler.h" 12 #include "chrome/renderer/native_handler.h"
13 #include "v8/include/v8.h" 13 #include "v8/include/v8.h"
14 14
15 #include <map> 15 #include <map>
16 #include <set> 16 #include <set>
17 #include <string> 17 #include <string>
18 18
19 class ChromeV8Context;
20 class ExtensionDispatcher;
21 19
22 namespace content { 20 namespace content {
23 class RenderView; 21 class RenderView;
24 } 22 }
25 23
26 namespace extensions { 24 namespace extensions {
25 class ChromeV8Context;
26 class Dispatcher;
27 class Extension; 27 class Extension;
28 }
29 28
30 // This is a base class for chrome extension bindings. Common features that 29 // This is a base class for chrome extension bindings. Common features that
31 // are shared by different modules go here. 30 // are shared by different modules go here.
32 // TODO(koz): Rename this to ExtensionNativeModule. 31 // TODO(koz): Rename this to ExtensionNativeModule.
33 class ChromeV8Extension : public NativeHandler { 32 class ChromeV8Extension : public NativeHandler {
34 public: 33 public:
35 typedef std::set<ChromeV8Extension*> InstanceSet; 34 typedef std::set<ChromeV8Extension*> InstanceSet;
36 static const InstanceSet& GetAll(); 35 static const InstanceSet& GetAll();
37 36
38 explicit ChromeV8Extension(ExtensionDispatcher* extension_dispatcher); 37 explicit ChromeV8Extension(Dispatcher* dispatcher);
39 virtual ~ChromeV8Extension(); 38 virtual ~ChromeV8Extension();
40 39
41 ExtensionDispatcher* extension_dispatcher() { return extension_dispatcher_; } 40 Dispatcher* dispatcher() { return dispatcher_; }
42 41
43 protected: 42 protected:
44 template<class T> 43 template<class T>
45 static T* GetFromArguments(const v8::Arguments& args) { 44 static T* GetFromArguments(const v8::Arguments& args) {
46 CHECK(!args.Data().IsEmpty()); 45 CHECK(!args.Data().IsEmpty());
47 T* result = static_cast<T*>(args.Data().As<v8::External>()->Value()); 46 T* result = static_cast<T*>(args.Data().As<v8::External>()->Value());
48 return result; 47 return result;
49 } 48 }
50 49
51 // Gets the render view for the current v8 context. 50 // Gets the render view for the current v8 context.
52 static content::RenderView* GetCurrentRenderView(); 51 static content::RenderView* GetCurrentRenderView();
53 52
54 // Note: do not call this function before or during the chromeHidden.onLoad 53 // Note: do not call this function before or during the chromeHidden.onLoad
55 // event dispatch. The URL might not have been committed yet and might not 54 // event dispatch. The URL might not have been committed yet and might not
56 // be an extension URL. 55 // be an extension URL.
57 const extensions::Extension* GetExtensionForCurrentRenderView() const; 56 const Extension* GetExtensionForCurrentRenderView() const;
58 57
59 // Returns the chromeHidden object for the current context. 58 // Returns the chromeHidden object for the current context.
60 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); 59 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args);
61 60
62 ExtensionDispatcher* extension_dispatcher_; 61 Dispatcher* dispatcher_;
63 62
64 private: 63 private:
65 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension); 64 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension);
66 }; 65 };
67 66
67 } // namespace extensions
68
68 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ 69 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context_set_unittest.cc ('k') | chrome/renderer/extensions/chrome_v8_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698