Home | History | Annotate | Download | only in common
      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 
     21 namespace content {
     22 
     23 enum 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 
     31 enum 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 
     40 enum 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 
     48 struct 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   // Browser wants a look at all top-level link clicks.
    101   bool browser_handles_all_top_level_link_clicks;
    102 
    103   // Cursor blink rate in seconds.
    104   // Currently only changed from default on Linux.  Uses |gtk-cursor-blink|
    105   // from GtkSettings.
    106   double caret_blink_interval;
    107 
    108   // Whether or not to set custom colors at all.
    109   bool use_custom_colors;
    110 
    111   // Set to false to not send referrers.
    112   bool enable_referrers;
    113 
    114   // Set to true to indicate that the preference to set DNT to 1 is enabled.
    115   bool enable_do_not_track;
    116 
    117   // Default page zoom level.
    118   double default_zoom_level;
    119 
    120   // The user agent given to WebKit when it requests one and the user agent is
    121   // being overridden for the current navigation.
    122   std::string user_agent_override;
    123 
    124   // The accept-languages of the browser, comma-separated.
    125   std::string accept_languages;
    126 
    127   // Specifies whether the renderer reports frame name changes to the browser
    128   // process.
    129   // TODO(fsamuel): This is a short-term workaround to avoid regressing
    130   // Sunspider. We need to find an efficient way to report changes to frame
    131   // names to the browser process. See http://crbug.com/169110 for more
    132   // information.
    133   bool report_frame_name_changes;
    134 
    135   // Controls deacceleration of touchpad-initiated flings.
    136   std::vector<float> touchpad_fling_profile;
    137 
    138   // Controls deacceleration of touchscreen-initiated flings.
    139   std::vector<float> touchscreen_fling_profile;
    140 
    141   // How to handle a tap gesture touching multiple targets
    142   TapMultipleTargetsStrategy tap_multiple_targets_strategy;
    143 
    144   // Disables rendering default error page when client choses to block a page.
    145   // Corresponds to net::ERR_BLOCKED_BY_CLIENT.
    146   bool disable_client_blocked_error_page;
    147 
    148   // Determines whether plugins are allowed to enter fullscreen mode.
    149   bool plugin_fullscreen_allowed;
    150 };
    151 
    152 }  // namespace content
    153 
    154 #endif  // CONTENT_PUBLIC_COMMON_RENDERER_PREFERENCES_H_
    155