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