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

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

Issue 8469015: Switch BackgroundContents to use TabContents instead of RenderViewHost. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix unittest Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/tab_contents/background_contents.cc ('k') | chrome/browser/tabs/tab_finder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 WindowContainerType window_container_type, 145 WindowContainerType window_container_type,
146 const string16& frame_name) { 146 const string16& frame_name) {
147 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { 147 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
148 BackgroundContents* contents = MaybeCreateBackgroundContents( 148 BackgroundContents* contents = MaybeCreateBackgroundContents(
149 route_id, 149 route_id,
150 profile, 150 profile,
151 site, 151 site,
152 opener->GetURL(), 152 opener->GetURL(),
153 frame_name); 153 frame_name);
154 if (contents) { 154 if (contents) {
155 pending_contents_[route_id] = contents->render_view_host(); 155 pending_contents_[route_id] =
156 contents->tab_contents()->render_view_host();
156 return NULL; 157 return NULL;
157 } 158 }
158 } 159 }
159 160
160 TabContents* base_tab_contents = opener->GetAsTabContents(); 161 TabContents* base_tab_contents = opener->GetAsTabContents();
161 162
162 // Do not create the new TabContents if the opener is a prerender TabContents. 163 // Do not create the new TabContents if the opener is a prerender TabContents.
163 prerender::PrerenderManager* prerender_manager = 164 prerender::PrerenderManager* prerender_manager =
164 prerender::PrerenderManagerFactory::GetForProfile(profile); 165 prerender::PrerenderManagerFactory::GetForProfile(profile);
165 if (prerender_manager && 166 if (prerender_manager &&
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 545
545 web_prefs.is_online = !net::NetworkChangeNotifier::IsOffline(); 546 web_prefs.is_online = !net::NetworkChangeNotifier::IsOffline();
546 547
547 ExtensionService* service = profile->GetExtensionService(); 548 ExtensionService* service = profile->GetExtensionService();
548 if (service) { 549 if (service) {
549 const Extension* extension = 550 const Extension* extension =
550 service->GetExtensionByURL(rvh->site_instance()->site()); 551 service->GetExtensionByURL(rvh->site_instance()->site());
551 extension_webkit_preferences::SetPreferences(&web_prefs, extension); 552 extension_webkit_preferences::SetPreferences(&web_prefs, extension);
552 } 553 }
553 554
554 if (rvh->delegate()->GetRenderViewType() == chrome::VIEW_TYPE_NOTIFICATION) 555 if (rvh->delegate()->GetRenderViewType() == chrome::VIEW_TYPE_NOTIFICATION) {
555 web_prefs.allow_scripts_to_close_windows = true; 556 web_prefs.allow_scripts_to_close_windows = true;
557 } else if (rvh->delegate()->GetRenderViewType() ==
558 chrome::VIEW_TYPE_BACKGROUND_CONTENTS) {
559 // Disable all kinds of acceleration for background pages.
560 // See http://crbug.com/96005 and http://crbug.com/96006
561 web_prefs.force_compositing_mode = false;
562 web_prefs.accelerated_compositing_enabled = false;
563 web_prefs.accelerated_2d_canvas_enabled = false;
564 web_prefs.accelerated_video_enabled = false;
565 web_prefs.accelerated_drawing_enabled = false;
566 web_prefs.accelerated_plugins_enabled = false;
567 }
556 568
557 return web_prefs; 569 return web_prefs;
558 } 570 }
559 571
560 void RenderViewHostDelegateHelper::UpdateInspectorSetting( 572 void RenderViewHostDelegateHelper::UpdateInspectorSetting(
561 content::BrowserContext* browser_context, 573 content::BrowserContext* browser_context,
562 const std::string& key, 574 const std::string& key,
563 const std::string& value) { 575 const std::string& value) {
564 DictionaryPrefUpdate update( 576 DictionaryPrefUpdate update(
565 Profile::FromBrowserContext(browser_context)->GetPrefs(), 577 Profile::FromBrowserContext(browser_context)->GetPrefs(),
566 prefs::kWebKitInspectorSettings); 578 prefs::kWebKitInspectorSettings);
567 DictionaryValue* inspector_settings = update.Get(); 579 DictionaryValue* inspector_settings = update.Get();
568 inspector_settings->SetWithoutPathExpansion(key, 580 inspector_settings->SetWithoutPathExpansion(key,
569 Value::CreateStringValue(value)); 581 Value::CreateStringValue(value));
570 } 582 }
571 583
572 void RenderViewHostDelegateHelper::ClearInspectorSettings( 584 void RenderViewHostDelegateHelper::ClearInspectorSettings(
573 content::BrowserContext* browser_context) { 585 content::BrowserContext* browser_context) {
574 Profile::FromBrowserContext(browser_context)->GetPrefs()-> 586 Profile::FromBrowserContext(browser_context)->GetPrefs()->
575 ClearPref(prefs::kWebKitInspectorSettings); 587 ClearPref(prefs::kWebKitInspectorSettings);
576 } 588 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/background_contents.cc ('k') | chrome/browser/tabs/tab_finder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698