OLD | NEW |
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/browser/user_style_sheet_watcher.h" | |
19 #include "chrome/browser/user_style_sheet_watcher_factory.h" | |
20 #include "chrome/common/pref_font_webkit_names.h" | 18 #include "chrome/common/pref_font_webkit_names.h" |
21 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
22 #include "chrome/common/pref_names_util.h" | 20 #include "chrome/common/pref_names_util.h" |
23 #include "components/user_prefs/pref_registry_syncable.h" | 21 #include "components/user_prefs/pref_registry_syncable.h" |
24 #include "content/public/browser/notification_details.h" | 22 #include "content/public/browser/notification_details.h" |
25 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
27 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
28 #include "grit/locale_settings.h" | 26 #include "grit/locale_settings.h" |
29 #include "grit/platform_locale_settings.h" | 27 #include "grit/platform_locale_settings.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 webkit_callback); | 333 webkit_callback); |
336 RegisterFontFamilyMapObserver(&pref_change_registrar_, | 334 RegisterFontFamilyMapObserver(&pref_change_registrar_, |
337 prefs::kWebKitPictographFontFamilyMap, | 335 prefs::kWebKitPictographFontFamilyMap, |
338 webkit_callback); | 336 webkit_callback); |
339 #endif // !defined(OS_ANDROID) | 337 #endif // !defined(OS_ANDROID) |
340 } | 338 } |
341 | 339 |
342 renderer_preferences_util::UpdateFromSystemSettings( | 340 renderer_preferences_util::UpdateFromSystemSettings( |
343 web_contents_->GetMutableRendererPrefs(), GetProfile()); | 341 web_contents_->GetMutableRendererPrefs(), GetProfile()); |
344 | 342 |
345 #if !defined(OS_ANDROID) | |
346 UserStyleSheetWatcher* uss = | |
347 UserStyleSheetWatcherFactory::GetForProfile(GetProfile()); | |
348 if (uss) { | |
349 style_sheet_subscription_ = uss->RegisterOnStyleSheetUpdatedCallback( | |
350 base::Bind(&PrefsTabHelper::UpdateWebPreferences, | |
351 weak_ptr_factory_.GetWeakPtr())); | |
352 } | |
353 #endif | |
354 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES) | 343 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES) |
355 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 344 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
356 content::Source<ThemeService>( | 345 content::Source<ThemeService>( |
357 ThemeServiceFactory::GetForProfile(GetProfile()))); | 346 ThemeServiceFactory::GetForProfile(GetProfile()))); |
358 #endif | 347 #endif |
359 #if defined(USE_AURA) | 348 #if defined(USE_AURA) |
360 registrar_.Add(this, | 349 registrar_.Add(this, |
361 chrome::NOTIFICATION_BROWSER_FLING_CURVE_PARAMETERS_CHANGED, | 350 chrome::NOTIFICATION_BROWSER_FLING_CURVE_PARAMETERS_CHANGED, |
362 content::NotificationService::AllSources()); | 351 content::NotificationService::AllSources()); |
363 #endif | 352 #endif |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 WebPreferences web_prefs = | 572 WebPreferences web_prefs = |
584 web_contents_->GetRenderViewHost()->GetWebkitPreferences(); | 573 web_contents_->GetRenderViewHost()->GetWebkitPreferences(); |
585 OverrideFontFamily(&web_prefs, generic_family, script, std::string()); | 574 OverrideFontFamily(&web_prefs, generic_family, script, std::string()); |
586 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); | 575 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); |
587 return; | 576 return; |
588 } | 577 } |
589 } | 578 } |
590 | 579 |
591 UpdateWebPreferences(); | 580 UpdateWebPreferences(); |
592 } | 581 } |
OLD | NEW |