diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-09 09:24:59 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-09 09:24:59 +0000 |
commit | 54944cde97a47ee2148d026cec1da117a426b844 (patch) | |
tree | 5b9f668af96b85800a56998f052798c811037b90 /chrome/browser | |
parent | 0da7676478445eff983f8d4afacbbb67f6d1dcd9 (diff) | |
download | chromium_src-54944cde97a47ee2148d026cec1da117a426b844.zip chromium_src-54944cde97a47ee2148d026cec1da117a426b844.tar.gz chromium_src-54944cde97a47ee2148d026cec1da117a426b844.tar.bz2 |
Introduces "CreateParams" for web contents, and add |parent| parameter in it.
BUG=155443
TEST=In Goobuntu, add logging of screen_info in RenderViewHost::CreateRenderView() temporarily and make sure the correct scale factor is chosen at boot.
Review URL: https://chromiumcodereview.appspot.com/11361245
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
41 files changed, 94 insertions, 131 deletions
diff --git a/chrome/browser/android/content_view_util.cc b/chrome/browser/android/content_view_util.cc index abcab24..2aaa466 100644 --- a/chrome/browser/android/content_view_util.cc +++ b/chrome/browser/android/content_view_util.cc @@ -9,7 +9,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "content/public/browser/web_contents.h" -#include "ipc/ipc_message.h" #include "jni/ContentViewUtil_jni.h" static jint CreateNativeWebContents( @@ -19,11 +18,10 @@ static jint CreateNativeWebContents( profile = profile->GetOffTheRecordProfile(); content::WebContents* web_contents = - content::WebContents::Create(profile, 0, MSG_ROUTING_NONE, 0); + content::WebContents::Create(content::WebContents::CreateParams(profile)); return reinterpret_cast<jint>(web_contents); } bool RegisterContentViewUtil(JNIEnv* env) { return RegisterNativesImpl(env); } - diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index a2e10eb..ca312d6 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -189,8 +189,8 @@ DevToolsWindow* DevToolsWindow::Create( DevToolsDockSide dock_side, bool shared_worker_frontend) { // Create TabContents with devtools. - TabContents* tab_contents = - chrome::TabContentsFactory(profile, NULL, MSG_ROUTING_NONE, NULL); + TabContents* tab_contents = chrome::TabContentsFactory( + content::WebContents::CreateParams(profile)); tab_contents->web_contents()->GetRenderViewHost()->AllowBindings( content::BINDINGS_POLICY_WEB_UI); tab_contents->web_contents()->GetController().LoadURL( diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc index a702f6e..fa4f9b7 100644 --- a/chrome/browser/extensions/api/identity/web_auth_flow.cc +++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc @@ -107,7 +107,7 @@ void WebAuthFlow::Start() { } WebContents* WebAuthFlow::CreateWebContents() { - return WebContents::Create(profile_, NULL, MSG_ROUTING_NONE, NULL); + return WebContents::Create(WebContents::CreateParams(profile_)); } void WebAuthFlow::ShowAuthFlowPopup() { diff --git a/chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.cc b/chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.cc index 0b0756f..d82db71 100644 --- a/chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.cc +++ b/chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.cc @@ -218,7 +218,7 @@ void OffscreenTab::Init(const GURL& url, ParentTab* parent_tab) { // Create the offscreen tab. web_contents_.reset( - WebContents::Create(profile, NULL, MSG_ROUTING_NONE, NULL)); + WebContents::Create(WebContents::CreateParams(profile))); extensions::TabHelper::CreateForWebContents(web_contents_.get()); // Setting the size starts the renderer. diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index ebc288d..3bae1ad 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -143,7 +143,7 @@ ExtensionHost::ExtensionHost(const Extension* extension, extension_host_type_(host_type), associated_web_contents_(NULL) { host_contents_.reset(WebContents::Create( - profile_, site_instance, MSG_ROUTING_NONE, NULL)); + WebContents::CreateParams(profile_, site_instance))), content::WebContentsObserver::Observe(host_contents_.get()); host_contents_->SetDelegate(this); chrome::SetViewType(host_contents_.get(), host_type); diff --git a/chrome/browser/extensions/startup_helper.cc b/chrome/browser/extensions/startup_helper.cc index 419316ad..0ae2dd6 100644 --- a/chrome/browser/extensions/startup_helper.cc +++ b/chrome/browser/extensions/startup_helper.cc @@ -127,8 +127,8 @@ bool StartupHelper::InstallFromWebstore(const CommandLine& cmd_line, // TODO(asargent) - it would be nice not to need a WebContents just to // use the standalone installer. (crbug.com/149039) - scoped_ptr<content::WebContents> web_contents( - content::WebContents::Create(profile, NULL, MSG_ROUTING_NONE, NULL)); + scoped_ptr<content::WebContents> web_contents(content::WebContents::Create( + content::WebContents::CreateParams(profile))); AppInstallHelper helper; WebstoreStandaloneInstaller::Callback callback = diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc index a0ec58c..d5c088c 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc @@ -222,8 +222,8 @@ void GeolocationPermissionContextTests::CheckPermissionMessageSentInternal( } void GeolocationPermissionContextTests::AddNewTab(const GURL& url) { - content::WebContents* new_tab = - content::WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL); + content::WebContents* new_tab = content::WebContents::Create( + content::WebContents::CreateParams(profile())); new_tab->GetController().LoadURL( url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); content::RenderViewHostTester::For(new_tab->GetRenderViewHost())-> diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index ce135e6..53eefc8 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -187,8 +187,11 @@ InstantLoader::~InstantLoader() { } void InstantLoader::InitContents(const content::WebContents* active_tab) { + content::WebContents::CreateParams create_params( + active_tab->GetBrowserContext()); + create_params.base_web_contents = active_tab; contents_.reset(content::WebContents::CreateWithSessionStorage( - active_tab->GetBrowserContext(), NULL, MSG_ROUTING_NONE, active_tab, + create_params, active_tab->GetController().GetSessionStorageNamespaceMap())); // Not a leak. TabContents will delete itself when the WebContents is gone. TabContents::Factory::CreateTabContents(contents()); diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index c0ac128..818262f 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -133,10 +133,7 @@ void BalloonHost::OnRequest(const ExtensionHostMsg_Request_Params& params) { void BalloonHost::Init() { DCHECK(!web_contents_.get()) << "BalloonViewHost already initialized."; web_contents_.reset(WebContents::Create( - balloon_->profile(), - site_instance_.get(), - MSG_ROUTING_NONE, - NULL)); + WebContents::CreateParams(balloon_->profile(), site_instance_.get()))); chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_NOTIFICATION); web_contents_->SetDelegate(this); Observe(web_contents_.get()); diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index 7823fe8..e749a7b 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -487,7 +487,7 @@ WebContents* PrerenderContents::CreateWebContents( content::SessionStorageNamespaceMap session_storage_namespace_map; session_storage_namespace_map[""] = session_storage_namespace; return WebContents::CreateWithSessionStorage( - profile_, NULL, MSG_ROUTING_NONE, NULL, session_storage_namespace_map); + WebContents::CreateParams(profile_), session_storage_namespace_map); } void PrerenderContents::NotifyPrerenderStart() { diff --git a/chrome/browser/sessions/session_restore_android.cc b/chrome/browser/sessions/session_restore_android.cc index 7864667..4ad11bc 100644 --- a/chrome/browser/sessions/session_restore_android.cc +++ b/chrome/browser/sessions/session_restore_android.cc @@ -12,7 +12,6 @@ #include "chrome/browser/ui/android/tab_model/tab_model_list.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/web_contents.h" -#include "ipc/ipc_message.h" // The android implementation does not do anything "foreign session" specific. // We use it to restore tabs from "recently closed" too. @@ -30,7 +29,7 @@ void SessionRestore::RestoreForeignSessionTab( TabNavigation::CreateNavigationEntriesFromTabNavigations( session_tab.navigations, profile); content::WebContents* new_web_contents = content::WebContents::Create( - context, NULL, MSG_ROUTING_NONE, NULL); + content::WebContents::CreateParams(context)); int selected_index = session_tab.normalized_navigation_index(); new_web_contents->GetController().Restore( selected_index, diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index 6510921..9c5b50a 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc @@ -889,7 +889,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, SessionStorageAfterTabReplace) { controller->GetDefaultSessionStorageNamespace(); scoped_ptr<content::WebContents> web_contents( content::WebContents::CreateWithSessionStorage( - browser()->profile(), NULL, MSG_ROUTING_NONE, NULL, + content::WebContents::CreateParams(browser()->profile()), session_storage_namespace_map)); TabStripModel* tab_strip_model = browser()->tab_strip_model(); diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index a223059..f98a812 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -29,8 +29,9 @@ BackgroundContents::BackgroundContents(SiteInstance* site_instance, site_instance->GetBrowserContext()); // TODO(rafaelw): Implement correct session storage. - web_contents_.reset(WebContents::Create( - profile_, site_instance, routing_id, NULL)); + WebContents::CreateParams create_params(profile_, site_instance); + create_params.routing_id = routing_id; + web_contents_.reset(WebContents::Create(create_params)); chrome::SetViewType( web_contents_.get(), chrome::VIEW_TYPE_BACKGROUND_CONTENTS); web_contents_->SetDelegate(this); diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 3818d11..8b2001a 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -874,7 +874,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, TabClosingWhenRemovingExtension) { ui_test_utils::NavigateToURL(browser(), url); WebContents* app_contents = WebContents::Create( - browser()->profile(), NULL, MSG_ROUTING_NONE, NULL); + WebContents::CreateParams(browser()->profile())); extensions::TabHelper::CreateForWebContents(app_contents); extensions::TabHelper* extensions_tab_helper = extensions::TabHelper::FromWebContents(app_contents); @@ -997,7 +997,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) { const Extension* extension_app = GetExtension(); ui_test_utils::NavigateToURL(browser(), url); WebContents* app_contents = WebContents::Create( - browser()->profile(), NULL, MSG_ROUTING_NONE, NULL); + WebContents::CreateParams(browser()->profile())); extensions::TabHelper::CreateForWebContents(app_contents); extensions::TabHelper* extensions_tab_helper = extensions::TabHelper::FromWebContents(app_contents); diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index e7d1a59..70b76ec 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -37,6 +37,10 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" +#if defined(USE_AURA) +#include "ui/aura/window.h" +#endif + using content::GlobalRequestID; using content::WebContents; @@ -474,11 +478,18 @@ void Navigate(NavigateParams* params) { } if (params->disposition != CURRENT_TAB) { - params->target_contents = WebContents::Create( + WebContents::CreateParams create_params( params->browser->profile(), - tab_util::GetSiteInstanceForNewTab(params->browser->profile(), url), - MSG_ROUTING_NONE, - params->source_contents); + tab_util::GetSiteInstanceForNewTab(params->browser->profile(), url)); + create_params.base_web_contents = params->source_contents; +#if defined(USE_AURA) + if (params->browser->window() && + params->browser->window()->GetNativeWindow()) { + create_params.context = + params->browser->window()->GetNativeWindow(); + } +#endif + params->target_contents = WebContents::Create(create_params); // New tabs can have WebUI URLs that will make calls back to arbitrary // tab helpers, so the entire set of tab helpers needs to be set up // immediately. diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index 281d33b..d59acf0 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc @@ -91,11 +91,9 @@ Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type, } WebContents* BrowserNavigatorTest::CreateWebContents() { - return WebContents::Create( - browser()->profile(), - NULL, - MSG_ROUTING_NONE, - chrome::GetActiveWebContents(browser())); + content::WebContents::CreateParams create_params(browser()->profile()); + create_params.base_web_contents = chrome::GetActiveWebContents(browser()); + return WebContents::Create(create_params); } void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { diff --git a/chrome/browser/ui/browser_tabrestore.cc b/chrome/browser/ui/browser_tabrestore.cc index ff04683..6ddc50a 100644 --- a/chrome/browser/ui/browser_tabrestore.cc +++ b/chrome/browser/ui/browser_tabrestore.cc @@ -17,7 +17,6 @@ #include "content/public/browser/session_storage_namespace.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" -#include "ipc/ipc_message.h" using content::WebContents; using content::NavigationController; @@ -52,11 +51,13 @@ WebContents* CreateRestoredTab( // into the map. content::SessionStorageNamespaceMap session_storage_namespace_map; session_storage_namespace_map[""] = session_storage_namespace; - WebContents* web_contents = content::WebContents::CreateWithSessionStorage( + WebContents::CreateParams create_params( browser->profile(), - tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url), - MSG_ROUTING_NONE, - browser->tab_strip_model()->GetActiveWebContents(), + tab_util::GetSiteInstanceForNewTab(browser->profile(), restore_url)); + create_params.base_web_contents = + browser->tab_strip_model()->GetActiveWebContents(); + WebContents* web_contents = content::WebContents::CreateWithSessionStorage( + create_params, session_storage_namespace_map); extensions::TabHelper::CreateForWebContents(web_contents); extensions::TabHelper::FromWebContents(web_contents)-> diff --git a/chrome/browser/ui/browser_tabstrip.cc b/chrome/browser/ui/browser_tabstrip.cc index 8582b93..70d37b5 100644 --- a/chrome/browser/ui/browser_tabstrip.cc +++ b/chrome/browser/ui/browser_tabstrip.cc @@ -129,15 +129,9 @@ void CloseWebContents(Browser* browser, content::WebContents* contents) { } TabContents* TabContentsFactory( - Profile* profile, - content::SiteInstance* site_instance, - int routing_id, - const content::WebContents* base_web_contents) { + const content::WebContents::CreateParams& create_params) { return BrowserTabstripTabContentsCreator::CreateTabContents( - content::WebContents::Create(profile, - site_instance, - routing_id, - base_web_contents)); + content::WebContents::Create(create_params)); } } // namespace chrome diff --git a/chrome/browser/ui/browser_tabstrip.h b/chrome/browser/ui/browser_tabstrip.h index 6ab6403..77edd40 100644 --- a/chrome/browser/ui/browser_tabstrip.h +++ b/chrome/browser/ui/browser_tabstrip.h @@ -7,6 +7,7 @@ #include "content/public/common/page_transition_types.h" #include "content/public/browser/navigation_controller.h" +#include "content/public/browser/web_contents.h" #include "webkit/glue/window_open_disposition.h" class Browser; @@ -16,7 +17,6 @@ class TabContents; namespace content { class SiteInstance; -class WebContents; } namespace gfx { @@ -56,10 +56,7 @@ void CloseWebContents(Browser* browser, content::WebContents* contents); // Centralized methods for creating a TabContents, configuring and // installing all its supporting objects and observers. TabContents* TabContentsFactory( - Profile* profile, - content::SiteInstance* site_instance, - int routing_id, - const content::WebContents* base_web_contents); + const content::WebContents::CreateParams& create_params); } // namespace chrome diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm index 03900981..1a11066 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm @@ -16,7 +16,6 @@ #include "chrome/test/base/in_process_browser_test.h" #include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" -#include "ipc/ipc_message.h" #include "testing/gmock/include/gmock/gmock.h" using ::testing::NiceMock; @@ -91,7 +90,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInInactiveTab) { // a tab works correctly. IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInUninitializedTab) { scoped_ptr<content::WebContents> web_contents(content::WebContents::Create( - browser()->profile(), NULL, MSG_ROUTING_NONE, NULL)); + content::WebContents::CreateParams(browser()->profile()))); bool was_blocked = false; chrome::AddWebContents(browser(), NULL, web_contents.release(), NEW_BACKGROUND_TAB, gfx::Rect(), false, &was_blocked); diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm index 157661f..520755e 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm @@ -15,7 +15,6 @@ #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" #include "content/public/test/test_utils.h" -#include "ipc/ipc_message.h" #include "testing/gtest_mac.h" #include "ui/base/accelerators/platform_accelerator_cocoa.h" @@ -67,7 +66,7 @@ class FullscreenExitBubbleControllerTest : public CocoaProfileTest { void AppendTabToStrip() { WebContents* web_contents = WebContents::Create( - profile(), site_instance_, MSG_ROUTING_NONE, NULL); + content::WebContents::CreateParams(profile(), site_instance_)); browser()->tab_strip_model()->AppendWebContents( web_contents, /*foreground=*/true); } diff --git a/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm b/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm index 9bd4306..dac2094 100644 --- a/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm @@ -100,7 +100,7 @@ class LinkInfoBarControllerTest : public CocoaProfileTest, virtual void SetUp() { CocoaProfileTest::SetUp(); web_contents_.reset( - WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL)); + WebContents::Create(WebContents::CreateParams(profile()))); InfoBarTabHelper::CreateForWebContents(web_contents_.get()); InfoBarTabHelper* infobar_tab_helper = @@ -145,7 +145,7 @@ class ConfirmInfoBarControllerTest : public CocoaProfileTest, virtual void SetUp() { CocoaProfileTest::SetUp(); web_contents_.reset( - WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL)); + WebContents::Create(WebContents::CreateParams(profile()))); InfoBarTabHelper::CreateForWebContents(web_contents_.get()); InfoBarTabHelper* infobar_tab_helper = diff --git a/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm b/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm index a8e8257..8755e8c 100644 --- a/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm +++ b/chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm @@ -65,7 +65,7 @@ class TranslationInfoBarTest : public CocoaProfileTest { virtual void SetUp() { CocoaProfileTest::SetUp(); web_contents_.reset( - WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL)); + WebContents::Create(WebContents::CreateParams(profile()))); InfoBarTabHelper::CreateForWebContents(web_contents_.get()); CreateInfoBar(); } diff --git a/chrome/browser/ui/cocoa/intents/web_intent_inline_service_view_controller_browsertest.mm b/chrome/browser/ui/cocoa/intents/web_intent_inline_service_view_controller_browsertest.mm index 1c3d4e7..faa0d56 100644 --- a/chrome/browser/ui/cocoa/intents/web_intent_inline_service_view_controller_browsertest.mm +++ b/chrome/browser/ui/cocoa/intents/web_intent_inline_service_view_controller_browsertest.mm @@ -12,7 +12,6 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/browser/web_contents.h" -#include "ipc/ipc_message.h" #import "testing/gtest_mac.h" namespace { @@ -91,11 +90,11 @@ IN_PROC_BROWSER_TEST_F(WebIntentInlineServiceViewControllerTest, WebView) { [view_controller_ setServiceName:kTitle]; GURL url("about:blank"); - content::WebContents* web_contents = content::WebContents::Create( + content::WebContents::CreateParams create_params( browser()->profile(), - tab_util::GetSiteInstanceForNewTab(browser()->profile(), url), - MSG_ROUTING_NONE, - NULL); + tab_util::GetSiteInstanceForNewTab(browser()->profile(), url)); + content::WebContents* web_contents = content::WebContents::Create( + create_params); // Create a web view EXPECT_CALL(delegate_, @@ -126,11 +125,11 @@ IN_PROC_BROWSER_TEST_F(WebIntentInlineServiceViewControllerTest, UnsetWebView) { ASSERT_FALSE([view_controller_ webContents]); GURL url("about:blank"); - content::WebContents* web_contents = content::WebContents::Create( + content::WebContents::CreateParams create_params( browser()->profile(), - tab_util::GetSiteInstanceForNewTab(browser()->profile(), url), - MSG_ROUTING_NONE, - NULL); + tab_util::GetSiteInstanceForNewTab(browser()->profile(), url)); + content::WebContents* web_contents = content::WebContents::Create( + create_params); EXPECT_CALL(delegate_, CreateWebContentsForInlineDisposition(testing::_, testing::_)) .WillOnce(testing::Return(web_contents)); diff --git a/chrome/browser/ui/cocoa/intents/web_intent_picker_view_controller_browsertest.mm b/chrome/browser/ui/cocoa/intents/web_intent_picker_view_controller_browsertest.mm index a7c15e4..995bc5e 100644 --- a/chrome/browser/ui/cocoa/intents/web_intent_picker_view_controller_browsertest.mm +++ b/chrome/browser/ui/cocoa/intents/web_intent_picker_view_controller_browsertest.mm @@ -153,11 +153,11 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerViewControllerTest, InlineService) { // Create a web view GURL url("about:blank"); - content::WebContents* web_contents = content::WebContents::Create( + content::WebContents::CreateParams create_params( browser()->profile(), - tab_util::GetSiteInstanceForNewTab(browser()->profile(), url), - MSG_ROUTING_NONE, - NULL); + tab_util::GetSiteInstanceForNewTab(browser()->profile(), url)); + content::WebContents* web_contents = content::WebContents::Create( + create_params); EXPECT_CALL(delegate_, CreateWebContentsForInlineDisposition(testing::_, testing::_)) .WillOnce(testing::Return(web_contents)); diff --git a/chrome/browser/ui/cocoa/location_bar/web_intents_button_decoration_unittest.mm b/chrome/browser/ui/cocoa/location_bar/web_intents_button_decoration_unittest.mm index 3135f23..f4a9ba7 100644 --- a/chrome/browser/ui/cocoa/location_bar/web_intents_button_decoration_unittest.mm +++ b/chrome/browser/ui/cocoa/location_bar/web_intents_button_decoration_unittest.mm @@ -10,7 +10,6 @@ #include "chrome/browser/ui/intents/web_intent_picker_controller.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_intents_dispatcher.h" -#include "ipc/ipc_message.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/web_intent_data.h" #include "webkit/glue/web_intent_reply_data.h" @@ -34,8 +33,9 @@ class WebIntentsButtonDecorationTest : public CocoaProfileTest { TEST_F(WebIntentsButtonDecorationTest, IdentifiesWebIntentService) { scoped_refptr<content::SiteInstance> instance = content::SiteInstance::Create(profile()); + content::WebContents::CreateParams create_params(profile(), instance.get()); scoped_ptr<content::WebContents> contents(content::WebContents::Create( - profile(), instance.get(), MSG_ROUTING_NONE, NULL)); + create_params)); WebIntentPickerController::CreateForWebContents(contents.get()); decoration_.Update(contents.get()); diff --git a/chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller_browsertest.mm b/chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller_browsertest.mm index 871194a..6efe2cf 100644 --- a/chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller_browsertest.mm +++ b/chrome/browser/ui/cocoa/tab_contents/previewable_contents_controller_browsertest.mm @@ -12,7 +12,6 @@ #include "chrome/browser/ui/cocoa/tab_contents/instant_preview_controller_mac.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/browser/web_contents.h" -#include "ipc/ipc_message.h" #import "testing/gtest_mac.h" class PreviewableContentsControllerTest : public InProcessBrowserTest { @@ -22,7 +21,7 @@ class PreviewableContentsControllerTest : public InProcessBrowserTest { virtual void SetUpOnMainThread() OVERRIDE { web_contents_.reset(content::WebContents::Create( - browser()->profile(), NULL, MSG_ROUTING_NONE, NULL)); + content::WebContents::CreateParams(browser()->profile()))); instant_model_.SetPreviewContents(web_contents_.get()); controller_.reset([[PreviewableContentsController alloc] diff --git a/chrome/browser/ui/cocoa/tabpose_window_unittest.mm b/chrome/browser/ui/cocoa/tabpose_window_unittest.mm index 3fea221..a1e51f1 100644 --- a/chrome/browser/ui/cocoa/tabpose_window_unittest.mm +++ b/chrome/browser/ui/cocoa/tabpose_window_unittest.mm @@ -11,7 +11,6 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" -#include "ipc/ipc_message.h" #include "testing/gtest/include/gtest/gtest.h" using content::SiteInstance; @@ -27,7 +26,7 @@ class TabposeWindowTest : public CocoaProfileTest { void AppendTabToStrip() { content::WebContents* web_contents = content::WebContents::Create( - profile(), site_instance_, MSG_ROUTING_NONE, NULL); + content::WebContents::CreateParams(profile(), site_instance_)); browser()->tab_strip_model()->AppendWebContents( web_contents, /*foreground=*/true); } diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm index ef22797..d92c432 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm @@ -14,7 +14,6 @@ #include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" -#include "ipc/ipc_message.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -103,7 +102,7 @@ class TabStripControllerTest : public CocoaProfileTest { TabView* CreateTab() { SiteInstance* instance = SiteInstance::Create(profile()); WebContents* web_contents = WebContents::Create( - profile(), instance, MSG_ROUTING_NONE, NULL); + content::WebContents::CreateParams(profile(), instance)); model_->AppendWebContents(web_contents, true); const NSUInteger tab_count = [controller_.get() viewsCount]; return static_cast<TabView*>([controller_.get() viewAtIndex:tab_count - 1]); diff --git a/chrome/browser/ui/cocoa/web_dialog_window_controller.mm b/chrome/browser/ui/cocoa/web_dialog_window_controller.mm index 4372667..45f2c91 100644 --- a/chrome/browser/ui/cocoa/web_dialog_window_controller.mm +++ b/chrome/browser/ui/cocoa/web_dialog_window_controller.mm @@ -340,7 +340,7 @@ void WebDialogWindowDelegateBridge::HandleKeyboardEvent( - (void)loadDialogContents { webContents_.reset(WebContents::Create( - delegate_->browser_context(), NULL, MSG_ROUTING_NONE, NULL)); + WebContents::CreateParams(delegate_->browser_context()))); [[self window] setContentView:webContents_->GetNativeView()]; webContents_->SetDelegate(delegate_.get()); diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc index d076ca2..9ef76e5 100644 --- a/chrome/browser/ui/extensions/shell_window.cc +++ b/chrome/browser/ui/extensions/shell_window.cc @@ -113,9 +113,8 @@ void ShellWindow::Init(const GURL& url, const ShellWindow::CreateParams& params) { window_type_ = params.window_type; - web_contents_.reset(WebContents::Create( - profile(), SiteInstance::CreateForURL(profile(), url), MSG_ROUTING_NONE, - NULL)); + web_contents_.reset(WebContents::Create(WebContents::CreateParams( + profile(), SiteInstance::CreateForURL(profile(), url)))); ConstrainedWindowTabHelper::CreateForWebContents(web_contents_.get()); FaviconTabHelper::CreateForWebContents(web_contents_.get()); WebIntentPickerController::CreateForWebContents(web_contents_.get()); diff --git a/chrome/browser/ui/gtk/web_dialog_gtk.cc b/chrome/browser/ui/gtk/web_dialog_gtk.cc index 50b20cb..663a6e3 100644 --- a/chrome/browser/ui/gtk/web_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/web_dialog_gtk.cc @@ -206,7 +206,7 @@ void WebDialogGtk::HandleKeyboardEvent(content::WebContents* source, gfx::NativeWindow WebDialogGtk::InitDialog() { web_contents_.reset(WebContents::Create( - browser_context(), NULL, MSG_ROUTING_NONE, NULL)); + WebContents::CreateParams(browser_context()))); web_contents_->SetDelegate(this); // This must be done before loading the page; see the comments in diff --git a/chrome/browser/ui/intents/web_intent_inline_disposition_delegate_unittest.cc b/chrome/browser/ui/intents/web_intent_inline_disposition_delegate_unittest.cc index 1911e76..1a03ab1 100644 --- a/chrome/browser/ui/intents/web_intent_inline_disposition_delegate_unittest.cc +++ b/chrome/browser/ui/intents/web_intent_inline_disposition_delegate_unittest.cc @@ -30,7 +30,7 @@ class WebIntentInlineDispositionBrowserTest BrowserWithTestWindowTest::SetUp(); web_contents_.reset(content::WebContents::Create( - browser()->profile(), NULL, MSG_ROUTING_NONE, NULL)); + content::WebContents::CreateParams(browser()->profile()))); delegate_.reset(new WebIntentInlineDispositionDelegate( &mock_, web_contents_.get(), browser())); } diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc index a555ff1..8c7c253 100644 --- a/chrome/browser/ui/intents/web_intent_picker_controller.cc +++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc @@ -44,7 +44,6 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_intents_dispatcher.h" -#include "ipc/ipc_message.h" #include "ui/gfx/favicon_size.h" #include "ui/gfx/image/image.h" @@ -331,9 +330,8 @@ void WebIntentPickerController::OnServiceChosen( case webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW: { content::WebContents* contents = content::WebContents::Create( - profile_, - tab_util::GetSiteInstanceForNewTab(profile_, url), - MSG_ROUTING_NONE, NULL); + content::WebContents::CreateParams( + profile_, tab_util::GetSiteInstanceForNewTab(profile_, url))); WebIntentPickerController::CreateForWebContents(contents); // Let the controller for the target WebContents know that it is hosting a @@ -374,10 +372,10 @@ void WebIntentPickerController::OnServiceChosen( content::WebContents* WebIntentPickerController::CreateWebContentsForInlineDisposition( Profile* profile, const GURL& url) { + content::WebContents::CreateParams create_params( + profile, tab_util::GetSiteInstanceForNewTab(profile, url)); content::WebContents* web_contents = content::WebContents::Create( - profile, - tab_util::GetSiteInstanceForNewTab(profile, url), - MSG_ROUTING_NONE, NULL); + create_params); intents_dispatcher_->DispatchIntent(web_contents); return web_contents; } diff --git a/chrome/browser/ui/panels/panel_host.cc b/chrome/browser/ui/panels/panel_host.cc index 429f3fe..fb13e4c5 100644 --- a/chrome/browser/ui/panels/panel_host.cc +++ b/chrome/browser/ui/panels/panel_host.cc @@ -49,9 +49,9 @@ void PanelHost::Init(const GURL& url) { if (url.is_empty()) return; - web_contents_.reset(content::WebContents::Create( - profile_, content::SiteInstance::CreateForURL(profile_, url), - MSG_ROUTING_NONE, NULL)); + content::WebContents::CreateParams create_params( + profile_, content::SiteInstance::CreateForURL(profile_, url)); + web_contents_.reset(content::WebContents::Create(create_params)); chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_PANEL); web_contents_->SetDelegate(this); content::WebContentsObserver::Observe(web_contents_.get()); diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index cc7161e..2efffc5 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -95,12 +95,6 @@ #include "ui/gfx/rect.h" #include "ui/gfx/screen.h" -#if defined(USE_ASH) -#include "ash/launcher/launcher_types.h" -#include "ash/shell.h" -#include "ui/aura/window.h" -#endif - #if defined(OS_MACOSX) #include "base/mac/mac_util.h" #include "chrome/browser/ui/cocoa/keystone_infobar_delegate.h" @@ -806,20 +800,6 @@ Browser* StartupBrowserCreatorImpl::OpenTabsInBrowser(Browser* browser, #endif } -#if defined(OS_CHROMEOS) - if (ash::Shell::HasInstance()) { - // Set the browser's root window to be an active root window now so - // that that web contents can determine correct scale factor for the - // renderer. This is a short term fix for crbug.com/155201. Without - // this, the renderer may use wrong scale factor first, then - // switched to the correct scale factor, which can cause race - // condition and lead to the results rendered at wrong scale factor. - // Long term fix is tracked in crbug.com/155443. - ash::Shell::GetInstance()->set_active_root_window( - browser->window()->GetNativeWindow()->GetRootWindow()); - } -#endif - // In kiosk mode, we want to always be fullscreen, so switch to that now. if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode)) chrome::ToggleFullscreenMode(browser); @@ -1048,4 +1028,3 @@ bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( return false; } #endif - diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc index 1c11ab6c..349f5ad 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.cc +++ b/chrome/browser/ui/tabs/tab_strip_model.cc @@ -173,10 +173,7 @@ WebContents* TabStripModel::DiscardWebContentsAt(int index) { return NULL; WebContents* null_contents = - WebContents::Create(profile(), - NULL /* site_instance */, - MSG_ROUTING_NONE, - NULL /* base_web_contents */); + WebContents::Create(WebContents::CreateParams(profile())); WebContents* old_contents = GetWebContentsAtImpl(index); // Copy over the state from the navigation controller so we preserve the // back/forward history and continue to display the correct title/favicon. diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index aa4828b..7b042f9 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc @@ -114,15 +114,13 @@ class TabStripModelTest : public ChromeRenderViewHostTestHarness { } WebContents* CreateWebContents() { - return WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL); + return WebContents::Create(WebContents::CreateParams(profile())); } WebContents* CreateWebContentsWithSharedRPH(WebContents* web_contents) { - WebContents* retval = WebContents::Create( - profile(), - web_contents->GetRenderViewHost()->GetSiteInstance(), - MSG_ROUTING_NONE, - NULL); + WebContents::CreateParams create_params( + profile(), web_contents->GetRenderViewHost()->GetSiteInstance()); + WebContents* retval = WebContents::Create(create_params); EXPECT_EQ(retval->GetRenderProcessHost(), web_contents->GetRenderProcessHost()); return retval; diff --git a/chrome/browser/ui/views/constrained_window_views_browsertest.cc b/chrome/browser/ui/views/constrained_window_views_browsertest.cc index 4b33fe5..110aa59 100644 --- a/chrome/browser/ui/views/constrained_window_views_browsertest.cc +++ b/chrome/browser/ui/views/constrained_window_views_browsertest.cc @@ -230,7 +230,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, TabSwitchTest) { // Open a new tab. The constrained window should hide itself. browser()->tab_strip_model()->AppendWebContents( content::WebContents::Create( - browser()->profile(), NULL, MSG_ROUTING_NONE, NULL), + content::WebContents::CreateParams(browser()->profile())), true); EXPECT_FALSE(window->IsVisible()); diff --git a/chrome/browser/ui/views/external_tab_container_win.cc b/chrome/browser/ui/views/external_tab_container_win.cc index 8533731..6cd4b69 100644 --- a/chrome/browser/ui/views/external_tab_container_win.cc +++ b/chrome/browser/ui/views/external_tab_container_win.cc @@ -195,8 +195,7 @@ bool ExternalTabContainerWin::Init(Profile* profile, if (existing_contents) { existing_contents->GetController().SetBrowserContext(profile); } else { - existing_contents = - WebContents::Create(profile, NULL, MSG_ROUTING_NONE, NULL); + existing_contents = WebContents::Create(WebContents::CreateParams(profile)); existing_contents->GetRenderViewHost()->AllowBindings( content::BINDINGS_POLICY_EXTERNAL_HOST); } diff --git a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc index ae5fd22..d574cba 100644 --- a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc +++ b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc @@ -30,7 +30,7 @@ ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase( release_contents_on_close_(false) { CHECK(delegate); web_contents_.reset( - WebContents::Create(browser_context, NULL, MSG_ROUTING_NONE, NULL)); + WebContents::Create(WebContents::CreateParams(browser_context))); if (tab_delegate) { override_tab_delegate_.reset(tab_delegate); web_contents_->SetDelegate(tab_delegate); |