• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 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 // A struct for managing webkit's settings.
6 //
7 // Adding new values to this class probably involves updating
8 // blink::WebSettings, content/common/view_messages.h, browser/tab_contents/
9 // render_view_host_delegate_helper.cc, and browser/profiles/profile.cc.
10 
11 #ifndef WEBKIT_COMMON_WEBPREFERENCES_H__
12 #define WEBKIT_COMMON_WEBPREFERENCES_H__
13 
14 #include <map>
15 #include <string>
16 #include <vector>
17 
18 #include "base/strings/string16.h"
19 #include "url/gurl.h"
20 #include "webkit/common/webkit_common_export.h"
21 
22 namespace blink {
23 class WebView;
24 }
25 
26 struct WebPreferences;
27 
28 namespace webkit_glue {
29 
30 // Map of ISO 15924 four-letter script code to font family.  For example,
31 // "Arab" to "My Arabic Font".
32 typedef std::map<std::string, base::string16> ScriptFontFamilyMap;
33 
34 typedef std::vector<std::pair<std::string, std::string> >
35     WebInspectorPreferences;
36 
37 enum EditingBehavior {
38   EDITING_BEHAVIOR_MAC,
39   EDITING_BEHAVIOR_WIN,
40   EDITING_BEHAVIOR_UNIX,
41   EDITING_BEHAVIOR_ANDROID
42 };
43 
44 
45 // The ISO 15924 script code for undetermined script aka Common. It's the
46 // default used on WebKit's side to get/set a font setting when no script is
47 // specified.
48 WEBKIT_COMMON_EXPORT extern const char kCommonScript[];
49 
50 }  // namespace webkit_glue
51 
52 struct WEBKIT_COMMON_EXPORT WebPreferences {
53   webkit_glue::ScriptFontFamilyMap standard_font_family_map;
54   webkit_glue::ScriptFontFamilyMap fixed_font_family_map;
55   webkit_glue::ScriptFontFamilyMap serif_font_family_map;
56   webkit_glue::ScriptFontFamilyMap sans_serif_font_family_map;
57   webkit_glue::ScriptFontFamilyMap cursive_font_family_map;
58   webkit_glue::ScriptFontFamilyMap fantasy_font_family_map;
59   webkit_glue::ScriptFontFamilyMap pictograph_font_family_map;
60   int default_font_size;
61   int default_fixed_font_size;
62   int minimum_font_size;
63   int minimum_logical_font_size;
64   std::string default_encoding;
65   bool javascript_enabled;
66   bool web_security_enabled;
67   bool javascript_can_open_windows_automatically;
68   bool loads_images_automatically;
69   bool images_enabled;
70   bool plugins_enabled;
71   bool dom_paste_enabled;
72   webkit_glue::WebInspectorPreferences inspector_settings;
73   bool site_specific_quirks_enabled;
74   bool shrinks_standalone_images_to_fit;
75   bool uses_universal_detector;
76   bool text_areas_are_resizable;
77   bool java_enabled;
78   bool allow_scripts_to_close_windows;
79   bool remote_fonts_enabled;
80   bool javascript_can_access_clipboard;
81   bool xslt_enabled;
82   bool xss_auditor_enabled;
83   // We don't use dns_prefetching_enabled to disable DNS prefetching.  Instead,
84   // we disable the feature at a lower layer so that we catch non-WebKit uses
85   // of DNS prefetch as well.
86   bool dns_prefetching_enabled;
87   bool local_storage_enabled;
88   bool databases_enabled;
89   bool application_cache_enabled;
90   bool tabs_to_links;
91   bool caret_browsing_enabled;
92   bool hyperlink_auditing_enabled;
93   bool is_online;
94   bool allow_universal_access_from_file_urls;
95   bool allow_file_access_from_file_urls;
96   bool webaudio_enabled;
97   bool experimental_webgl_enabled;
98   bool flash_3d_enabled;
99   bool flash_stage3d_enabled;
100   bool flash_stage3d_baseline_enabled;
101   bool gl_multisampling_enabled;
102   bool privileged_webgl_extensions_enabled;
103   bool webgl_errors_to_console_enabled;
104   bool accelerated_compositing_for_overflow_scroll_enabled;
105   bool universal_accelerated_compositing_for_overflow_scroll_enabled;
106   bool accelerated_compositing_for_scrollable_frames_enabled;
107   bool composited_scrolling_for_frames_enabled;
108   bool mock_scrollbars_enabled;
109   bool layer_squashing_enabled;
110   bool threaded_html_parser;
111   bool show_paint_rects;
112   bool asynchronous_spell_checking_enabled;
113   bool unified_textchecker_enabled;
114   bool accelerated_compositing_enabled;
115   bool force_compositing_mode;
116   bool accelerated_compositing_for_3d_transforms_enabled;
117   bool accelerated_compositing_for_animation_enabled;
118   bool accelerated_compositing_for_video_enabled;
119   bool accelerated_2d_canvas_enabled;
120   int minimum_accelerated_2d_canvas_size;
121   bool antialiased_2d_canvas_disabled;
122   int accelerated_2d_canvas_msaa_sample_count;
123   bool accelerated_filters_enabled;
124   bool gesture_tap_highlight_enabled;
125   bool accelerated_compositing_for_plugins_enabled;
126   bool memory_info_enabled;
127   bool fullscreen_enabled;
128   bool allow_displaying_insecure_content;
129   bool allow_running_insecure_content;
130   bool password_echo_enabled;
131   bool should_print_backgrounds;
132   bool should_clear_document_background;
133   bool enable_scroll_animator;
134   bool visual_word_movement_enabled;
135   bool css_variables_enabled;
136   bool lazy_layout_enabled;
137   bool region_based_columns_enabled;
138   bool touch_enabled;
139   bool device_supports_touch;
140   bool device_supports_mouse;
141   bool touch_adjustment_enabled;
142   int pointer_events_max_touch_points;
143   bool fixed_position_creates_stacking_context;
144   bool sync_xhr_in_documents_enabled;
145   bool deferred_image_decoding_enabled;
146   bool should_respect_image_orientation;
147   int number_of_cpu_cores;
148   webkit_glue::EditingBehavior editing_behavior;
149   bool supports_multiple_windows;
150   bool viewport_enabled;
151   bool viewport_meta_enabled;
152   bool main_frame_resizes_are_orientation_changes;
153   bool initialize_at_minimum_page_scale;
154   bool smart_insert_delete_enabled;
155   bool spatial_navigation_enabled;
156   bool experimental_websocket_enabled;
157   bool pinch_virtual_viewport_enabled;
158   int pinch_overlay_scrollbar_thickness;
159   bool use_solid_color_scrollbars;
160   bool compositor_touch_hit_testing;
161 
162   // This flags corresponds to a Page's Settings' setCookieEnabled state. It
163   // only controls whether or not the "document.cookie" field is properly
164   // connected to the backing store, for instance if you wanted to be able to
165   // define custom getters and setters from within a unique security content
166   // without raising a DOM security exception.
167   bool cookie_enabled;
168 
169 #if defined(OS_ANDROID)
170   bool text_autosizing_enabled;
171   float font_scale_factor;
172   float device_scale_adjustment;
173   bool force_enable_zoom;
174   bool double_tap_to_zoom_enabled;
175   bool user_gesture_required_for_media_playback;
176   bool user_gesture_required_for_media_fullscreen;
177   GURL default_video_poster_url;
178   bool support_deprecated_target_density_dpi;
179   bool use_legacy_background_size_shorthand_behavior;
180   bool wide_viewport_quirk;
181   bool use_wide_viewport;
182   bool viewport_meta_layout_size_quirk;
183   bool viewport_meta_merge_content_quirk;
184   bool viewport_meta_non_user_scalable_quirk;
185   bool viewport_meta_zero_values_quirk;
186   bool clobber_user_agent_initial_scale_quirk;
187   bool ignore_main_frame_overflow_hidden_quirk;
188   bool report_screen_size_in_physical_pixels_quirk;
189 #endif
190 
191   // We try to keep the default values the same as the default values in
192   // chrome, except for the cases where it would require lots of extra work for
193   // the embedder to use the same default value.
194   WebPreferences();
195   ~WebPreferences();
196 };
197 
198 #endif  // WEBKIT_COMMON_WEBPREFERENCES_H__
199