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 <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 map = &prefs->cursive_font_family_map; | 318 map = &prefs->cursive_font_family_map; |
319 else if (generic_family == "fantasy") | 319 else if (generic_family == "fantasy") |
320 map = &prefs->fantasy_font_family_map; | 320 map = &prefs->fantasy_font_family_map; |
321 else if (generic_family == "pictograph") | 321 else if (generic_family == "pictograph") |
322 map = &prefs->pictograph_font_family_map; | 322 map = &prefs->pictograph_font_family_map; |
323 else | 323 else |
324 NOTREACHED() << "Unknown generic font family: " << generic_family; | 324 NOTREACHED() << "Unknown generic font family: " << generic_family; |
325 (*map)[script] = base::UTF8ToUTF16(pref_value); | 325 (*map)[script] = base::UTF8ToUTF16(pref_value); |
326 } | 326 } |
327 | 327 |
328 void RegisterLocalizedFontPref( | 328 void RegisterLocalizedFontPref(user_prefs::PrefRegistrySyncable* registry, |
329 user_prefs::PrefRegistrySyncable* registry, | 329 const char* path, |
330 const char* path, | 330 int default_message_id, |
331 int default_message_id, | 331 uint32 flags) { |
332 user_prefs::PrefRegistrySyncable::PrefSyncStatus status) { | |
333 int val = 0; | 332 int val = 0; |
334 bool success = base::StringToInt(l10n_util::GetStringUTF8( | 333 bool success = base::StringToInt(l10n_util::GetStringUTF8( |
335 default_message_id), &val); | 334 default_message_id), &val); |
336 DCHECK(success); | 335 DCHECK(success); |
337 registry->RegisterIntegerPref(path, val, status); | 336 registry->RegisterIntegerPref(path, val, flags); |
338 } | 337 } |
339 | 338 |
340 } // namespace | 339 } // namespace |
341 | 340 |
342 // Watching all these settings per tab is slow when a user has a lot of tabs and | 341 // Watching all these settings per tab is slow when a user has a lot of tabs and |
343 // and they use session restore. So watch them once per profile. | 342 // and they use session restore. So watch them once per profile. |
344 // http://crbug.com/452693 | 343 // http://crbug.com/452693 |
345 class PrefWatcher : public KeyedService { | 344 class PrefWatcher : public KeyedService { |
346 public: | 345 public: |
347 explicit PrefWatcher(Profile* profile) : profile_(profile) { | 346 explicit PrefWatcher(Profile* profile) : profile_(profile) { |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } | 741 } |
743 } | 742 } |
744 | 743 |
745 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { | 744 void PrefsTabHelper::OnWebPrefChanged(const std::string& pref_name) { |
746 #if !defined(OS_ANDROID) | 745 #if !defined(OS_ANDROID) |
747 OnFontFamilyPrefChanged(pref_name); | 746 OnFontFamilyPrefChanged(pref_name); |
748 #endif | 747 #endif |
749 | 748 |
750 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); | 749 web_contents_->GetRenderViewHost()->OnWebkitPreferencesChanged(); |
751 } | 750 } |
OLD | NEW |