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