Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/tab_contents/render_view_host_delegate_helper.h" | 5 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 if (tab_contents->delegate()) | 295 if (tab_contents->delegate()) |
| 296 tab_contents->delegate()->RenderWidgetShowing(); | 296 tab_contents->delegate()->RenderWidgetShowing(); |
| 297 | 297 |
| 298 RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id); | 298 RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id); |
| 299 widget_host_view->InitAsFullscreen(tab_contents->GetRenderWidgetHostView()); | 299 widget_host_view->InitAsFullscreen(tab_contents->GetRenderWidgetHostView()); |
| 300 widget_host_view->GetRenderWidgetHost()->Init(); | 300 widget_host_view->GetRenderWidgetHost()->Init(); |
| 301 return widget_host_view; | 301 return widget_host_view; |
| 302 } | 302 } |
| 303 | 303 |
| 304 // static | 304 // static |
| 305 void RenderViewHostDelegateHelper::FillFontFamilyMap( | |
|
tony
2011/08/10 19:23:40
Does this need to be part of RenderViewHostDelegat
| |
| 306 const DictionaryValue* from, WebPreferences::ScriptFontFamilyMap& to) { | |
| 307 if (from) { | |
| 308 for (DictionaryValue::key_iterator iter(from->begin_keys()); | |
| 309 iter != from->end_keys(); ++iter) { | |
| 310 string16 value; | |
| 311 if (from->GetString(*iter, &value)) | |
| 312 to.push_back(std::make_pair(*iter, value)); | |
| 313 } | |
| 314 } | |
| 315 } | |
| 316 | |
| 317 // static | |
| 305 WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( | 318 WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( |
| 306 content::BrowserContext* browser_context, bool is_web_ui) { | 319 content::BrowserContext* browser_context, bool is_web_ui) { |
| 307 Profile* profile = Profile::FromBrowserContext(browser_context); | 320 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 308 PrefService* prefs = profile->GetPrefs(); | 321 PrefService* prefs = profile->GetPrefs(); |
| 309 WebPreferences web_prefs; | 322 WebPreferences web_prefs; |
| 310 | 323 |
| 311 web_prefs.standard_font_family = | 324 web_prefs.standard_font_family = |
| 312 UTF8ToUTF16(prefs->GetString(prefs::kWebKitStandardFontFamily)); | 325 UTF8ToUTF16(prefs->GetString(prefs::kWebKitStandardFontFamily)); |
| 313 web_prefs.fixed_font_family = | 326 web_prefs.fixed_font_family = |
| 314 UTF8ToUTF16(prefs->GetString(prefs::kWebKitFixedFontFamily)); | 327 UTF8ToUTF16(prefs->GetString(prefs::kWebKitFixedFontFamily)); |
| 315 web_prefs.serif_font_family = | 328 web_prefs.serif_font_family = |
| 316 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSerifFontFamily)); | 329 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSerifFontFamily)); |
| 317 web_prefs.sans_serif_font_family = | 330 web_prefs.sans_serif_font_family = |
| 318 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)); | 331 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)); |
| 319 web_prefs.cursive_font_family = | 332 web_prefs.cursive_font_family = |
| 320 UTF8ToUTF16(prefs->GetString(prefs::kWebKitCursiveFontFamily)); | 333 UTF8ToUTF16(prefs->GetString(prefs::kWebKitCursiveFontFamily)); |
| 321 web_prefs.fantasy_font_family = | 334 web_prefs.fantasy_font_family = |
| 322 UTF8ToUTF16(prefs->GetString(prefs::kWebKitFantasyFontFamily)); | 335 UTF8ToUTF16(prefs->GetString(prefs::kWebKitFantasyFontFamily)); |
| 323 | 336 |
| 337 FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitStandardFontFamilyMap), | |
| 338 web_prefs.standard_font_family_map); | |
| 339 FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitFixedFontFamilyMap), | |
| 340 web_prefs.fixed_font_family_map); | |
| 341 FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitSerifFontFamilyMap), | |
| 342 web_prefs.serif_font_family_map); | |
| 343 FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitSansSerifFontFamilyMap), | |
| 344 web_prefs.sans_serif_font_family_map); | |
| 345 FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitCursiveFontFamilyMap), | |
| 346 web_prefs.cursive_font_family_map); | |
| 347 FillFontFamilyMap(prefs->GetDictionary(prefs::kWebKitFantasyFontFamilyMap), | |
| 348 web_prefs.fantasy_font_family_map); | |
| 349 | |
| 324 web_prefs.default_font_size = | 350 web_prefs.default_font_size = |
| 325 prefs->GetInteger(prefs::kWebKitDefaultFontSize); | 351 prefs->GetInteger(prefs::kWebKitDefaultFontSize); |
| 326 web_prefs.default_fixed_font_size = | 352 web_prefs.default_fixed_font_size = |
| 327 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize); | 353 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize); |
| 328 web_prefs.minimum_font_size = | 354 web_prefs.minimum_font_size = |
| 329 prefs->GetInteger(prefs::kWebKitMinimumFontSize); | 355 prefs->GetInteger(prefs::kWebKitMinimumFontSize); |
| 330 web_prefs.minimum_logical_font_size = | 356 web_prefs.minimum_logical_font_size = |
| 331 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); | 357 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); |
| 332 | 358 |
| 333 web_prefs.default_encoding = prefs->GetString(prefs::kDefaultCharset); | 359 web_prefs.default_encoding = prefs->GetString(prefs::kDefaultCharset); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 DictionaryValue* inspector_settings = update.Get(); | 519 DictionaryValue* inspector_settings = update.Get(); |
| 494 inspector_settings->SetWithoutPathExpansion(key, | 520 inspector_settings->SetWithoutPathExpansion(key, |
| 495 Value::CreateStringValue(value)); | 521 Value::CreateStringValue(value)); |
| 496 } | 522 } |
| 497 | 523 |
| 498 void RenderViewHostDelegateHelper::ClearInspectorSettings( | 524 void RenderViewHostDelegateHelper::ClearInspectorSettings( |
| 499 content::BrowserContext* browser_context) { | 525 content::BrowserContext* browser_context) { |
| 500 Profile::FromBrowserContext(browser_context)->GetPrefs()-> | 526 Profile::FromBrowserContext(browser_context)->GetPrefs()-> |
| 501 ClearPref(prefs::kWebKitInspectorSettings); | 527 ClearPref(prefs::kWebKitInspectorSettings); |
| 502 } | 528 } |
| OLD | NEW |