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

Side by Side Diff: chrome/browser/ui/tab_contents/tab_contents_wrapper.cc

Issue 7606028: Pass per-script fonts to WebKit settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tab_contents/tab_contents_wrapper.h" 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "chrome/browser/autocomplete_history_manager.h" 9 #include "chrome/browser/autocomplete_history_manager.h"
10 #include "chrome/browser/autofill/autofill_manager.h" 10 #include "chrome/browser/autofill/autofill_manager.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/file_select_helper.h" 21 #include "chrome/browser/file_select_helper.h"
22 #include "chrome/browser/google/google_util.h" 22 #include "chrome/browser/google/google_util.h"
23 #include "chrome/browser/history/history_tab_helper.h" 23 #include "chrome/browser/history/history_tab_helper.h"
24 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" 24 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
25 #include "chrome/browser/omnibox_search_hint.h" 25 #include "chrome/browser/omnibox_search_hint.h"
26 #include "chrome/browser/password_manager/password_manager.h" 26 #include "chrome/browser/password_manager/password_manager.h"
27 #include "chrome/browser/password_manager_delegate_impl.h" 27 #include "chrome/browser/password_manager_delegate_impl.h"
28 #include "chrome/browser/pdf_unsupported_feature.h" 28 #include "chrome/browser/pdf_unsupported_feature.h"
29 #include "chrome/browser/plugin_observer.h" 29 #include "chrome/browser/plugin_observer.h"
30 #include "chrome/browser/prefs/pref_service.h" 30 #include "chrome/browser/prefs/pref_service.h"
31 #include "chrome/browser/prefs/scoped_user_pref_update.h"
31 #include "chrome/browser/prerender/prerender_observer.h" 32 #include "chrome/browser/prerender/prerender_observer.h"
32 #include "chrome/browser/printing/print_preview_message_handler.h" 33 #include "chrome/browser/printing/print_preview_message_handler.h"
33 #include "chrome/browser/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
34 #include "chrome/browser/remoting/firewall_traversal_tab_helper.h" 35 #include "chrome/browser/remoting/firewall_traversal_tab_helper.h"
35 #include "chrome/browser/renderer_host/web_cache_manager.h" 36 #include "chrome/browser/renderer_host/web_cache_manager.h"
36 #include "chrome/browser/renderer_preferences_util.h" 37 #include "chrome/browser/renderer_preferences_util.h"
37 #include "chrome/browser/sessions/restore_tab_helper.h" 38 #include "chrome/browser/sessions/restore_tab_helper.h"
38 #include "chrome/browser/safe_browsing/client_side_detection_host.h" 39 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
39 #include "chrome/browser/sync/glue/synced_tab_delegate.h" 40 #include "chrome/browser/sync/glue/synced_tab_delegate.h"
40 #include "chrome/browser/tab_contents/infobar.h" 41 #include "chrome/browser/tab_contents/infobar.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 PrefService::UNSYNCABLE_PREF); 272 PrefService::UNSYNCABLE_PREF);
272 prefs->RegisterLocalizedStringPref(prefs::kWebKitSansSerifFontFamily, 273 prefs->RegisterLocalizedStringPref(prefs::kWebKitSansSerifFontFamily,
273 IDS_SANS_SERIF_FONT_FAMILY, 274 IDS_SANS_SERIF_FONT_FAMILY,
274 PrefService::UNSYNCABLE_PREF); 275 PrefService::UNSYNCABLE_PREF);
275 prefs->RegisterLocalizedStringPref(prefs::kWebKitCursiveFontFamily, 276 prefs->RegisterLocalizedStringPref(prefs::kWebKitCursiveFontFamily,
276 IDS_CURSIVE_FONT_FAMILY, 277 IDS_CURSIVE_FONT_FAMILY,
277 PrefService::UNSYNCABLE_PREF); 278 PrefService::UNSYNCABLE_PREF);
278 prefs->RegisterLocalizedStringPref(prefs::kWebKitFantasyFontFamily, 279 prefs->RegisterLocalizedStringPref(prefs::kWebKitFantasyFontFamily,
279 IDS_FANTASY_FONT_FAMILY, 280 IDS_FANTASY_FONT_FAMILY,
280 PrefService::UNSYNCABLE_PREF); 281 PrefService::UNSYNCABLE_PREF);
282 prefs->RegisterDictionaryPref(prefs::kWebKitStandardFontFamilyMap,
283 PrefService::UNSYNCABLE_PREF);
284 prefs->RegisterDictionaryPref(prefs::kWebKitFixedFontFamilyMap,
285 PrefService::UNSYNCABLE_PREF);
286 prefs->RegisterDictionaryPref(prefs::kWebKitSerifFontFamilyMap,
287 PrefService::UNSYNCABLE_PREF);
288 prefs->RegisterDictionaryPref(prefs::kWebKitSansSerifFontFamilyMap,
289 PrefService::UNSYNCABLE_PREF);
290 prefs->RegisterDictionaryPref(prefs::kWebKitCursiveFontFamilyMap,
291 PrefService::UNSYNCABLE_PREF);
292 prefs->RegisterDictionaryPref(prefs::kWebKitFantasyFontFamilyMap,
293 PrefService::UNSYNCABLE_PREF);
294
295 DictionaryPrefUpdate update_standard(prefs,
296 prefs::kWebKitStandardFontFamilyMap);
297 DictionaryPrefUpdate update_fixed(prefs,
298 prefs::kWebKitFixedFontFamilyMap);
299 DictionaryPrefUpdate update_serif(prefs,
300 prefs::kWebKitSerifFontFamilyMap);
301 DictionaryPrefUpdate update_sans_serif(prefs,
302 prefs::kWebKitSansSerifFontFamilyMap);
303
304 #if defined(OS_CHROMEOS)
305 update_standard->SetString(uscript_getShortName(USCRIPT_KATAKANA_OR_HIRAGANA),
306 l10n_util::GetStringUTF16(IDS_STANDARD_FONT_FAMILY_JAPANESE));
falken 2011/08/10 13:06:53 This seems flawed because it overrides the user's
tony 2011/08/10 19:23:40 Can we just make pref values for each string in th
falken 2011/08/11 08:54:20 This would be good, but if I register "webkit.webp
Mattias Nissler (ping if slow) 2011/08/12 09:24:13 That's by design. The PrefService is a key-value s
falken 2011/08/12 09:37:00 I see. What happens if the user preferences have
Mattias Nissler (ping if slow) 2011/08/12 09:51:05 Values from lower-priority sources are hidden by h
falken 2011/08/15 05:28:46 Thanks, I see. I thought merging would be useful
307 update_fixed->SetString(uscript_getShortName(USCRIPT_KATAKANA_OR_HIRAGANA),
308 l10n_util::GetStringUTF16(IDS_FIXED_FONT_FAMILY_JAPANESE));
309 update_serif->SetString(uscript_getShortName(USCRIPT_KATAKANA_OR_HIRAGANA),
310 l10n_util::GetStringUTF16(IDS_SERIF_FONT_FAMILY_JAPANESE));
311 update_sans_serif->SetString(
312 uscript_getShortName(USCRIPT_KATAKANA_OR_HIRAGANA),
313 l10n_util::GetStringUTF16(IDS_SERIF_FONT_FAMILY_JAPANESE));
314 update_standard->SetString(uscript_getShortName(USCRIPT_HANGUL),
315 l10n_util::GetStringUTF16(IDS_STANDARD_FONT_FAMILY_KOREAN));
316 update_fixed->SetString(uscript_getShortName(USCRIPT_HANGUL),
317 l10n_util::GetStringUTF16(IDS_FIXED_FONT_FAMILY_KOREAN));
318 update_serif->SetString(uscript_getShortName(USCRIPT_HANGUL),
319 l10n_util::GetStringUTF16(IDS_SERIF_FONT_FAMILY_KOREAN));
320 update_sans_serif->SetString(uscript_getShortName(USCRIPT_HANGUL),
321 l10n_util::GetStringUTF16(IDS_SERIF_FONT_FAMILY_KOREAN));
322 update_standard->SetString(uscript_getShortName(USCRIPT_SIMPLIFIED_HAN),
323 l10n_util::GetStringUTF16(IDS_STANDARD_FONT_FAMILY_SIMPLIFIED_HAN));
324 update_fixed->SetString(uscript_getShortName(USCRIPT_SIMPLIFIED_HAN),
325 l10n_util::GetStringUTF16(IDS_FIXED_FONT_FAMILY_SIMPLIFIED_HAN));
326 update_serif->SetString(uscript_getShortName(USCRIPT_SIMPLIFIED_HAN),
327 l10n_util::GetStringUTF16(IDS_SERIF_FONT_FAMILY_SIMPLIFIED_HAN));
328 update_sans_serif->SetString(uscript_getShortName(USCRIPT_SIMPLIFIED_HAN),
329 l10n_util::GetStringUTF16(IDS_SERIF_FONT_FAMILY_SIMPLIFIED_HAN));
330 update_standard->SetString(uscript_getShortName(USCRIPT_TRADITIONAL_HAN),
331 l10n_util::GetStringUTF16(IDS_STANDARD_FONT_FAMILY_TRADITIONAL_HAN));
332 update_fixed->SetString(uscript_getShortName(USCRIPT_TRADITIONAL_HAN),
333 l10n_util::GetStringUTF16(IDS_FIXED_FONT_FAMILY_TRADITIONAL_HAN));
334 update_serif->SetString(uscript_getShortName(USCRIPT_TRADITIONAL_HAN),
335 l10n_util::GetStringUTF16(IDS_SERIF_FONT_FAMILY_TRADITIONAL_HAN));
336 update_sans_serif->SetString(uscript_getShortName(USCRIPT_TRADITIONAL_HAN),
337 l10n_util::GetStringUTF16(IDS_SERIF_FONT_FAMILY_TRADITIONAL_HAN));
338 #endif
339
281 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitDefaultFontSize, 340 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitDefaultFontSize,
282 IDS_DEFAULT_FONT_SIZE, 341 IDS_DEFAULT_FONT_SIZE,
283 PrefService::UNSYNCABLE_PREF); 342 PrefService::UNSYNCABLE_PREF);
284 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitDefaultFixedFontSize, 343 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitDefaultFixedFontSize,
285 IDS_DEFAULT_FIXED_FONT_SIZE, 344 IDS_DEFAULT_FIXED_FONT_SIZE,
286 PrefService::UNSYNCABLE_PREF); 345 PrefService::UNSYNCABLE_PREF);
287 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitMinimumFontSize, 346 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitMinimumFontSize,
288 IDS_MINIMUM_FONT_SIZE, 347 IDS_MINIMUM_FONT_SIZE,
289 PrefService::UNSYNCABLE_PREF); 348 PrefService::UNSYNCABLE_PREF);
290 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitMinimumLogicalFontSize, 349 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitMinimumLogicalFontSize,
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 if (infobars_.empty()) { 773 if (infobars_.empty()) {
715 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 774 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
716 Source<NavigationController>(&tab_contents_->controller())); 775 Source<NavigationController>(&tab_contents_->controller()));
717 } 776 }
718 } 777 }
719 778
720 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { 779 void TabContentsWrapper::RemoveAllInfoBars(bool animate) {
721 while (!infobars_.empty()) 780 while (!infobars_.empty())
722 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); 781 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate);
723 } 782 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698