Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / public / common / web_preferences.cc
blobe140001c6f2fe2f95688df4b500f8a437c5b18c5
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_NONE,
37 WebSettings::V8CacheOptionsNone);
38 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_PARSE,
39 WebSettings::V8CacheOptionsParse);
40 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_CODE,
41 WebSettings::V8CacheOptionsCode);
42 STATIC_ASSERT_MATCHING_ENUMS(V8_CACHE_OPTIONS_LAST,
43 WebSettings::V8CacheOptionsCode);
45 STATIC_ASSERT_MATCHING_ENUMS(IMAGE_ANIMATION_POLICY_ALLOWED,
46 WebSettings::ImageAnimationPolicyAllowed);
47 STATIC_ASSERT_MATCHING_ENUMS(IMAGE_ANIMATION_POLICY_ANIMATION_ONCE,
48 WebSettings::ImageAnimationPolicyAnimateOnce);
49 STATIC_ASSERT_MATCHING_ENUMS(IMAGE_ANIMATION_POLICY_NO_ANIMATION,
50 WebSettings::ImageAnimationPolicyNoAnimation);
52 STATIC_ASSERT_MATCHING_ENUMS(ui::POINTER_TYPE_NONE,
53 WebSettings::PointerTypeNone);
54 STATIC_ASSERT_MATCHING_ENUMS(ui::POINTER_TYPE_COARSE,
55 WebSettings::PointerTypeCoarse);
56 STATIC_ASSERT_MATCHING_ENUMS(ui::POINTER_TYPE_FINE,
57 WebSettings::PointerTypeFine);
59 STATIC_ASSERT_MATCHING_ENUMS(ui::HOVER_TYPE_NONE,
60 WebSettings::HoverTypeNone);
61 STATIC_ASSERT_MATCHING_ENUMS(ui::HOVER_TYPE_ON_DEMAND,
62 WebSettings::HoverTypeOnDemand);
63 STATIC_ASSERT_MATCHING_ENUMS(ui::HOVER_TYPE_HOVER,
64 WebSettings::HoverTypeHover);
66 WebPreferences::WebPreferences()
67 : default_font_size(16),
68 default_fixed_font_size(13),
69 minimum_font_size(0),
70 minimum_logical_font_size(6),
71 default_encoding("ISO-8859-1"),
72 #if defined(OS_WIN)
73 context_menu_on_mouse_up(true),
74 #else
75 context_menu_on_mouse_up(false),
76 #endif
77 javascript_enabled(true),
78 web_security_enabled(true),
79 javascript_can_open_windows_automatically(true),
80 loads_images_automatically(true),
81 images_enabled(true),
82 plugins_enabled(true),
83 dom_paste_enabled(false), // enables execCommand("paste")
84 shrinks_standalone_images_to_fit(true),
85 uses_universal_detector(false), // Disabled: page cycler regression
86 text_areas_are_resizable(true),
87 java_enabled(true),
88 allow_scripts_to_close_windows(false),
89 remote_fonts_enabled(true),
90 javascript_can_access_clipboard(false),
91 xslt_enabled(true),
92 xss_auditor_enabled(true),
93 dns_prefetching_enabled(true),
94 local_storage_enabled(false),
95 databases_enabled(false),
96 application_cache_enabled(false),
97 tabs_to_links(true),
98 caret_browsing_enabled(false),
99 hyperlink_auditing_enabled(true),
100 is_online(true),
101 connection_type(net::NetworkChangeNotifier::CONNECTION_NONE),
102 allow_universal_access_from_file_urls(false),
103 allow_file_access_from_file_urls(false),
104 webaudio_enabled(false),
105 experimental_webgl_enabled(false),
106 pepper_3d_enabled(false),
107 flash_3d_enabled(true),
108 flash_stage3d_enabled(false),
109 flash_stage3d_baseline_enabled(false),
110 gl_multisampling_enabled(true),
111 privileged_webgl_extensions_enabled(false),
112 webgl_errors_to_console_enabled(true),
113 mock_scrollbars_enabled(false),
114 asynchronous_spell_checking_enabled(true),
115 unified_textchecker_enabled(false),
116 accelerated_2d_canvas_enabled(false),
117 minimum_accelerated_2d_canvas_size(257 * 256),
118 antialiased_2d_canvas_disabled(false),
119 antialiased_clips_2d_canvas_enabled(false),
120 accelerated_2d_canvas_msaa_sample_count(0),
121 accelerated_filters_enabled(false),
122 deferred_filters_enabled(false),
123 container_culling_enabled(false),
124 text_blobs_enabled(false),
125 allow_displaying_insecure_content(true),
126 allow_running_insecure_content(false),
127 disable_reading_from_canvas(false),
128 strict_mixed_content_checking(false),
129 strict_powerful_feature_restrictions(false),
130 password_echo_enabled(false),
131 should_print_backgrounds(false),
132 should_clear_document_background(true),
133 enable_scroll_animator(false),
134 touch_enabled(false),
135 device_supports_touch(false),
136 device_supports_mouse(true),
137 touch_adjustment_enabled(true),
138 pointer_events_max_touch_points(0),
139 available_pointer_types(0),
140 primary_pointer_type(ui::POINTER_TYPE_NONE),
141 available_hover_types(0),
142 primary_hover_type(ui::HOVER_TYPE_NONE),
143 sync_xhr_in_documents_enabled(true),
144 image_color_profiles_enabled(false),
145 should_respect_image_orientation(false),
146 number_of_cpu_cores(1),
147 #if defined(OS_MACOSX)
148 editing_behavior(EDITING_BEHAVIOR_MAC),
149 #elif defined(OS_WIN)
150 editing_behavior(EDITING_BEHAVIOR_WIN),
151 #elif defined(OS_ANDROID)
152 editing_behavior(EDITING_BEHAVIOR_ANDROID),
153 #elif defined(OS_POSIX)
154 editing_behavior(EDITING_BEHAVIOR_UNIX),
155 #else
156 editing_behavior(EDITING_BEHAVIOR_MAC),
157 #endif
158 supports_multiple_windows(true),
159 viewport_enabled(false),
160 viewport_meta_enabled(false),
161 main_frame_resizes_are_orientation_changes(false),
162 initialize_at_minimum_page_scale(true),
163 #if defined(OS_MACOSX)
164 smart_insert_delete_enabled(true),
165 #else
166 smart_insert_delete_enabled(false),
167 #endif
168 spatial_navigation_enabled(false),
169 invert_viewport_scroll_order(false),
170 pinch_overlay_scrollbar_thickness(0),
171 use_solid_color_scrollbars(false),
172 navigate_on_drag_drop(true),
173 v8_cache_options(V8_CACHE_OPTIONS_DEFAULT),
174 slimming_paint_enabled(false),
175 cookie_enabled(true),
176 pepper_accelerated_video_decode_enabled(false),
177 animation_policy(IMAGE_ANIMATION_POLICY_ALLOWED),
178 #if defined(OS_ANDROID)
179 text_autosizing_enabled(true),
180 font_scale_factor(1.0f),
181 device_scale_adjustment(1.0f),
182 force_enable_zoom(false),
183 fullscreen_supported(true),
184 double_tap_to_zoom_enabled(true),
185 user_gesture_required_for_media_playback(true),
186 support_deprecated_target_density_dpi(false),
187 use_legacy_background_size_shorthand_behavior(false),
188 wide_viewport_quirk(false),
189 use_wide_viewport(true),
190 force_zero_layout_height(false),
191 viewport_meta_layout_size_quirk(false),
192 viewport_meta_merge_content_quirk(false),
193 viewport_meta_non_user_scalable_quirk(false),
194 viewport_meta_zero_values_quirk(false),
195 clobber_user_agent_initial_scale_quirk(false),
196 ignore_main_frame_overflow_hidden_quirk(false),
197 report_screen_size_in_physical_pixels_quirk(false),
198 #endif
199 #if defined(OS_ANDROID)
200 default_minimum_page_scale_factor(0.25f),
201 default_maximum_page_scale_factor(5.f)
202 #elif defined(OS_MACOSX)
203 default_minimum_page_scale_factor(1.f),
204 default_maximum_page_scale_factor(3.f)
205 #else
206 default_minimum_page_scale_factor(1.f),
207 default_maximum_page_scale_factor(4.f)
208 #endif
210 standard_font_family_map[kCommonScript] =
211 base::ASCIIToUTF16("Times New Roman");
212 fixed_font_family_map[kCommonScript] = base::ASCIIToUTF16("Courier New");
213 serif_font_family_map[kCommonScript] = base::ASCIIToUTF16("Times New Roman");
214 sans_serif_font_family_map[kCommonScript] = base::ASCIIToUTF16("Arial");
215 cursive_font_family_map[kCommonScript] = base::ASCIIToUTF16("Script");
216 fantasy_font_family_map[kCommonScript] = base::ASCIIToUTF16("Impact");
217 pictograph_font_family_map[kCommonScript] =
218 base::ASCIIToUTF16("Times New Roman");
221 WebPreferences::~WebPreferences() {
224 } // namespace content