Chromium Code Reviews| 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_CONTEXT_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 13 | 13 |
| 14 namespace WebKit { | 14 namespace WebKit { |
| 15 class WebFrame; | 15 class WebFrame; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class RenderView; | 19 class RenderView; |
| 20 } | 20 } |
| 21 | 21 |
| 22 // Chrome's wrapper for a v8 context. | 22 // Chrome's wrapper for a v8 context. |
| 23 // | 23 // |
| 24 // TODO(aa): Consider converting this back to a set of bindings_utils. It would | 24 // TODO(aa): Consider converting this back to a set of bindings_utils. It would |
| 25 // require adding WebFrame::GetIsolatedWorldIdByV8Context() to WebCore, but then | 25 // require adding WebFrame::GetIsolatedWorldIdByV8Context() to WebCore, but then |
| 26 // we won't need this object and it's a bit less state to keep track of. | 26 // we won't need this object and it's a bit less state to keep track of. |
| 27 class ChromeV8Context { | 27 class ChromeV8Context { |
| 28 public: | 28 public: |
| 29 enum ContextType { | 29 enum ContextType { |
| 30 // Blessed contexts such as chrome-extension:// URLs that run in their own | |
| 31 // (extension) processes. | |
| 32 PRIVILEGED, | |
|
Aaron Boodman
2012/02/29 01:03:58
PRIVILEGED_EXTENSION_PAGE,
UNPRIVILEGED_EXTENSION_
not at google - send to devlin
2012/03/05 07:46:54
Done.
As discussed: just used the Features versio
| |
| 33 | |
| 34 // All content scripts. | |
| 30 CONTENT_SCRIPT, | 35 CONTENT_SCRIPT, |
| 31 | 36 |
| 32 // TODO(kalman): for now, have this as OTHER, since we only currently need | 37 // Extension contexts that are unprivileged, such as web accessible |
| 33 // know whether something is a content script or not. However, when | 38 // resoures that are running in iframes. |
| 34 // necessary this should enumerate the other types, such as FRAME. | 39 UNPRIVILEGED, |
| 35 OTHER | 40 |
| 41 // Normal web pages. | |
| 42 WEB_PAGE | |
| 36 }; | 43 }; |
| 37 | 44 |
| 38 ChromeV8Context(v8::Handle<v8::Context> context, | 45 ChromeV8Context(v8::Handle<v8::Context> context, |
| 39 WebKit::WebFrame* frame, | 46 WebKit::WebFrame* frame, |
| 40 const std::string& extension_id, | 47 const std::string& extension_id, |
| 41 ContextType context_type); | 48 ContextType context_type); |
| 42 ~ChromeV8Context(); | 49 ~ChromeV8Context(); |
| 43 | 50 |
| 44 v8::Handle<v8::Context> v8_context() const { | 51 v8::Handle<v8::Context> v8_context() const { |
| 45 return v8_context_; | 52 return v8_context_; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 // The extension ID this context is associated with. | 117 // The extension ID this context is associated with. |
| 111 std::string extension_id_; | 118 std::string extension_id_; |
| 112 | 119 |
| 113 // The type of context. | 120 // The type of context. |
| 114 ContextType context_type_; | 121 ContextType context_type_; |
| 115 | 122 |
| 116 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); | 123 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); |
| 117 }; | 124 }; |
| 118 | 125 |
| 119 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 126 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
| OLD | NEW |