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

Side by Side Diff: chrome/browser/tab_contents/render_view_host_delegate_helper.cc

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slight tweaking for comments 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/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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 return widget_host_view; 225 return widget_host_view;
226 } 226 }
227 227
228 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindowFromTabContents( 228 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindowFromTabContents(
229 TabContents* tab_contents, 229 TabContents* tab_contents,
230 int route_id, 230 int route_id,
231 const ViewHostMsg_CreateWindow_Params& params) { 231 const ViewHostMsg_CreateWindow_Params& params) {
232 TabContents* new_contents = CreateNewWindow( 232 TabContents* new_contents = CreateNewWindow(
233 route_id, 233 route_id,
234 tab_contents->profile(), 234 Profile::FromBrowserContext(tab_contents->browser_context()),
235 tab_contents->GetSiteInstance(), 235 tab_contents->GetSiteInstance(),
236 tab_contents->GetWebUITypeForCurrentState(), 236 tab_contents->GetWebUITypeForCurrentState(),
237 tab_contents, 237 tab_contents,
238 params.window_container_type, 238 params.window_container_type,
239 params.frame_name); 239 params.frame_name);
240 240
241 if (new_contents) { 241 if (new_contents) {
242 content::RetargetingDetails details; 242 content::RetargetingDetails details;
243 details.source_tab_contents = tab_contents; 243 details.source_tab_contents = tab_contents;
244 details.source_frame_id = params.opener_frame_id; 244 details.source_frame_id = params.opener_frame_id;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 tab_contents->delegate()->RenderWidgetShowing(); 294 tab_contents->delegate()->RenderWidgetShowing();
295 295
296 RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id); 296 RenderWidgetHostView* widget_host_view = GetCreatedWidget(route_id);
297 widget_host_view->InitAsFullscreen(tab_contents->GetRenderWidgetHostView()); 297 widget_host_view->InitAsFullscreen(tab_contents->GetRenderWidgetHostView());
298 widget_host_view->GetRenderWidgetHost()->Init(); 298 widget_host_view->GetRenderWidgetHost()->Init();
299 return widget_host_view; 299 return widget_host_view;
300 } 300 }
301 301
302 // static 302 // static
303 WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( 303 WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
304 Profile* profile, bool is_web_ui) { 304 content::BrowserContext* browser_context, bool is_web_ui) {
305 Profile* profile = Profile::FromBrowserContext(browser_context);
305 PrefService* prefs = profile->GetPrefs(); 306 PrefService* prefs = profile->GetPrefs();
306 WebPreferences web_prefs; 307 WebPreferences web_prefs;
307 308
308 web_prefs.standard_font_family = 309 web_prefs.standard_font_family =
309 UTF8ToUTF16(prefs->GetString(prefs::kWebKitStandardFontFamily)); 310 UTF8ToUTF16(prefs->GetString(prefs::kWebKitStandardFontFamily));
310 web_prefs.fixed_font_family = 311 web_prefs.fixed_font_family =
311 UTF8ToUTF16(prefs->GetString(prefs::kWebKitFixedFontFamily)); 312 UTF8ToUTF16(prefs->GetString(prefs::kWebKitFixedFontFamily));
312 web_prefs.serif_font_family = 313 web_prefs.serif_font_family =
313 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSerifFontFamily)); 314 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSerifFontFamily));
314 web_prefs.sans_serif_font_family = 315 web_prefs.sans_serif_font_family =
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 web_prefs.loads_images_automatically = true; 473 web_prefs.loads_images_automatically = true;
473 web_prefs.javascript_enabled = true; 474 web_prefs.javascript_enabled = true;
474 } 475 }
475 476
476 web_prefs.is_online = !net::NetworkChangeNotifier::IsOffline(); 477 web_prefs.is_online = !net::NetworkChangeNotifier::IsOffline();
477 478
478 return web_prefs; 479 return web_prefs;
479 } 480 }
480 481
481 void RenderViewHostDelegateHelper::UpdateInspectorSetting( 482 void RenderViewHostDelegateHelper::UpdateInspectorSetting(
482 Profile* profile, const std::string& key, const std::string& value) { 483 content::BrowserContext* browser_context,
483 DictionaryPrefUpdate update(profile->GetPrefs(), 484 const std::string& key,
484 prefs::kWebKitInspectorSettings); 485 const std::string& value) {
486 DictionaryPrefUpdate update(
487 Profile::FromBrowserContext(browser_context)->GetPrefs(),
488 prefs::kWebKitInspectorSettings);
485 DictionaryValue* inspector_settings = update.Get(); 489 DictionaryValue* inspector_settings = update.Get();
486 inspector_settings->SetWithoutPathExpansion(key, 490 inspector_settings->SetWithoutPathExpansion(key,
487 Value::CreateStringValue(value)); 491 Value::CreateStringValue(value));
488 } 492 }
489 493
490 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { 494 void RenderViewHostDelegateHelper::ClearInspectorSettings(
491 profile->GetPrefs()->ClearPref(prefs::kWebKitInspectorSettings); 495 content::BrowserContext* browser_context) {
496 Profile::FromBrowserContext(browser_context)->GetPrefs()->
497 ClearPref(prefs::kWebKitInspectorSettings);
492 } 498 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_host_delegate_helper.h ('k') | chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698