OLD | NEW |
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" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 template<class T> | 42 template<class T> |
43 static T* GetFromArguments(const v8::Arguments& args) { | 43 static T* GetFromArguments(const v8::Arguments& args) { |
44 CHECK(!args.Data().IsEmpty()); | 44 CHECK(!args.Data().IsEmpty()); |
45 T* result = static_cast<T*>(args.Data().As<v8::External>()->Value()); | 45 T* result = static_cast<T*>(args.Data().As<v8::External>()->Value()); |
46 return result; | 46 return result; |
47 } | 47 } |
48 | 48 |
49 // Gets the render view for the current v8 context. | 49 // Gets the render view for the current v8 context. |
50 static content::RenderView* GetCurrentRenderView(); | 50 static content::RenderView* GetCurrentRenderView(); |
51 | 51 |
52 // 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 | |
54 // be an extension URL. | |
55 const ::Extension* GetExtensionForCurrentRenderView() const; | |
56 | |
57 // Returns the chromeHidden object for the current context. | 52 // Returns the chromeHidden object for the current context. |
58 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); | 53 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); |
59 | 54 |
60 ExtensionDispatcher* extension_dispatcher_; | 55 ExtensionDispatcher* extension_dispatcher_; |
61 | 56 |
62 private: | 57 private: |
63 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension); | 58 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension); |
64 }; | 59 }; |
65 | 60 |
66 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ | 61 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ |
OLD | NEW |