| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 return widget_host_view; | 224 return widget_host_view; |
| 225 } | 225 } |
| 226 | 226 |
| 227 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindowFromTabContents( | 227 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindowFromTabContents( |
| 228 TabContents* tab_contents, | 228 TabContents* tab_contents, |
| 229 int route_id, | 229 int route_id, |
| 230 const ViewHostMsg_CreateWindow_Params& params) { | 230 const ViewHostMsg_CreateWindow_Params& params) { |
| 231 TabContents* new_contents = CreateNewWindow( | 231 TabContents* new_contents = CreateNewWindow( |
| 232 route_id, | 232 route_id, |
| 233 tab_contents->profile(), | 233 static_cast<Profile*>(tab_contents->context()), |
| 234 tab_contents->GetSiteInstance(), | 234 tab_contents->GetSiteInstance(), |
| 235 tab_contents->GetWebUITypeForCurrentState(), | 235 tab_contents->GetWebUITypeForCurrentState(), |
| 236 tab_contents, | 236 tab_contents, |
| 237 params.window_container_type, | 237 params.window_container_type, |
| 238 params.frame_name); | 238 params.frame_name); |
| 239 | 239 |
| 240 if (new_contents) { | 240 if (new_contents) { |
| 241 NotificationService::current()->Notify( | 241 NotificationService::current()->Notify( |
| 242 content::NOTIFICATION_CREATING_NEW_WINDOW, | 242 content::NOTIFICATION_CREATING_NEW_WINDOW, |
| 243 Source<TabContents>(tab_contents), | 243 Source<TabContents>(tab_contents), |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 tab_contents->delegate()->RenderWidgetShowing(); | 288 tab_contents->delegate()->RenderWidgetShowing(); |
| 289 | 289 |
| 290 RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id); | 290 RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id); |
| 291 widget_host_view->InitAsFullscreen(); | 291 widget_host_view->InitAsFullscreen(); |
| 292 widget_host_view->GetRenderWidgetHost()->Init(); | 292 widget_host_view->GetRenderWidgetHost()->Init(); |
| 293 return widget_host_view; | 293 return widget_host_view; |
| 294 } | 294 } |
| 295 | 295 |
| 296 // static | 296 // static |
| 297 WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( | 297 WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( |
| 298 Profile* profile, bool is_web_ui) { | 298 content::BrowserContext* context, bool is_web_ui) { |
| 299 Profile* profile = static_cast<Profile*>(context); |
| 299 PrefService* prefs = profile->GetPrefs(); | 300 PrefService* prefs = profile->GetPrefs(); |
| 300 WebPreferences web_prefs; | 301 WebPreferences web_prefs; |
| 301 | 302 |
| 302 web_prefs.standard_font_family = | 303 web_prefs.standard_font_family = |
| 303 UTF8ToUTF16(prefs->GetString(prefs::kWebKitStandardFontFamily)); | 304 UTF8ToUTF16(prefs->GetString(prefs::kWebKitStandardFontFamily)); |
| 304 web_prefs.fixed_font_family = | 305 web_prefs.fixed_font_family = |
| 305 UTF8ToUTF16(prefs->GetString(prefs::kWebKitFixedFontFamily)); | 306 UTF8ToUTF16(prefs->GetString(prefs::kWebKitFixedFontFamily)); |
| 306 web_prefs.serif_font_family = | 307 web_prefs.serif_font_family = |
| 307 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSerifFontFamily)); | 308 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSerifFontFamily)); |
| 308 web_prefs.sans_serif_font_family = | 309 web_prefs.sans_serif_font_family = |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 web_prefs.loads_images_automatically = true; | 467 web_prefs.loads_images_automatically = true; |
| 467 web_prefs.javascript_enabled = true; | 468 web_prefs.javascript_enabled = true; |
| 468 } | 469 } |
| 469 | 470 |
| 470 web_prefs.is_online = !net::NetworkChangeNotifier::IsOffline(); | 471 web_prefs.is_online = !net::NetworkChangeNotifier::IsOffline(); |
| 471 | 472 |
| 472 return web_prefs; | 473 return web_prefs; |
| 473 } | 474 } |
| 474 | 475 |
| 475 void RenderViewHostDelegateHelper::UpdateInspectorSetting( | 476 void RenderViewHostDelegateHelper::UpdateInspectorSetting( |
| 476 Profile* profile, const std::string& key, const std::string& value) { | 477 content::BrowserContext* context, |
| 477 DictionaryPrefUpdate update(profile->GetPrefs(), | 478 const std::string& key, |
| 479 const std::string& value) { |
| 480 DictionaryPrefUpdate update(static_cast<Profile*>(context)->GetPrefs(), |
| 478 prefs::kWebKitInspectorSettings); | 481 prefs::kWebKitInspectorSettings); |
| 479 DictionaryValue* inspector_settings = update.Get(); | 482 DictionaryValue* inspector_settings = update.Get(); |
| 480 inspector_settings->SetWithoutPathExpansion(key, | 483 inspector_settings->SetWithoutPathExpansion(key, |
| 481 Value::CreateStringValue(value)); | 484 Value::CreateStringValue(value)); |
| 482 } | 485 } |
| 483 | 486 |
| 484 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { | 487 void RenderViewHostDelegateHelper::ClearInspectorSettings( |
| 485 profile->GetPrefs()->ClearPref(prefs::kWebKitInspectorSettings); | 488 content::BrowserContext* context) { |
| 489 static_cast<Profile*>(context)->GetPrefs()-> |
| 490 ClearPref(prefs::kWebKitInspectorSettings); |
| 486 } | 491 } |
| OLD | NEW |