1 // Copyright 2014 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.
5 #ifndef CONTENT_PUBLIC_COMMON_WEB_PREFERENCES_H_
6 #define CONTENT_PUBLIC_COMMON_WEB_PREFERENCES_H_
12 #include "base/strings/string16.h"
13 #include "content/common/content_export.h"
14 #include "net/base/network_change_notifier.h"
23 // Map of ISO 15924 four-letter script code to font family. For example,
24 // "Arab" to "My Arabic Font".
25 typedef std::map<std::string, base::string16> ScriptFontFamilyMap;
27 enum EditingBehavior {
30 EDITING_BEHAVIOR_UNIX,
31 EDITING_BEHAVIOR_ANDROID,
32 EDITING_BEHAVIOR_LAST = EDITING_BEHAVIOR_ANDROID
37 V8_CACHE_OPTIONS_PARSE,
38 V8_CACHE_OPTIONS_CODE,
39 V8_CACHE_OPTIONS_LAST = V8_CACHE_OPTIONS_CODE
42 enum V8ScriptStreamingMode {
43 V8_SCRIPT_STREAMING_MODE_ALL,
44 V8_SCRIPT_STREAMING_MODE_ONLY_ASYNC_AND_DEFER,
45 V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING,
46 V8_SCRIPT_STREAMING_MODE_LAST =
47 V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING
50 // The ISO 15924 script code for undetermined script aka Common. It's the
51 // default used on WebKit's side to get/set a font setting when no script is
53 CONTENT_EXPORT extern const char kCommonScript[];
55 // A struct for managing blink's settings.
57 // Adding new values to this class probably involves updating
58 // blink::WebSettings, content/common/view_messages.h, browser/tab_contents/
59 // render_view_host_delegate_helper.cc, and browser/profiles/profile.cc.
60 struct CONTENT_EXPORT WebPreferences {
61 ScriptFontFamilyMap standard_font_family_map;
62 ScriptFontFamilyMap fixed_font_family_map;
63 ScriptFontFamilyMap serif_font_family_map;
64 ScriptFontFamilyMap sans_serif_font_family_map;
65 ScriptFontFamilyMap cursive_font_family_map;
66 ScriptFontFamilyMap fantasy_font_family_map;
67 ScriptFontFamilyMap pictograph_font_family_map;
68 int default_font_size;
69 int default_fixed_font_size;
70 int minimum_font_size;
71 int minimum_logical_font_size;
72 std::string default_encoding;
73 bool javascript_enabled;
74 bool web_security_enabled;
75 bool javascript_can_open_windows_automatically;
76 bool loads_images_automatically;
79 bool dom_paste_enabled;
80 bool shrinks_standalone_images_to_fit;
81 bool uses_universal_detector;
82 bool text_areas_are_resizable;
84 bool allow_scripts_to_close_windows;
85 bool remote_fonts_enabled;
86 bool javascript_can_access_clipboard;
88 bool xss_auditor_enabled;
89 // We don't use dns_prefetching_enabled to disable DNS prefetching. Instead,
90 // we disable the feature at a lower layer so that we catch non-WebKit uses
91 // of DNS prefetch as well.
92 bool dns_prefetching_enabled;
93 bool local_storage_enabled;
94 bool databases_enabled;
95 bool application_cache_enabled;
97 bool caret_browsing_enabled;
98 bool hyperlink_auditing_enabled;
100 net::NetworkChangeNotifier::ConnectionType connection_type;
101 bool allow_universal_access_from_file_urls;
102 bool allow_file_access_from_file_urls;
103 bool webaudio_enabled;
104 bool experimental_webgl_enabled;
105 bool pepper_3d_enabled;
106 bool flash_3d_enabled;
107 bool flash_stage3d_enabled;
108 bool flash_stage3d_baseline_enabled;
109 bool gl_multisampling_enabled;
110 bool privileged_webgl_extensions_enabled;
111 bool webgl_errors_to_console_enabled;
112 bool mock_scrollbars_enabled;
113 bool layer_squashing_enabled;
114 bool asynchronous_spell_checking_enabled;
115 bool unified_textchecker_enabled;
116 bool accelerated_2d_canvas_enabled;
117 int minimum_accelerated_2d_canvas_size;
118 bool antialiased_2d_canvas_disabled;
119 bool antialiased_clips_2d_canvas_enabled;
120 int accelerated_2d_canvas_msaa_sample_count;
121 bool accelerated_filters_enabled;
122 bool deferred_filters_enabled;
123 bool container_culling_enabled;
124 bool text_blobs_enabled;
125 bool allow_displaying_insecure_content;
126 bool allow_running_insecure_content;
127 bool password_echo_enabled;
128 bool should_print_backgrounds;
129 bool should_clear_document_background;
130 bool enable_scroll_animator;
131 bool css_variables_enabled;
132 bool region_based_columns_enabled;
134 bool device_supports_touch;
135 bool device_supports_mouse;
136 bool touch_adjustment_enabled;
137 int pointer_events_max_touch_points;
138 bool sync_xhr_in_documents_enabled;
139 bool deferred_image_decoding_enabled;
140 bool image_color_profiles_enabled;
141 bool should_respect_image_orientation;
142 int number_of_cpu_cores;
143 EditingBehavior editing_behavior;
144 bool supports_multiple_windows;
145 bool viewport_enabled;
146 bool viewport_meta_enabled;
147 bool main_frame_resizes_are_orientation_changes;
148 bool initialize_at_minimum_page_scale;
149 bool smart_insert_delete_enabled;
150 bool spatial_navigation_enabled;
151 bool pinch_virtual_viewport_enabled;
152 int pinch_overlay_scrollbar_thickness;
153 bool use_solid_color_scrollbars;
154 bool navigate_on_drag_drop;
155 V8CacheOptions v8_cache_options;
156 bool v8_script_streaming_enabled;
157 V8ScriptStreamingMode v8_script_streaming_mode;
158 bool slimming_paint_enabled;
160 // This flags corresponds to a Page's Settings' setCookieEnabled state. It
161 // only controls whether or not the "document.cookie" field is properly
162 // connected to the backing store, for instance if you wanted to be able to
163 // define custom getters and setters from within a unique security content
164 // without raising a DOM security exception.
167 // This flag indicates whether H/W accelerated video decode is enabled for
168 // pepper plugins. Defaults to false.
169 bool pepper_accelerated_video_decode_enabled;
171 #if defined(OS_ANDROID)
172 bool text_autosizing_enabled;
173 float font_scale_factor;
174 float device_scale_adjustment;
175 bool force_enable_zoom;
176 bool fullscreen_supported;
177 bool double_tap_to_zoom_enabled;
178 bool user_gesture_required_for_media_playback;
179 GURL default_video_poster_url;
180 bool support_deprecated_target_density_dpi;
181 bool use_legacy_background_size_shorthand_behavior;
182 bool wide_viewport_quirk;
183 bool use_wide_viewport;
184 bool force_zero_layout_height;
185 bool viewport_meta_layout_size_quirk;
186 bool viewport_meta_merge_content_quirk;
187 bool viewport_meta_non_user_scalable_quirk;
188 bool viewport_meta_zero_values_quirk;
189 bool clobber_user_agent_initial_scale_quirk;
190 bool ignore_main_frame_overflow_hidden_quirk;
191 bool report_screen_size_in_physical_pixels_quirk;
194 // We try to keep the default values the same as the default values in
195 // chrome, except for the cases where it would require lots of extra work for
196 // the embedder to use the same default value.
201 } // namespace content
203 #endif // CONTENT_PUBLIC_COMMON_WEB_PREFERENCES_H_