diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-20 16:34:13 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-20 16:34:13 +0000 |
commit | d715fb8034a11d163481f93d9473d968f9f2203e (patch) | |
tree | 0c162fd3de1c8b99ed887a326629cda105dfe685 /chrome/browser/geolocation | |
parent | 97826c1ca1812f98ff4a0a03be27b932e867b22c (diff) | |
download | chromium_src-d715fb8034a11d163481f93d9473d968f9f2203e.zip chromium_src-d715fb8034a11d163481f93d9473d968f9f2203e.tar.gz chromium_src-d715fb8034a11d163481f93d9473d968f9f2203e.tar.bz2 |
Introduce InfoBarTabService API.
The new interface extracts the API bits from InfoBarTabHelper. This
change switches files under chrome/browser/autofill and
chrome/browser/api to use the API and remove the temporarily-allowed
dependency on InfoBarTabHelper.
TBRing other owners as the changes are just to match the updated API and include paths.
TBR=ben@chromium.org
BUG=140037
Review URL: https://chromiumcodereview.appspot.com/10830353
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152338 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation')
3 files changed, 37 insertions, 37 deletions
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc index 5d84bef..b00bb7d 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc @@ -178,7 +178,7 @@ GeolocationConfirmInfoBarDelegate::GeolocationConfirmInfoBarDelegate( requesting_frame_url_(requesting_frame_url), display_languages_(display_languages) { const NavigationEntry* committed_entry = - infobar_helper->web_contents()->GetController().GetLastCommittedEntry(); + infobar_helper->GetWebContents()->GetController().GetLastCommittedEntry(); set_contents_unique_id(committed_entry ? committed_entry->GetUniqueID() : 0); } @@ -205,13 +205,13 @@ string16 GeolocationConfirmInfoBarDelegate::GetButtonLabel( bool GeolocationConfirmInfoBarDelegate::Accept() { controller_->OnPermissionSet(render_process_id_, render_view_id_, bridge_id_, - requesting_frame_url_, owner()->web_contents()->GetURL(), true); + requesting_frame_url_, owner()->GetWebContents()->GetURL(), true); return true; } bool GeolocationConfirmInfoBarDelegate::Cancel() { controller_->OnPermissionSet(render_process_id_, render_view_id_, bridge_id_, - requesting_frame_url_, owner()->web_contents()->GetURL(), + requesting_frame_url_, owner()->GetWebContents()->GetURL(), false); return true; } @@ -234,7 +234,7 @@ bool GeolocationConfirmInfoBarDelegate::LinkClicked( Referrer(), (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, content::PAGE_TRANSITION_LINK, false); - owner()->web_contents()->OpenURL(params); + owner()->GetWebContents()->OpenURL(params); return false; // Do not dismiss the info bar. } diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc index 0782b87..4de4787 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc @@ -260,10 +260,10 @@ void GeolocationPermissionContextTests::TearDown() { TEST_F(GeolocationPermissionContextTests, SinglePermission) { GURL requesting_frame("http://www.example.com/geolocation"); NavigateAndCommit(requesting_frame); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); RequestGeolocationPermission( process_id(), render_id(), bridge_id(), requesting_frame); - ASSERT_EQ(1U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, infobar_tab_helper()->GetInfoBarCount()); ConfirmInfoBarDelegate* infobar_0 = infobar_tab_helper()-> GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); infobar_0->Cancel(); @@ -283,18 +283,18 @@ TEST_F(GeolocationPermissionContextTests, GeolocationEnabledDisabled) { // even though the default policy allows it. GURL requesting_frame("http://www.example.com/geolocation"); NavigateAndCommit(requesting_frame); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); profile()->GetPrefs()->SetBoolean(prefs::kGeolocationEnabled, false); RequestGeolocationPermission( process_id(), render_id(), bridge_id(), requesting_frame); - ASSERT_EQ(0U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); CheckPermissionMessageSent(bridge_id(), false); // Reenable the preference and check that the request now goes though. profile()->GetPrefs()->SetBoolean(prefs::kGeolocationEnabled, true); RequestGeolocationPermission( process_id(), render_id(), bridge_id() + 1, requesting_frame); - ASSERT_EQ(0U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); CheckPermissionMessageSent(bridge_id() + 1, true); } #endif @@ -317,14 +317,14 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) { NavigateAndCommit(requesting_frame_0); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); // Request permission for two frames. RequestGeolocationPermission( process_id(), render_id(), bridge_id(), requesting_frame_0); RequestGeolocationPermission( process_id(), render_id(), bridge_id() + 1, requesting_frame_1); // Ensure only one infobar is created. - ASSERT_EQ(1U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, infobar_tab_helper()->GetInfoBarCount()); ConfirmInfoBarDelegate* infobar_0 = infobar_tab_helper()-> GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); ASSERT_TRUE(infobar_0); @@ -341,7 +341,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) { closed_delegate_tracker_.Clear(); infobar_0->InfoBarClosed(); // Now we should have a new infobar for the second frame. - ASSERT_EQ(1U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, infobar_tab_helper()->GetInfoBarCount()); ConfirmInfoBarDelegate* infobar_1 = infobar_tab_helper()-> GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); @@ -357,7 +357,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) { EXPECT_EQ(1U, closed_delegate_tracker_.size()); EXPECT_TRUE(closed_delegate_tracker_.Contains(infobar_1)); infobar_1->InfoBarClosed(); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); // Ensure the persisted permissions are ok. EXPECT_EQ(CONTENT_SETTING_ALLOW, profile()->GetHostContentSettingsMap()->GetContentSetting( @@ -393,13 +393,13 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) { NavigateAndCommit(requesting_frame_0); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); // Request permission for two frames. RequestGeolocationPermission( process_id(), render_id(), bridge_id(), requesting_frame_0); RequestGeolocationPermission( process_id(), render_id(), bridge_id() + 1, requesting_frame_1); - ASSERT_EQ(1U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, infobar_tab_helper()->GetInfoBarCount()); ConfirmInfoBarDelegate* infobar_0 = infobar_tab_helper()-> GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); @@ -414,7 +414,7 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) { EXPECT_TRUE(closed_delegate_tracker_.Contains(infobar_0)); closed_delegate_tracker_.Clear(); infobar_0->InfoBarClosed(); - ASSERT_EQ(1U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, infobar_tab_helper()->GetInfoBarCount()); ConfirmInfoBarDelegate* infobar_1 = infobar_tab_helper()-> GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); @@ -430,7 +430,7 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) { EXPECT_EQ(1U, closed_delegate_tracker_.size()); EXPECT_TRUE(closed_delegate_tracker_.Contains(infobar_1)); infobar_1->InfoBarClosed(); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); // Ensure the persisted permissions are ok. EXPECT_EQ(CONTENT_SETTING_ASK, profile()->GetHostContentSettingsMap()->GetContentSetting( @@ -451,10 +451,10 @@ TEST_F(GeolocationPermissionContextTests, InvalidURL) { GURL invalid_embedder("about:blank"); GURL requesting_frame; NavigateAndCommit(invalid_embedder); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); RequestGeolocationPermission( process_id(), render_id(), bridge_id(), requesting_frame); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); CheckPermissionMessageSent(bridge_id(), false); } @@ -465,18 +465,18 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) { AddNewTab(url_b); AddNewTab(url_a); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); RequestGeolocationPermission( process_id(), render_id(), bridge_id(), url_a); - ASSERT_EQ(1U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, infobar_tab_helper()->GetInfoBarCount()); RequestGeolocationPermission( process_id_for_tab(0), render_id_for_tab(0), bridge_id(), url_b); - EXPECT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->infobar_count()); + EXPECT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->GetInfoBarCount()); RequestGeolocationPermission( process_id_for_tab(1), render_id_for_tab(1), bridge_id(), url_a); - ASSERT_EQ(1U, extra_tabs_[1]->infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, extra_tabs_[1]->infobar_tab_helper()->GetInfoBarCount()); ConfirmInfoBarDelegate* removed_infobar = extra_tabs_[1]-> infobar_tab_helper()->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); @@ -492,7 +492,7 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) { EXPECT_TRUE(closed_delegate_tracker_.Contains(infobar_0)); infobar_0->InfoBarClosed(); // Now the infobar for the tab with the same origin should have gone. - EXPECT_EQ(0U, extra_tabs_[1]->infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, extra_tabs_[1]->infobar_tab_helper()->GetInfoBarCount()); CheckPermissionMessageSentForTab(1, bridge_id(), true); EXPECT_TRUE(closed_delegate_tracker_.Contains(removed_infobar)); closed_delegate_tracker_.Clear(); @@ -500,7 +500,7 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) { removed_infobar->InfoBarClosed(); // But the other tab should still have the info bar... - ASSERT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->GetInfoBarCount()); ConfirmInfoBarDelegate* infobar_1 = extra_tabs_[0]->infobar_tab_helper()-> GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); infobar_1->Cancel(); @@ -516,18 +516,18 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) { NavigateAndCommit(url_a); AddNewTab(url_a); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); RequestGeolocationPermission( process_id(), render_id(), bridge_id(), url_a); - ASSERT_EQ(1U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, infobar_tab_helper()->GetInfoBarCount()); RequestGeolocationPermission( process_id_for_tab(0), render_id_for_tab(0), bridge_id(), url_a); - EXPECT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->infobar_count()); + EXPECT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->GetInfoBarCount()); RequestGeolocationPermission( process_id_for_tab(0), render_id_for_tab(0), bridge_id() + 1, url_b); - ASSERT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->GetInfoBarCount()); ConfirmInfoBarDelegate* removed_infobar = infobar_tab_helper()->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); @@ -543,7 +543,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) { EXPECT_TRUE(closed_delegate_tracker_.Contains(infobar_0)); infobar_0->InfoBarClosed(); // Now the infobar for the tab with the same origin should have gone. - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); CheckPermissionMessageSent(bridge_id(), true); EXPECT_TRUE(closed_delegate_tracker_.Contains(removed_infobar)); closed_delegate_tracker_.Clear(); @@ -551,7 +551,7 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) { removed_infobar->InfoBarClosed(); // And we should have the queued infobar displayed now. - ASSERT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, extra_tabs_[0]->infobar_tab_helper()->GetInfoBarCount()); // Accept the second infobar. ConfirmInfoBarDelegate* infobar_1 = extra_tabs_[0]->infobar_tab_helper()-> @@ -585,14 +585,14 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) { std::string())); NavigateAndCommit(requesting_frame_0); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); // Request permission for two frames. RequestGeolocationPermission( process_id(), render_id(), bridge_id(), requesting_frame_0); RequestGeolocationPermission( process_id(), render_id(), bridge_id() + 1, requesting_frame_1); // Ensure only one infobar is created. - ASSERT_EQ(1U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, infobar_tab_helper()->GetInfoBarCount()); ConfirmInfoBarDelegate* infobar_0 = infobar_tab_helper()-> GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate(); ASSERT_TRUE(infobar_0); @@ -617,7 +617,7 @@ TEST_F(GeolocationPermissionContextTests, InfoBarUsesCommittedEntry) { GURL requesting_frame_1("http://www.example-2.com/geolocation"); NavigateAndCommit(requesting_frame_0); NavigateAndCommit(requesting_frame_1); - EXPECT_EQ(0U, infobar_tab_helper()->infobar_count()); + EXPECT_EQ(0U, infobar_tab_helper()->GetInfoBarCount()); // Go back: navigate to a pending entry before requesting geolocation // permission. contents()->GetController().GoBack(); @@ -625,7 +625,7 @@ TEST_F(GeolocationPermissionContextTests, InfoBarUsesCommittedEntry) { RequestGeolocationPermission( process_id(), render_id(), bridge_id(), requesting_frame_1); // Ensure the infobar is created. - ASSERT_EQ(1U, infobar_tab_helper()->infobar_count()); + ASSERT_EQ(1U, infobar_tab_helper()->GetInfoBarCount()); InfoBarDelegate* infobar_0 = infobar_tab_helper()->GetInfoBarDelegateAt(0); ASSERT_TRUE(infobar_0); // Ensure the infobar is not yet expired. diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index 7edf812..8022e64 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -568,10 +568,10 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, InfoBarTabHelper* infobar_helper = chrome::GetActiveTabContents(current_browser_)->infobar_tab_helper(); - size_t num_infobars_before_cancel = infobar_helper->infobar_count(); + size_t num_infobars_before_cancel = infobar_helper->GetInfoBarCount(); // Change the iframe, and ensure the infobar is gone. IFrameLoader change_iframe_1(current_browser_, 1, current_url_); - size_t num_infobars_after_cancel = infobar_helper->infobar_count(); + size_t num_infobars_after_cancel = infobar_helper->GetInfoBarCount(); EXPECT_EQ(num_infobars_before_cancel, num_infobars_after_cancel + 1); } |