| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // that is unreachable by the page for the current context. | 52 // that is unreachable by the page for the current context. |
| 53 static v8::Handle<v8::Value> GetChromeHidden( | 53 static v8::Handle<v8::Value> GetChromeHidden( |
| 54 const v8::Handle<v8::Context>& context); | 54 const v8::Handle<v8::Context>& context); |
| 55 | 55 |
| 56 void ContextWillBeReleased(ChromeV8Context* context); | 56 void ContextWillBeReleased(ChromeV8Context* context); |
| 57 | 57 |
| 58 // Derived classes should call this at the end of their implementation in | 58 // Derived classes should call this at the end of their implementation in |
| 59 // order to expose common native functions, like GetChromeHidden, to the | 59 // order to expose common native functions, like GetChromeHidden, to the |
| 60 // v8 extension. | 60 // v8 extension. |
| 61 virtual v8::Handle<v8::FunctionTemplate> | 61 virtual v8::Handle<v8::FunctionTemplate> |
| 62 GetNativeFunction(v8::Handle<v8::String> name); | 62 GetNativeFunction(v8::Handle<v8::String> name) OVERRIDE; |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 template<class T> | 65 template<class T> |
| 66 static T* GetFromArguments(const v8::Arguments& args) { | 66 static T* GetFromArguments(const v8::Arguments& args) { |
| 67 CHECK(!args.Data().IsEmpty()); | 67 CHECK(!args.Data().IsEmpty()); |
| 68 T* result = static_cast<T*>(args.Data().As<v8::External>()->Value()); | 68 T* result = static_cast<T*>(args.Data().As<v8::External>()->Value()); |
| 69 return result; | 69 return result; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Gets the render view for the current v8 context. | 72 // Gets the render view for the current v8 context. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 // Map of all current handlers. | 107 // Map of all current handlers. |
| 108 typedef std::map<ChromeV8Context*, | 108 typedef std::map<ChromeV8Context*, |
| 109 linked_ptr<ChromeV8ExtensionHandler> > HandlerMap; | 109 linked_ptr<ChromeV8ExtensionHandler> > HandlerMap; |
| 110 HandlerMap handlers_; | 110 HandlerMap handlers_; |
| 111 | 111 |
| 112 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension); | 112 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ | 115 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ |
| OLD | NEW |