Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/browser/renderer_preferences_util.cc

Issue 10544103: Chromium change of sharing some WebKit API between Android/Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For landing Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_preferences_util.h" 5 #include "chrome/browser/renderer_preferences_util.h"
6 6
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "content/public/common/renderer_preferences.h" 10 #include "content/public/common/renderer_preferences.h"
11 11
12 #if defined(OS_LINUX) 12 #if defined(OS_LINUX) || defined(OS_ANDROID)
13 #include "ui/gfx/font_render_params_linux.h" 13 #include "ui/gfx/font_render_params_linux.h"
14 #endif 14 #endif
15 15
16 #if defined(TOOLKIT_GTK) 16 #if defined(TOOLKIT_GTK)
17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 17 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
18 #include "ui/gfx/gtk_util.h" 18 #include "ui/gfx/gtk_util.h"
19 #endif 19 #endif
20 20
21 namespace renderer_preferences_util { 21 namespace renderer_preferences_util {
22 22
23 namespace { 23 namespace {
24 24
25 #if defined(TOOLKIT_GTK) 25 #if defined(TOOLKIT_GTK)
26 // Dividing GTK's cursor blink cycle time (in milliseconds) by this value yields 26 // Dividing GTK's cursor blink cycle time (in milliseconds) by this value yields
27 // an appropriate value for content::RendererPreferences::caret_blink_interval. 27 // an appropriate value for content::RendererPreferences::caret_blink_interval.
28 // This matches the logic in the WebKit GTK port. 28 // This matches the logic in the WebKit GTK port.
29 const double kGtkCursorBlinkCycleFactor = 2000.0; 29 const double kGtkCursorBlinkCycleFactor = 2000.0;
30 #endif // defined(TOOLKIT_GTK) 30 #endif // defined(TOOLKIT_GTK)
31 31
32 #if defined(OS_LINUX) 32 #if defined(OS_LINUX) || defined(OS_ANDROID)
33 content::RendererPreferencesHintingEnum GetRendererPreferencesHintingEnum( 33 content::RendererPreferencesHintingEnum GetRendererPreferencesHintingEnum(
34 gfx::FontRenderParams::Hinting hinting) { 34 gfx::FontRenderParams::Hinting hinting) {
35 switch (hinting) { 35 switch (hinting) {
36 case gfx::FontRenderParams::HINTING_NONE: 36 case gfx::FontRenderParams::HINTING_NONE:
37 return content::RENDERER_PREFERENCES_HINTING_NONE; 37 return content::RENDERER_PREFERENCES_HINTING_NONE;
38 case gfx::FontRenderParams::HINTING_SLIGHT: 38 case gfx::FontRenderParams::HINTING_SLIGHT:
39 return content::RENDERER_PREFERENCES_HINTING_SLIGHT; 39 return content::RENDERER_PREFERENCES_HINTING_SLIGHT;
40 case gfx::FontRenderParams::HINTING_MEDIUM: 40 case gfx::FontRenderParams::HINTING_MEDIUM:
41 return content::RENDERER_PREFERENCES_HINTING_MEDIUM; 41 return content::RENDERER_PREFERENCES_HINTING_MEDIUM;
42 case gfx::FontRenderParams::HINTING_FULL: 42 case gfx::FontRenderParams::HINTING_FULL:
(...skipping 17 matching lines...) Expand all
60 case gfx::FontRenderParams::SUBPIXEL_RENDERING_VRGB: 60 case gfx::FontRenderParams::SUBPIXEL_RENDERING_VRGB:
61 return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB; 61 return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB;
62 case gfx::FontRenderParams::SUBPIXEL_RENDERING_VBGR: 62 case gfx::FontRenderParams::SUBPIXEL_RENDERING_VBGR:
63 return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR; 63 return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR;
64 default: 64 default:
65 NOTREACHED() << "Unhandled subpixel rendering style " 65 NOTREACHED() << "Unhandled subpixel rendering style "
66 << subpixel_rendering; 66 << subpixel_rendering;
67 return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT; 67 return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT;
68 } 68 }
69 } 69 }
70 #endif // defined(OS_LINUX) 70 #endif // defined(OS_LINUX) || defined(OS_ANDROID)
71 71
72 } // namespace 72 } // namespace
73 73
74 void UpdateFromSystemSettings( 74 void UpdateFromSystemSettings(
75 content::RendererPreferences* prefs, Profile* profile) { 75 content::RendererPreferences* prefs, Profile* profile) {
76 const PrefService* pref_service = profile->GetPrefs(); 76 const PrefService* pref_service = profile->GetPrefs();
77 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers); 77 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers);
78 prefs->default_zoom_level = pref_service->GetDouble(prefs::kDefaultZoomLevel); 78 prefs->default_zoom_level = pref_service->GetDouble(prefs::kDefaultZoomLevel);
79 79
80 #if defined(TOOLKIT_GTK) 80 #if defined(TOOLKIT_GTK)
(...skipping 17 matching lines...) Expand all
98 cursor_blink_time.InMilliseconds() / kGtkCursorBlinkCycleFactor : 98 cursor_blink_time.InMilliseconds() / kGtkCursorBlinkCycleFactor :
99 0; 99 0;
100 #elif defined(USE_ASH) 100 #elif defined(USE_ASH)
101 // This color is 0x544d90fe modulated with 0xffffff. 101 // This color is 0x544d90fe modulated with 0xffffff.
102 prefs->active_selection_bg_color = SkColorSetRGB(0xCB, 0xE4, 0xFA); 102 prefs->active_selection_bg_color = SkColorSetRGB(0xCB, 0xE4, 0xFA);
103 prefs->active_selection_fg_color = SK_ColorBLACK; 103 prefs->active_selection_fg_color = SK_ColorBLACK;
104 prefs->inactive_selection_bg_color = SkColorSetRGB(0xEA, 0xEA, 0xEA); 104 prefs->inactive_selection_bg_color = SkColorSetRGB(0xEA, 0xEA, 0xEA);
105 prefs->inactive_selection_fg_color = SK_ColorBLACK; 105 prefs->inactive_selection_fg_color = SK_ColorBLACK;
106 #endif 106 #endif
107 107
108 #if defined(OS_LINUX) 108 #if defined(OS_LINUX) || defined(OS_ANDROID)
109 const gfx::FontRenderParams& params = gfx::GetDefaultFontRenderParams(); 109 const gfx::FontRenderParams& params = gfx::GetDefaultFontRenderParams();
110 prefs->should_antialias_text = params.antialiasing; 110 prefs->should_antialias_text = params.antialiasing;
111 prefs->use_subpixel_positioning = params.subpixel_positioning; 111 prefs->use_subpixel_positioning = params.subpixel_positioning;
112 prefs->hinting = GetRendererPreferencesHintingEnum(params.hinting); 112 prefs->hinting = GetRendererPreferencesHintingEnum(params.hinting);
113 prefs->use_autohinter = params.autohinter;
114 prefs->use_bitmaps = params.use_bitmaps;
113 prefs->subpixel_rendering = 115 prefs->subpixel_rendering =
114 GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering); 116 GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering);
115 #endif 117 #endif
116 } 118 }
117 119
118 } // renderer_preferences_util 120 } // renderer_preferences_util
OLDNEW
« no previous file with comments | « no previous file | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698