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

Side by Side Diff: chrome/browser/ui/prefs/prefs_tab_helper.cc

Issue 147373005: Move webkit/common/webpreferences to content/public/common/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
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/ui/prefs/prefs_tab_helper.h" 5 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/prefs/overlay_user_pref_store.h" 9 #include "base/prefs/overlay_user_pref_store.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chrome_notification_types.h" 15 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/renderer_preferences_util.h" 17 #include "chrome/browser/renderer_preferences_util.h"
18 #include "chrome/common/pref_font_webkit_names.h" 18 #include "chrome/common/pref_font_webkit_names.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/common/pref_names_util.h" 20 #include "chrome/common/pref_names_util.h"
21 #include "components/user_prefs/pref_registry_syncable.h" 21 #include "components/user_prefs/pref_registry_syncable.h"
22 #include "content/public/browser/notification_details.h" 22 #include "content/public/browser/notification_details.h"
23 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 #include "content/public/browser/render_view_host.h" 24 #include "content/public/browser/render_view_host.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/common/webpreferences.h"
26 #include "grit/locale_settings.h" 27 #include "grit/locale_settings.h"
27 #include "grit/platform_locale_settings.h" 28 #include "grit/platform_locale_settings.h"
28 #include "third_party/icu/source/common/unicode/uchar.h" 29 #include "third_party/icu/source/common/unicode/uchar.h"
29 #include "third_party/icu/source/common/unicode/uscript.h" 30 #include "third_party/icu/source/common/unicode/uscript.h"
30 #include "webkit/common/webpreferences.h"
31 31
32 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES) 32 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES)
33 #include "chrome/browser/themes/theme_service.h" 33 #include "chrome/browser/themes/theme_service.h"
34 #include "chrome/browser/themes/theme_service_factory.h" 34 #include "chrome/browser/themes/theme_service_factory.h"
35 #endif 35 #endif
36 36
37 using content::WebContents; 37 using content::WebContents;
38 38
39 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PrefsTabHelper); 39 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PrefsTabHelper);
40 40
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if (U_FAILURE(err) && err != U_BUFFER_OVERFLOW_ERROR) 257 if (U_FAILURE(err) && err != U_BUFFER_OVERFLOW_ERROR)
258 code = USCRIPT_INVALID_CODE; 258 code = USCRIPT_INVALID_CODE;
259 return GetScriptForFontPrefMatching(code); 259 return GetScriptForFontPrefMatching(code);
260 } 260 }
261 261
262 // Sets a font family pref in |prefs| to |pref_value|. 262 // Sets a font family pref in |prefs| to |pref_value|.
263 void OverrideFontFamily(WebPreferences* prefs, 263 void OverrideFontFamily(WebPreferences* prefs,
264 const std::string& generic_family, 264 const std::string& generic_family,
265 const std::string& script, 265 const std::string& script,
266 const std::string& pref_value) { 266 const std::string& pref_value) {
267 webkit_glue::ScriptFontFamilyMap* map = NULL; 267 content::ScriptFontFamilyMap* map = NULL;
268 if (generic_family == "standard") 268 if (generic_family == "standard")
269 map = &prefs->standard_font_family_map; 269 map = &prefs->standard_font_family_map;
270 else if (generic_family == "fixed") 270 else if (generic_family == "fixed")
271 map = &prefs->fixed_font_family_map; 271 map = &prefs->fixed_font_family_map;
272 else if (generic_family == "serif") 272 else if (generic_family == "serif")
273 map = &prefs->serif_font_family_map; 273 map = &prefs->serif_font_family_map;
274 else if (generic_family == "sansserif") 274 else if (generic_family == "sansserif")
275 map = &prefs->sans_serif_font_family_map; 275 map = &prefs->sans_serif_font_family_map;
276 else if (generic_family == "cursive") 276 else if (generic_family == "cursive")
277 map = &prefs->cursive_font_family_map; 277 map = &prefs->cursive_font_family_map;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 WebPreferences web_prefs = 572 WebPreferences web_prefs =
573 web_contents_->GetRenderViewHost()->GetWebkitPreferences(); 573 web_contents_->GetRenderViewHost()->GetWebkitPreferences();
574 OverrideFontFamily(&web_prefs, generic_family, script, std::string()); 574 OverrideFontFamily(&web_prefs, generic_family, script, std::string());
575 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); 575 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs);
576 return; 576 return;
577 } 577 }
578 } 578 }
579 579
580 UpdateWebPreferences(); 580 UpdateWebPreferences();
581 } 581 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698