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