| 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" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 #endif // !defined(OS_ANDROID) | 458 #endif // !defined(OS_ANDROID) |
| 459 } | 459 } |
| 460 | 460 |
| 461 renderer_preferences_util::UpdateFromSystemSettings( | 461 renderer_preferences_util::UpdateFromSystemSettings( |
| 462 web_contents_->GetMutableRendererPrefs(), GetProfile()); | 462 web_contents_->GetMutableRendererPrefs(), GetProfile()); |
| 463 | 463 |
| 464 #if !defined(OS_ANDROID) | 464 #if !defined(OS_ANDROID) |
| 465 UserStyleSheetWatcher* uss = | 465 UserStyleSheetWatcher* uss = |
| 466 UserStyleSheetWatcherFactory::GetForProfile(GetProfile()); | 466 UserStyleSheetWatcherFactory::GetForProfile(GetProfile()); |
| 467 if (uss) { | 467 if (uss) { |
| 468 uss->RegisterOnStyleSheetUpdatedCallback( | 468 remove_callback_ = uss->RegisterOnStyleSheetUpdatedCallback( |
| 469 base::Bind(&PrefsTabHelper::UpdateWebPreferences, | 469 base::Bind(&PrefsTabHelper::UpdateWebPreferences, |
| 470 weak_ptr_factory_.GetWeakPtr())); | 470 weak_ptr_factory_.GetWeakPtr())); |
| 471 } | 471 } |
| 472 #endif | 472 #endif |
| 473 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES) | 473 #if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES) |
| 474 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 474 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 475 content::Source<ThemeService>( | 475 content::Source<ThemeService>( |
| 476 ThemeServiceFactory::GetForProfile(GetProfile()))); | 476 ThemeServiceFactory::GetForProfile(GetProfile()))); |
| 477 #endif | 477 #endif |
| 478 #if defined(USE_AURA) | 478 #if defined(USE_AURA) |
| 479 registrar_.Add(this, | 479 registrar_.Add(this, |
| 480 chrome::NOTIFICATION_BROWSER_FLING_CURVE_PARAMETERS_CHANGED, | 480 chrome::NOTIFICATION_BROWSER_FLING_CURVE_PARAMETERS_CHANGED, |
| 481 content::NotificationService::AllSources()); | 481 content::NotificationService::AllSources()); |
| 482 #endif | 482 #endif |
| 483 } | 483 } |
| 484 | 484 |
| 485 PrefsTabHelper::~PrefsTabHelper() { | 485 PrefsTabHelper::~PrefsTabHelper() { |
| 486 remove_callback_.Run(); |
| 486 } | 487 } |
| 487 | 488 |
| 488 // static | 489 // static |
| 489 void PrefsTabHelper::InitIncognitoUserPrefStore( | 490 void PrefsTabHelper::InitIncognitoUserPrefStore( |
| 490 OverlayUserPrefStore* pref_store) { | 491 OverlayUserPrefStore* pref_store) { |
| 491 // List of keys that cannot be changed in the user prefs file by the incognito | 492 // List of keys that cannot be changed in the user prefs file by the incognito |
| 492 // profile. All preferences that store information about the browsing history | 493 // profile. All preferences that store information about the browsing history |
| 493 // or behavior of the user should have this property. | 494 // or behavior of the user should have this property. |
| 494 pref_store->RegisterOverlayPref(prefs::kBrowserWindowPlacement); | 495 pref_store->RegisterOverlayPref(prefs::kBrowserWindowPlacement); |
| 495 pref_store->RegisterOverlayPref(prefs::kSaveFileDefaultDirectory); | 496 pref_store->RegisterOverlayPref(prefs::kSaveFileDefaultDirectory); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 WebPreferences web_prefs = | 714 WebPreferences web_prefs = |
| 714 web_contents_->GetRenderViewHost()->GetWebkitPreferences(); | 715 web_contents_->GetRenderViewHost()->GetWebkitPreferences(); |
| 715 OverrideFontFamily(&web_prefs, generic_family, script, std::string()); | 716 OverrideFontFamily(&web_prefs, generic_family, script, std::string()); |
| 716 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); | 717 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); |
| 717 return; | 718 return; |
| 718 } | 719 } |
| 719 } | 720 } |
| 720 | 721 |
| 721 UpdateWebPreferences(); | 722 UpdateWebPreferences(); |
| 722 } | 723 } |
| OLD | NEW |