ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / content / public / common / web_preferences.cc
blob97b464ee558f53ada3f7c559e55faead619295fe
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 #include "content/public/common/web_preferences.h"
7 #include "base/basictypes.h"
8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "third_party/WebKit/public/web/WebSettings.h"
11 #include "third_party/icu/source/common/unicode/uchar.h"
13 using blink::WebSettings;
15 namespace content {
17 // "Zyyy" is the ISO 15924 script code for undetermined script aka Common.
18 const char kCommonScript[] = "Zyyy";
20 #define STATIC_ASSERT_MATCHING_ENUMS(content_name, blink_name) \
21 static_assert( \
22 static_cast<int>(content_name) == static_cast<int>(blink_name), \
23 "mismatching enums: " #content_name)
25 STATIC_ASSERT_MATCHING_ENUMS(EDITING_BEHAVIOR_MAC,
26 WebSettings::EditingBehaviorMac);
27 STATIC_ASSERT_MATCHING_ENUMS(EDITING_BEHAVIOR_WIN,
28 WebSettings::EditingBehaviorWin);
29 STATIC_ASSERT_MATCHING_ENUMS(EDITING_BEHAVIOR_UNIX,
30 WebSettings::EditingBehaviorUnix);
31 STATIC_ASSERT_MATCHING_ENUMS(EDITING_BEHAVIOR_ANDROID,
32 WebSettings::EditingBehaviorAndroid);
34 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_DEFAULT,
35 WebSettings::V8CacheOptionsDefault);
36 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_PARSE,
37 WebSettings::V8CacheOptionsParse);
38 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_CODE,
39 WebSettings::V8CacheOptionsCode);
40 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_CODE_COMPRESSED,
41 WebSettings::V8CacheOptionsCodeCompressed);
42 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_NONE,
43 WebSettings::V8CacheOptionsNone);
44 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_PARSE_MEMORY,
45 WebSettings::V8CacheOptionsParseMemory);
46 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_HEURISTICS,
47 WebSettings::V8CacheOptionsHeuristics);
48 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_HEURISTICS_MOBILE,
49 WebSettings::V8CacheOptionsHeuristicsMobile);
50 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_HEURISTICS_DEFAULT,
51 WebSettings::V8CacheOptionsHeuristicsDefault);
52 STATIC_ASSERT_MATCHING_ENUMS(
53 V8_CACHE_OPTIONS_HEURISTICS_DEFAULT_MOBILE,
54 WebSettings::V8CacheOptionsHeuristicsDefaultMobile);
55 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_RECENT,
56 WebSettings::V8CacheOptionsRecent);
57 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_RECENT_SMALL,
58 WebSettings::V8CacheOptionsRecentSmall);
59 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_LAST,
60 WebSettings::V8CacheOptionsRecentSmall);
62 STATIC_ASSERT_MATCHING_ENUMS(IMAGE_ANIMATION_POLICY_ALLOWED,
63 WebSettings::ImageAnimationPolicyAllowed);
64 STATIC_ASSERT_MATCHING_ENUMS(IMAGE_ANIMATION_POLICY_ANIMATION_ONCE,
65 WebSettings::ImageAnimationPolicyAnimateOnce);
66 STATIC_ASSERT_MATCHING_ENUMS(IMAGE_ANIMATION_POLICY_NO_ANIMATION,
67 WebSettings::ImageAnimationPolicyNoAnimation);
69 STATIC_ASSERT_MATCHING_ENUMS(ui::POINTER_TYPE_NONE,
70 WebSettings::PointerTypeNone);
71 STATIC_ASSERT_MATCHING_ENUMS(ui::POINTER_TYPE_COARSE,
72 WebSettings::PointerTypeCoarse);
73 STATIC_ASSERT_MATCHING_ENUMS(ui::POINTER_TYPE_FINE,
74 WebSettings::PointerTypeFine);
76 STATIC_ASSERT_MATCHING_ENUMS(ui::HOVER_TYPE_NONE,
77 WebSettings::HoverTypeNone);
78 STATIC_ASSERT_MATCHING_ENUMS(ui::HOVER_TYPE_ON_DEMAND,
79 WebSettings::HoverTypeOnDemand);
80 STATIC_ASSERT_MATCHING_ENUMS(ui::HOVER_TYPE_HOVER,
81 WebSettings::HoverTypeHover);
83 WebPreferences::WebPreferences()
84 : default_font_size(16),
85 default_fixed_font_size(13),
86 minimum_font_size(0),
87 minimum_logical_font_size(6),
88 default_encoding("ISO-8859-1"),
89 javascript_enabled(true),
90 web_security_enabled(true),
91 javascript_can_open_windows_automatically(true),
92 loads_images_automatically(true),
93 images_enabled(true),
94 plugins_enabled(true),
95 dom_paste_enabled(false), // enables execCommand("paste")
96 shrinks_standalone_images_to_fit(true),
97 uses_universal_detector(false), // Disabled: page cycler regression
98 text_areas_are_resizable(true),
99 java_enabled(true),
100 allow_scripts_to_close_windows(false),
101 remote_fonts_enabled(true),
102 javascript_can_access_clipboard(false),
103 xslt_enabled(true),
104 xss_auditor_enabled(true),
105 dns_prefetching_enabled(true),
106 local_storage_enabled(false),
107 databases_enabled(false),
108 application_cache_enabled(false),
109 tabs_to_links(true),
110 caret_browsing_enabled(false),
111 hyperlink_auditing_enabled(true),
112 is_online(true),
113 connection_type(net::NetworkChangeNotifier::CONNECTION_NONE),
114 allow_universal_access_from_file_urls(false),
115 allow_file_access_from_file_urls(false),
116 webaudio_enabled(false),
117 experimental_webgl_enabled(false),
118 pepper_3d_enabled(false),
119 flash_3d_enabled(true),
120 flash_stage3d_enabled(false),
121 flash_stage3d_baseline_enabled(false),
122 gl_multisampling_enabled(true),
123 privileged_webgl_extensions_enabled(false),
124 webgl_errors_to_console_enabled(true),
125 mock_scrollbars_enabled(false),
126 asynchronous_spell_checking_enabled(true),
127 unified_textchecker_enabled(false),
128 accelerated_2d_canvas_enabled(false),
129 minimum_accelerated_2d_canvas_size(257 * 256),
130 antialiased_2d_canvas_disabled(false),
131 antialiased_clips_2d_canvas_enabled(false),
132 accelerated_2d_canvas_msaa_sample_count(0),
133 accelerated_filters_enabled(false),
134 deferred_filters_enabled(false),
135 container_culling_enabled(false),
136 text_blobs_enabled(false),
137 allow_displaying_insecure_content(true),
138 allow_running_insecure_content(false),
139 disable_reading_from_canvas(false),
140 strict_mixed_content_checking(false),
141 strict_powerful_feature_restrictions(false),
142 password_echo_enabled(false),
143 should_print_backgrounds(false),
144 should_clear_document_background(true),
145 enable_scroll_animator(false),
146 region_based_columns_enabled(false),
147 touch_enabled(false),
148 device_supports_touch(false),
149 device_supports_mouse(true),
150 touch_adjustment_enabled(true),
151 pointer_events_max_touch_points(0),
152 available_pointer_types(0),
153 primary_pointer_type(ui::POINTER_TYPE_NONE),
154 available_hover_types(0),
155 primary_hover_type(ui::HOVER_TYPE_NONE),
156 sync_xhr_in_documents_enabled(true),
157 deferred_image_decoding_enabled(false),
158 image_color_profiles_enabled(false),
159 should_respect_image_orientation(false),
160 number_of_cpu_cores(1),
161 #if defined(OS_MACOSX)
162 editing_behavior(EDITING_BEHAVIOR_MAC),
163 #elif defined(OS_WIN)
164 editing_behavior(EDITING_BEHAVIOR_WIN),
165 #elif defined(OS_ANDROID)
166 editing_behavior(EDITING_BEHAVIOR_ANDROID),
167 #elif defined(OS_POSIX)
168 editing_behavior(EDITING_BEHAVIOR_UNIX),
169 #else
170 editing_behavior(EDITING_BEHAVIOR_MAC),
171 #endif
172 supports_multiple_windows(true),
173 viewport_enabled(false),
174 viewport_meta_enabled(false),
175 main_frame_resizes_are_orientation_changes(false),
176 initialize_at_minimum_page_scale(true),
177 #if defined(OS_MACOSX)
178 smart_insert_delete_enabled(true),
179 #else
180 smart_insert_delete_enabled(false),
181 #endif
182 spatial_navigation_enabled(false),
183 pinch_virtual_viewport_enabled(false),
184 pinch_overlay_scrollbar_thickness(0),
185 rubber_banding_on_compositor_thread(false),
186 use_solid_color_scrollbars(false),
187 navigate_on_drag_drop(true),
188 v8_cache_options(V8_CACHE_OPTIONS_DEFAULT),
189 slimming_paint_enabled(false),
190 cookie_enabled(true),
191 pepper_accelerated_video_decode_enabled(false),
192 animation_policy(IMAGE_ANIMATION_POLICY_ALLOWED),
193 #if defined(OS_ANDROID)
194 text_autosizing_enabled(true),
195 font_scale_factor(1.0f),
196 device_scale_adjustment(1.0f),
197 force_enable_zoom(false),
198 fullscreen_supported(true),
199 double_tap_to_zoom_enabled(true),
200 user_gesture_required_for_media_playback(true),
201 support_deprecated_target_density_dpi(false),
202 use_legacy_background_size_shorthand_behavior(false),
203 wide_viewport_quirk(false),
204 use_wide_viewport(true),
205 force_zero_layout_height(false),
206 viewport_meta_layout_size_quirk(false),
207 viewport_meta_merge_content_quirk(false),
208 viewport_meta_non_user_scalable_quirk(false),
209 viewport_meta_zero_values_quirk(false),
210 clobber_user_agent_initial_scale_quirk(false),
211 ignore_main_frame_overflow_hidden_quirk(false),
212 report_screen_size_in_physical_pixels_quirk(false),
213 #endif
214 #if defined(OS_ANDROID)
215 default_minimum_page_scale_factor(0.25f),
216 default_maximum_page_scale_factor(5.f)
217 #else
218 default_minimum_page_scale_factor(1.f),
219 default_maximum_page_scale_factor(4.f)
220 #endif
222 standard_font_family_map[kCommonScript] =
223 base::ASCIIToUTF16("Times New Roman");
224 fixed_font_family_map[kCommonScript] = base::ASCIIToUTF16("Courier New");
225 serif_font_family_map[kCommonScript] = base::ASCIIToUTF16("Times New Roman");
226 sans_serif_font_family_map[kCommonScript] = base::ASCIIToUTF16("Arial");
227 cursive_font_family_map[kCommonScript] = base::ASCIIToUTF16("Script");
228 fantasy_font_family_map[kCommonScript] = base::ASCIIToUTF16("Impact");
229 pictograph_font_family_map[kCommonScript] =
230 base::ASCIIToUTF16("Times New Roman");
233 WebPreferences::~WebPreferences() {
236 } // namespace content