diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 23:22:52 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 23:22:52 +0000 |
commit | 21e8116075ba590adc902bc83fc430b152d3f00d (patch) | |
tree | 3162037485f91d58e22641233b49cbb7e1be3aac /chrome/renderer/extensions | |
parent | 2602087e32455b71563f0310a04b9c04094a5679 (diff) | |
download | chromium_src-21e8116075ba590adc902bc83fc430b152d3f00d.zip chromium_src-21e8116075ba590adc902bc83fc430b152d3f00d.tar.gz chromium_src-21e8116075ba590adc902bc83fc430b152d3f00d.tar.bz2 |
Change the way json_schema.js is loaded. This is required so
that ChromeOS can use extension-style bindings without polluting the global scope of webpages.
Review URL: http://codereview.chromium.org/173263
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24174 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions')
-rw-r--r-- | chrome/renderer/extensions/extension_process_bindings.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/extensions/js_only_v8_extensions.cc | 29 | ||||
-rw-r--r-- | chrome/renderer/extensions/js_only_v8_extensions.h | 25 |
3 files changed, 55 insertions, 1 deletions
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index ed56ba5..7fc6bda 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -11,8 +11,8 @@ #include "chrome/common/url_constants.h" #include "chrome/renderer/extensions/bindings_utils.h" #include "chrome/renderer/extensions/event_bindings.h" +#include "chrome/renderer/extensions/js_only_v8_extensions.h" #include "chrome/renderer/extensions/renderer_extension_bindings.h" -#include "chrome/renderer/js_only_v8_extensions.h" #include "chrome/renderer/render_view.h" #include "grit/common_resources.h" #include "grit/renderer_resources.h" diff --git a/chrome/renderer/extensions/js_only_v8_extensions.cc b/chrome/renderer/extensions/js_only_v8_extensions.cc new file mode 100644 index 0000000..986e656 --- /dev/null +++ b/chrome/renderer/extensions/js_only_v8_extensions.cc @@ -0,0 +1,29 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/renderer/extensions/js_only_v8_extensions.h" + +#include "chrome/renderer/extensions/bindings_utils.h" +#include "grit/renderer_resources.h" +#include "grit/webkit_resources.h" + +using bindings_utils::GetStringResource; + +// BaseJsV8Extension +const char* BaseJsV8Extension::kName = "chrome/base"; +v8::Extension* BaseJsV8Extension::Get() { + static v8::Extension* extension = + new bindings_utils::ExtensionBase( + kName, GetStringResource<IDR_DEVTOOLS_BASE_JS>(), 0, NULL); + return extension; +} + +// JsonSchemaJsV8Extension +const char* JsonSchemaJsV8Extension::kName = "chrome/jsonschema"; +v8::Extension* JsonSchemaJsV8Extension::Get() { + static v8::Extension* extension = + new bindings_utils::ExtensionBase( + kName, GetStringResource<IDR_JSON_SCHEMA_JS>(), 0, NULL); + return extension; +} diff --git a/chrome/renderer/extensions/js_only_v8_extensions.h b/chrome/renderer/extensions/js_only_v8_extensions.h new file mode 100644 index 0000000..58f9861 --- /dev/null +++ b/chrome/renderer/extensions/js_only_v8_extensions.h @@ -0,0 +1,25 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_RENDERER_EXTENSIONS_JS_ONLY_V8_EXTENSIONS_H_ +#define CHROME_RENDERER_EXTENSIONS_JS_ONLY_V8_EXTENSIONS_H_ + +#include "v8/include/v8.h" + +// This file contains various V8 Extensions that are JavaScript only, and +// don't have any C++ native functions. + +class BaseJsV8Extension { + public: + static const char* kName; + static v8::Extension* Get(); +}; + +class JsonSchemaJsV8Extension { + public: + static const char* kName; + static v8::Extension* Get(); +}; + +#endif // CHROME_RENDERER_JS_ONLY_V8_EXTENSIONS_H_ |