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

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

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