diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 19:35:09 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 19:35:09 +0000 |
commit | 81e6378c98d0e69339302527eb1de4735d1e2c3f (patch) | |
tree | d8020f1a2a842b0735c22a35e89a97ec7630bf17 /chrome/common/bindings_policy.h | |
parent | 4c8c60ee58cf2f22fcdc0cf3b30f1f5e8884f0ff (diff) | |
download | chromium_src-81e6378c98d0e69339302527eb1de4735d1e2c3f.zip chromium_src-81e6378c98d0e69339302527eb1de4735d1e2c3f.tar.gz chromium_src-81e6378c98d0e69339302527eb1de4735d1e2c3f.tar.bz2 |
Prototype extension process. This is a proof of concept, with a lot of
rough edges. Mostly this just fires up a renderer with an "extension" object
exposed, which right now only has a single method "getTestString".
I also did some misc cleanup along the way.
Review URL: http://codereview.chromium.org/27187
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10620 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/bindings_policy.h')
-rwxr-xr-x | chrome/common/bindings_policy.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/chrome/common/bindings_policy.h b/chrome/common/bindings_policy.h new file mode 100755 index 0000000..eccce17 --- /dev/null +++ b/chrome/common/bindings_policy.h @@ -0,0 +1,42 @@ +// Copyright (c) 2006-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_COMMON_BINDINGS_POLICY_H__ +#define CHROME_COMMON_BINDINGS_POLICY_H__ + +// This is a utility class that specifies flag values for the types of +// JavaScript bindings exposed to renderers. +class BindingsPolicy { + public: + enum { + // HTML-based UI bindings that allows he js content to send JSON-encoded + // data back to the browser process. + DOM_UI = 1 << 0, + // DOM automation bindings that allows the js content to send JSON-encoded + // data back to automation in the parent process. (By default this isn't + // allowed unless the app has been started up with the --dom-automation + // switch.) + DOM_AUTOMATION = 1 << 1, + // Bindings that allow access to the external host (through automation). + EXTERNAL_HOST = 1 << 2, + // Special bindings with privileged APIs for code running in the extension + // process. + EXTENSION = 1 << 3, + }; + + static bool is_dom_ui_enabled(int flags) { + return (flags & DOM_UI) != 0; + } + static bool is_dom_automation_enabled(int flags) { + return (flags & DOM_AUTOMATION) != 0; + } + static bool is_external_host_enabled(int flags) { + return (flags & EXTERNAL_HOST) != 0; + } + static bool is_extension_enabled(int flags) { + return (flags & EXTENSION) != 0; + } +}; + +#endif // CHROME_COMMON_BINDINGS_POLICY_H__ |