OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_COMMON_BINDINGS_POLICY_H__ | |
6 #define CHROME_COMMON_BINDINGS_POLICY_H__ | |
7 #pragma once | |
8 | |
9 // This is a utility class that specifies flag values for the types of | |
10 // JavaScript bindings exposed to renderers. | |
11 class BindingsPolicy { | |
12 public: | |
13 enum { | |
14 // HTML-based UI bindings that allows he js content to send JSON-encoded | |
15 // data back to the browser process. | |
16 WEB_UI = 1 << 0, | |
17 // DOM automation bindings that allows the js content to send JSON-encoded | |
18 // data back to automation in the parent process. (By default this isn't | |
19 // allowed unless the app has been started up with the --dom-automation | |
20 // switch.) | |
21 DOM_AUTOMATION = 1 << 1, | |
22 // Bindings that allow access to the external host (through automation). | |
23 EXTERNAL_HOST = 1 << 2, | |
24 // Special bindings with privileged APIs for code running in the extension | |
25 // process. | |
26 EXTENSION = 1 << 3, | |
27 }; | |
28 | |
29 static bool is_web_ui_enabled(int flags) { | |
30 return (flags & WEB_UI) != 0; | |
31 } | |
32 static bool is_dom_automation_enabled(int flags) { | |
33 return (flags & DOM_AUTOMATION) != 0; | |
34 } | |
35 static bool is_external_host_enabled(int flags) { | |
36 return (flags & EXTERNAL_HOST) != 0; | |
37 } | |
38 static bool is_extension_enabled(int flags) { | |
39 return (flags & EXTENSION) != 0; | |
40 } | |
41 }; | |
42 | |
43 #endif // CHROME_COMMON_BINDINGS_POLICY_H__ | |
OLD | NEW |