renderer_preferences.h revision d0247b1b59f9c528cb6df88b4f2b9afaf80d181e
1// Copyright (c) 2012 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 browser's settings that apply to the renderer or its
6// webview.  These differ from WebPreferences since they apply to Chromium's
7// glue layer rather than applying to just WebKit.
8//
9// Adding new values to this class probably involves updating
10// common/view_messages.h, browser/browser.cc, etc.
11
12#ifndef CONTENT_PUBLIC_COMMON_RENDERER_PREFERENCES_H_
13#define CONTENT_PUBLIC_COMMON_RENDERER_PREFERENCES_H_
14
15#include <string>
16#include <vector>
17
18#include "content/common/content_export.h"
19#include "third_party/skia/include/core/SkColor.h"
20
21namespace content {
22
23enum RendererPreferencesHintingEnum {
24  RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT = 0,
25  RENDERER_PREFERENCES_HINTING_NONE,
26  RENDERER_PREFERENCES_HINTING_SLIGHT,
27  RENDERER_PREFERENCES_HINTING_MEDIUM,
28  RENDERER_PREFERENCES_HINTING_FULL,
29};
30
31enum RendererPreferencesSubpixelRenderingEnum {
32  RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT = 0,
33  RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE,
34  RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB,
35  RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR,
36  RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB,
37  RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR,
38};
39
40enum TapMultipleTargetsStrategy {
41  TAP_MULTIPLE_TARGETS_STRATEGY_ZOOM = 0,
42  TAP_MULTIPLE_TARGETS_STRATEGY_POPUP,
43  TAP_MULTIPLE_TARGETS_STRATEGY_NONE,
44
45  TAP_MULTIPLE_TARGETS_STRATEGY_MAX = TAP_MULTIPLE_TARGETS_STRATEGY_NONE,
46};
47
48struct CONTENT_EXPORT RendererPreferences {
49  RendererPreferences();
50  ~RendererPreferences();
51
52  // Whether the renderer's current browser context accept drops from the OS
53  // that result in navigations away from the current page.
54  bool can_accept_load_drops;
55
56  // Whether text should be antialiased.
57  // Currently only used by Linux.
58  bool should_antialias_text;
59
60  // The level of hinting to use when rendering text.
61  // Currently only used by Linux.
62  RendererPreferencesHintingEnum hinting;
63
64  // Whether auto hinter should be used. Currently only used by Linux.
65  bool use_autohinter;
66
67  // Whether embedded bitmap strikes in fonts should be used.
68  // Current only used by Linux.
69  bool use_bitmaps;
70
71  // The type of subpixel rendering to use for text.
72  // Currently only used by Linux.
73  RendererPreferencesSubpixelRenderingEnum subpixel_rendering;
74
75  // Whether subpixel positioning should be used, permitting fractional X
76  // positions for glyphs.  Currently only used by Linux.
77  bool use_subpixel_positioning;
78
79  // The color of the focus ring. Currently only used on Linux.
80  SkColor focus_ring_color;
81
82  // The color of different parts of the scrollbar. Currently only used on
83  // Linux.
84  SkColor thumb_active_color;
85  SkColor thumb_inactive_color;
86  SkColor track_color;
87
88  // The colors used in selection text. Currently only used on Linux and Ash.
89  SkColor active_selection_bg_color;
90  SkColor active_selection_fg_color;
91  SkColor inactive_selection_bg_color;
92  SkColor inactive_selection_fg_color;
93
94  // Browser wants a look at all non-local top level navigation requests.
95  bool browser_handles_non_local_top_level_requests;
96
97  // Browser wants a look at all top-level navigation requests.
98  bool browser_handles_all_top_level_requests;
99
100  // Cursor blink rate in seconds.
101  // Currently only changed from default on Linux.  Uses |gtk-cursor-blink|
102  // from GtkSettings.
103  double caret_blink_interval;
104
105  // Whether or not to set custom colors at all.
106  bool use_custom_colors;
107
108  // Set to false to not send referrers.
109  bool enable_referrers;
110
111  // Set to true to indicate that the preference to set DNT to 1 is enabled.
112  bool enable_do_not_track;
113
114  // Default page zoom level.
115  double default_zoom_level;
116
117  // The user agent given to WebKit when it requests one and the user agent is
118  // being overridden for the current navigation.
119  std::string user_agent_override;
120
121  // The accept-languages of the browser, comma-separated.
122  std::string accept_languages;
123
124  // Specifies whether the renderer reports frame name changes to the browser
125  // process.
126  // TODO(fsamuel): This is a short-term workaround to avoid regressing
127  // Sunspider. We need to find an efficient way to report changes to frame
128  // names to the browser process. See http://crbug.com/169110 for more
129  // information.
130  bool report_frame_name_changes;
131
132  // Controls deacceleration of touchpad-initiated flings.
133  std::vector<float> touchpad_fling_profile;
134
135  // Controls deacceleration of touchscreen-initiated flings.
136  std::vector<float> touchscreen_fling_profile;
137
138  // How to handle a tap gesture touching multiple targets
139  TapMultipleTargetsStrategy tap_multiple_targets_strategy;
140
141  // Disables rendering default error page when client choses to block a page.
142  // Corresponds to net::ERR_BLOCKED_BY_CLIENT.
143  bool disable_client_blocked_error_page;
144};
145
146}  // namespace content
147
148#endif  // CONTENT_PUBLIC_COMMON_RENDERER_PREFERENCES_H_
149