| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/renderer/extensions/extension_process_bindings.h" | 5 #include "chrome/renderer/extensions/extension_process_bindings.h" |
| 6 | 6 |
| 7 #include "base/singleton.h" | 7 #include "base/singleton.h" |
| 8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/renderer/extensions/bindings_utils.h" | 10 #include "chrome/renderer/extensions/bindings_utils.h" |
| 11 #include "chrome/renderer/extensions/event_bindings.h" | 11 #include "chrome/renderer/extensions/event_bindings.h" |
| 12 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 12 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
| 13 #include "chrome/renderer/js_only_v8_extensions.h" | 13 #include "chrome/renderer/js_only_v8_extensions.h" |
| 14 #include "chrome/renderer/render_view.h" | 14 #include "chrome/renderer/render_view.h" |
| 15 #include "grit/renderer_resources.h" | 15 #include "grit/renderer_resources.h" |
| 16 #include "webkit/api/public/WebScriptSource.h" | 16 #include "webkit/api/public/WebScriptSource.h" |
| 17 #include "webkit/glue/webframe.h" | 17 #include "webkit/glue/webframe.h" |
| 18 | 18 |
| 19 using WebKit::WebScriptSource; | 19 using WebKit::WebScriptSource; |
| 20 using WebKit::WebString; | 20 using WebKit::WebString; |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const char kExtensionName[] = "chrome/ExtensionProcessBindings"; | 24 const char kExtensionName[] = "chrome/ExtensionProcessBindings"; |
| 25 const char* kExtensionDeps[] = { | 25 const char* kExtensionDeps[] = { |
| 26 BaseJsV8Extension::kName, | 26 BaseJsV8Extension::kName, |
| 27 EventBindings::kName, | 27 EventBindings::kName, |
| 28 JsonJsV8Extension::kName, | |
| 29 JsonSchemaJsV8Extension::kName, | 28 JsonSchemaJsV8Extension::kName, |
| 30 RendererExtensionBindings::kName, | 29 RendererExtensionBindings::kName, |
| 31 }; | 30 }; |
| 32 | 31 |
| 33 // Types for storage of per-renderer-singleton data structure that maps | 32 // Types for storage of per-renderer-singleton data structure that maps |
| 34 // |extension_id| -> <List of v8 Contexts for the "views" of that extension> | 33 // |extension_id| -> <List of v8 Contexts for the "views" of that extension> |
| 35 typedef std::list< v8::Persistent<v8::Context> > ContextList; | 34 typedef std::list< v8::Persistent<v8::Context> > ContextList; |
| 36 typedef std::map<std::string, ContextList> ExtensionIdContextsMap; | 35 typedef std::map<std::string, ContextList> ExtensionIdContextsMap; |
| 37 struct ExtensionViewContexts { | 36 struct ExtensionViewContexts { |
| 38 ExtensionIdContextsMap contexts; | 37 ExtensionIdContextsMap contexts; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 ReplaceSubstringsAfterOffset(&code, offset, "'", "\\'"); | 207 ReplaceSubstringsAfterOffset(&code, offset, "'", "\\'"); |
| 209 code += "', '"; | 208 code += "', '"; |
| 210 offset = code.length(); | 209 offset = code.length(); |
| 211 code += error; | 210 code += error; |
| 212 ReplaceSubstringsAfterOffset(&code, offset, "\\", "\\\\"); | 211 ReplaceSubstringsAfterOffset(&code, offset, "\\", "\\\\"); |
| 213 ReplaceSubstringsAfterOffset(&code, offset, "'", "\\'"); | 212 ReplaceSubstringsAfterOffset(&code, offset, "'", "\\'"); |
| 214 code += "')"; | 213 code += "')"; |
| 215 | 214 |
| 216 call->frame_->ExecuteScript(WebScriptSource(WebString::fromUTF8(code))); | 215 call->frame_->ExecuteScript(WebScriptSource(WebString::fromUTF8(code))); |
| 217 } | 216 } |
| OLD | NEW |