From c1b4622fe8c4dcd7114d4717323a85a26869cb40 Mon Sep 17 00:00:00 2001 From: "droger@chromium.org" Date: Tue, 1 Apr 2014 11:44:03 +0000 Subject: Split InfoBarService core code into InfoBarManager InfoBarService is now responsible for associating an InfoBarManager to a Tab and handling the interactions with the rest of chrome (notifications, navigation events). InfoBarManager has the core logic for infobar management. It owns the list of infobars. Eventually InfoBarManager will no longer rely on content/, but for now it still has a reference to a WebContents instance. This reference was kept for now to minimize the size of the change, but will be removed in a future CL. BUG=354379 TBR=jochen Review URL: https://codereview.chromium.org/211273007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260847 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/media/chrome_media_stream_infobar_browsertest.cc | 7 ++++--- chrome/browser/media/media_stream_infobar_delegate.cc | 6 ++++-- chrome/browser/media/webrtc_browsertest_base.cc | 7 ++++--- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'chrome/browser/media') diff --git a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc index b3ac70a..d4e7865 100644 --- a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc +++ b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc @@ -9,6 +9,7 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/infobars/infobar.h" +#include "chrome/browser/infobars/infobar_manager.h" #include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/media/webrtc_browsertest_base.h" #include "chrome/browser/media/webrtc_browsertest_common.h" @@ -122,9 +123,9 @@ IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest, EXPECT_TRUE(test::PollingWaitUntil("obtainGetUserMediaResult()", kFailedWithPermissionDeniedError, tab_contents)); - InfoBarService* infobar_service = - InfoBarService::FromWebContents(tab_contents); - EXPECT_EQ(0u, infobar_service->infobar_count()); + InfoBarManager* infobar_manager = + InfoBarService::FromWebContents(tab_contents)->infobar_manager(); + EXPECT_EQ(0u, infobar_manager->infobar_count()); } // Failing on Win Aura, so disabling on that. diff --git a/chrome/browser/media/media_stream_infobar_delegate.cc b/chrome/browser/media/media_stream_infobar_delegate.cc index f3059d5..35965c6 100644 --- a/chrome/browser/media/media_stream_infobar_delegate.cc +++ b/chrome/browser/media/media_stream_infobar_delegate.cc @@ -9,6 +9,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/google/google_util.h" #include "chrome/browser/infobars/infobar.h" +#include "chrome/browser/infobars/infobar_manager.h" #include "chrome/browser/infobars/infobar_service.h" #include "chrome/common/url_constants.h" #include "content/public/browser/web_contents.h" @@ -54,8 +55,9 @@ bool MediaStreamInfoBarDelegate::Create( scoped_ptr infobar(ConfirmInfoBarDelegate::CreateInfoBar( scoped_ptr( new MediaStreamInfoBarDelegate(controller.Pass())))); - for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { - InfoBar* old_infobar = infobar_service->infobar_at(i); + InfoBarManager* infobar_manager = infobar_service->infobar_manager(); + for (size_t i = 0; i < infobar_manager->infobar_count(); ++i) { + InfoBar* old_infobar = infobar_manager->infobar_at(i); if (old_infobar->delegate()->AsMediaStreamInfoBarDelegate()) { infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass()); return true; diff --git a/chrome/browser/media/webrtc_browsertest_base.cc b/chrome/browser/media/webrtc_browsertest_base.cc index fafaacc..294c18f 100644 --- a/chrome/browser/media/webrtc_browsertest_base.cc +++ b/chrome/browser/media/webrtc_browsertest_base.cc @@ -8,6 +8,7 @@ #include "base/strings/stringprintf.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/infobars/infobar.h" +#include "chrome/browser/infobars/infobar_manager.h" #include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/media/media_stream_infobar_delegate.h" #include "chrome/browser/media/webrtc_browsertest_common.h" @@ -208,9 +209,9 @@ void WebRtcTestBase::CloseInfoBarInTab( chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, content::NotificationService::AllSources()); - InfoBarService* infobar_service = - InfoBarService::FromWebContents(tab_contents); - infobar_service->RemoveInfoBar(infobar); + InfoBarManager* infobar_manager = + InfoBarService::FromWebContents(tab_contents)->infobar_manager(); + infobar_manager->RemoveInfoBar(infobar); infobar_removed.Wait(); } -- cgit v1.1