Chromecast ATV: distinguish actual shutdown vs. lifecycle from sleep.
[chromium-blink-merge.git] / content / public / common / web_preferences.h
blobab43cd90a57bb76e552c3d84d7ba3148cb2021e9
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_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/strings/string16.h"
13 #include "content/common/content_export.h"
14 #include "net/base/network_change_notifier.h"
15 #include "ui/base/touch/touch_device.h"
16 #include "url/gurl.h"
18 namespace blink {
19 class WebView;
22 namespace content {
24 // Map of ISO 15924 four-letter script code to font family. For example,
25 // "Arab" to "My Arabic Font".
26 typedef std::map<std::string, base::string16> ScriptFontFamilyMap;
28 enum EditingBehavior {
29 EDITING_BEHAVIOR_MAC,
30 EDITING_BEHAVIOR_WIN,
31 EDITING_BEHAVIOR_UNIX,
32 EDITING_BEHAVIOR_ANDROID,
33 EDITING_BEHAVIOR_LAST = EDITING_BEHAVIOR_ANDROID
36 // Cache options for V8. See V8CacheOptions.h for information on the options.
37 enum V8CacheOptions {
38 V8_CACHE_OPTIONS_DEFAULT,
39 V8_CACHE_OPTIONS_PARSE,
40 V8_CACHE_OPTIONS_CODE,
41 V8_CACHE_OPTIONS_CODE_COMPRESSED,
42 V8_CACHE_OPTIONS_NONE,
43 V8_CACHE_OPTIONS_PARSE_MEMORY,
44 V8_CACHE_OPTIONS_HEURISTICS,
45 V8_CACHE_OPTIONS_HEURISTICS_MOBILE,
46 V8_CACHE_OPTIONS_HEURISTICS_DEFAULT,
47 V8_CACHE_OPTIONS_HEURISTICS_DEFAULT_MOBILE,
48 V8_CACHE_OPTIONS_RECENT,
49 V8_CACHE_OPTIONS_RECENT_SMALL,
50 V8_CACHE_OPTIONS_LAST = V8_CACHE_OPTIONS_RECENT_SMALL
53 enum V8ScriptStreamingMode {
54 V8_SCRIPT_STREAMING_MODE_ALL,
55 V8_SCRIPT_STREAMING_MODE_ONLY_ASYNC_AND_DEFER,
56 V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING,
57 V8_SCRIPT_STREAMING_MODE_LAST =
58 V8_SCRIPT_STREAMING_MODE_ALL_PLUS_BLOCK_PARSER_BLOCKING
61 // The ISO 15924 script code for undetermined script aka Common. It's the
62 // default used on WebKit's side to get/set a font setting when no script is
63 // specified.
64 CONTENT_EXPORT extern const char kCommonScript[];
66 // A struct for managing blink's settings.
68 // Adding new values to this class probably involves updating
69 // blink::WebSettings, content/common/view_messages.h, browser/tab_contents/
70 // render_view_host_delegate_helper.cc, and browser/profiles/profile.cc.
71 struct CONTENT_EXPORT WebPreferences {
72 ScriptFontFamilyMap standard_font_family_map;
73 ScriptFontFamilyMap fixed_font_family_map;
74 ScriptFontFamilyMap serif_font_family_map;
75 ScriptFontFamilyMap sans_serif_font_family_map;
76 ScriptFontFamilyMap cursive_font_family_map;
77 ScriptFontFamilyMap fantasy_font_family_map;
78 ScriptFontFamilyMap pictograph_font_family_map;
79 int default_font_size;
80 int default_fixed_font_size;
81 int minimum_font_size;
82 int minimum_logical_font_size;
83 std::string default_encoding;
84 bool javascript_enabled;
85 bool web_security_enabled;
86 bool javascript_can_open_windows_automatically;
87 bool loads_images_automatically;
88 bool images_enabled;
89 bool plugins_enabled;
90 bool dom_paste_enabled;
91 bool shrinks_standalone_images_to_fit;
92 bool uses_universal_detector;
93 bool text_areas_are_resizable;
94 bool java_enabled;
95 bool allow_scripts_to_close_windows;
96 bool remote_fonts_enabled;
97 bool javascript_can_access_clipboard;
98 bool xslt_enabled;
99 bool xss_auditor_enabled;
100 // We don't use dns_prefetching_enabled to disable DNS prefetching. Instead,
101 // we disable the feature at a lower layer so that we catch non-WebKit uses
102 // of DNS prefetch as well.
103 bool dns_prefetching_enabled;
104 bool local_storage_enabled;
105 bool databases_enabled;
106 bool application_cache_enabled;
107 bool tabs_to_links;
108 bool caret_browsing_enabled;
109 bool hyperlink_auditing_enabled;
110 bool is_online;
111 net::NetworkChangeNotifier::ConnectionType connection_type;
112 bool allow_universal_access_from_file_urls;
113 bool allow_file_access_from_file_urls;
114 bool webaudio_enabled;
115 bool experimental_webgl_enabled;
116 bool pepper_3d_enabled;
117 bool flash_3d_enabled;
118 bool flash_stage3d_enabled;
119 bool flash_stage3d_baseline_enabled;
120 bool gl_multisampling_enabled;
121 bool privileged_webgl_extensions_enabled;
122 bool webgl_errors_to_console_enabled;
123 bool mock_scrollbars_enabled;
124 bool asynchronous_spell_checking_enabled;
125 bool unified_textchecker_enabled;
126 bool accelerated_2d_canvas_enabled;
127 int minimum_accelerated_2d_canvas_size;
128 bool antialiased_2d_canvas_disabled;
129 bool antialiased_clips_2d_canvas_enabled;
130 int accelerated_2d_canvas_msaa_sample_count;
131 bool accelerated_filters_enabled;
132 bool deferred_filters_enabled;
133 bool container_culling_enabled;
134 bool text_blobs_enabled;
135 bool allow_displaying_insecure_content;
136 bool allow_running_insecure_content;
137 // If true, taints all <canvas> elements, regardless of origin.
138 bool disable_reading_from_canvas;
139 // Strict mixed content checking disables both displaying and running insecure
140 // mixed content, and disables embedder notifications that such content was
141 // requested (thereby preventing user override).
142 bool strict_mixed_content_checking;
143 // Strict powerful feature restrictions block insecure usage of powerful
144 // features (like geolocation) that we haven't yet disabled for the web at
145 // large.
146 bool strict_powerful_feature_restrictions;
147 bool password_echo_enabled;
148 bool should_print_backgrounds;
149 bool should_clear_document_background;
150 bool enable_scroll_animator;
151 bool css_variables_enabled;
152 bool region_based_columns_enabled;
153 bool touch_enabled;
154 // TODO(mustaq): Nuke when the new API is ready
155 bool device_supports_touch;
156 // TODO(mustaq): Nuke when the new API is ready
157 bool device_supports_mouse;
158 bool touch_adjustment_enabled;
159 int pointer_events_max_touch_points;
160 int available_pointer_types;
161 ui::PointerType primary_pointer_type;
162 int available_hover_types;
163 ui::HoverType primary_hover_type;
164 bool sync_xhr_in_documents_enabled;
165 bool deferred_image_decoding_enabled;
166 bool image_color_profiles_enabled;
167 bool should_respect_image_orientation;
168 int number_of_cpu_cores;
169 EditingBehavior editing_behavior;
170 bool supports_multiple_windows;
171 bool viewport_enabled;
172 bool viewport_meta_enabled;
173 bool main_frame_resizes_are_orientation_changes;
174 bool initialize_at_minimum_page_scale;
175 bool smart_insert_delete_enabled;
176 bool spatial_navigation_enabled;
177 bool pinch_virtual_viewport_enabled;
178 int pinch_overlay_scrollbar_thickness;
179 bool rubber_banding_on_compositor_thread;
180 bool use_solid_color_scrollbars;
181 bool navigate_on_drag_drop;
182 V8CacheOptions v8_cache_options;
183 bool v8_script_streaming_enabled;
184 V8ScriptStreamingMode v8_script_streaming_mode;
185 bool slimming_paint_enabled;
187 // This flags corresponds to a Page's Settings' setCookieEnabled state. It
188 // only controls whether or not the "document.cookie" field is properly
189 // connected to the backing store, for instance if you wanted to be able to
190 // define custom getters and setters from within a unique security content
191 // without raising a DOM security exception.
192 bool cookie_enabled;
194 // This flag indicates whether H/W accelerated video decode is enabled for
195 // pepper plugins. Defaults to false.
196 bool pepper_accelerated_video_decode_enabled;
198 #if defined(OS_ANDROID)
199 bool text_autosizing_enabled;
200 float font_scale_factor;
201 float device_scale_adjustment;
202 bool force_enable_zoom;
203 bool fullscreen_supported;
204 bool double_tap_to_zoom_enabled;
205 bool user_gesture_required_for_media_playback;
206 GURL default_video_poster_url;
207 bool support_deprecated_target_density_dpi;
208 bool use_legacy_background_size_shorthand_behavior;
209 bool wide_viewport_quirk;
210 bool use_wide_viewport;
211 bool force_zero_layout_height;
212 bool viewport_meta_layout_size_quirk;
213 bool viewport_meta_merge_content_quirk;
214 bool viewport_meta_non_user_scalable_quirk;
215 bool viewport_meta_zero_values_quirk;
216 bool clobber_user_agent_initial_scale_quirk;
217 bool ignore_main_frame_overflow_hidden_quirk;
218 bool report_screen_size_in_physical_pixels_quirk;
219 #endif
221 // Default (used if the page or UA doesn't override these) values for page
222 // scale limits. These are set directly on the WebView so there's no analogue
223 // in WebSettings.
224 float default_minimum_page_scale_factor;
225 float default_maximum_page_scale_factor;
227 // We try to keep the default values the same as the default values in
228 // chrome, except for the cases where it would require lots of extra work for
229 // the embedder to use the same default value.
230 WebPreferences();
231 ~WebPreferences();
234 } // namespace content
236 #endif // CONTENT_PUBLIC_COMMON_WEB_PREFERENCES_H_