renderer_preferences.h revision 2385ea399aae016c0806a4f9ef3c9cfe3d2a39df
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
44  TAP_MULTIPLE_TARGETS_STRATEGY_MAX = TAP_MULTIPLE_TARGETS_STRATEGY_POPUP,
45};
46
47struct CONTENT_EXPORT RendererPreferences {
48  RendererPreferences();
49  ~RendererPreferences();
50
51  // Whether the renderer's current browser context accept drops from the OS
52  // that result in navigations away from the current page.
53  bool can_accept_load_drops;
54
55  // Whether text should be antialiased.
56  // Currently only used by Linux.
57  bool should_antialias_text;
58
59  // The level of hinting to use when rendering text.
60  // Currently only used by Linux.
61  RendererPreferencesHintingEnum hinting;
62
63  // Whether auto hinter should be used. Currently only used by Linux.
64  bool use_autohinter;
65
66  // Whether embedded bitmap strikes in fonts should be used.
67  // Current only used by Linux.
68  bool use_bitmaps;
69
70  // The type of subpixel rendering to use for text.
71  // Currently only used by Linux.
72  RendererPreferencesSubpixelRenderingEnum subpixel_rendering;
73
74  // Whether subpixel positioning should be used, permitting fractional X
75  // positions for glyphs.  Currently only used by Linux.
76  bool use_subpixel_positioning;
77
78  // The color of the focus ring. Currently only used on Linux.
79  SkColor focus_ring_color;
80
81  // The color of different parts of the scrollbar. Currently only used on
82  // Linux.
83  SkColor thumb_active_color;
84  SkColor thumb_inactive_color;
85  SkColor track_color;
86
87  // The colors used in selection text. Currently only used on Linux and Ash.
88  SkColor active_selection_bg_color;
89  SkColor active_selection_fg_color;
90  SkColor inactive_selection_bg_color;
91  SkColor inactive_selection_fg_color;
92
93  // Browser wants a look at all non-local top level navigation requests.
94  bool browser_handles_non_local_top_level_requests;
95
96  // Browser wants a look at all top-level navigation requests.
97  bool browser_handles_all_top_level_requests;
98
99  // Cursor blink rate in seconds.
100  // Currently only changed from default on Linux.  Uses |gtk-cursor-blink|
101  // from GtkSettings.
102  double caret_blink_interval;
103
104  // Whether or not to set custom colors at all.
105  bool use_custom_colors;
106
107  // Set to false to not send referrers.
108  bool enable_referrers;
109
110  // Set to true to indicate that the preference to set DNT to 1 is enabled.
111  bool enable_do_not_track;
112
113  // Default page zoom level.
114  double default_zoom_level;
115
116  // The user agent given to WebKit when it requests one and the user agent is
117  // being overridden for the current navigation.
118  std::string user_agent_override;
119
120  // The accept-languages of the browser, comma-separated.
121  std::string accept_languages;
122
123  // Specifies whether the renderer reports frame name changes to the browser
124  // process.
125  // TODO(fsamuel): This is a short-term workaround to avoid regressing
126  // Sunspider. We need to find an efficient way to report changes to frame
127  // names to the browser process. See http://crbug.com/169110 for more
128  // information.
129  bool report_frame_name_changes;
130
131  // Controls deacceleration of touchpad-initiated flings.
132  std::vector<float> touchpad_fling_profile;
133
134  // Controls deacceleration of touchscreen-initiated flings.
135  std::vector<float> touchscreen_fling_profile;
136
137  // How to handle a tap gesture touching multiple targets
138  TapMultipleTargetsStrategy tap_multiple_targets_strategy;
139};
140
141}  // namespace content
142
143#endif  // CONTENT_PUBLIC_COMMON_RENDERER_PREFERENCES_H_
144