diff options
author | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 15:38:57 +0000 |
---|---|---|
committer | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-03 15:38:57 +0000 |
commit | 7a23d81958a00cbfd11ca17d6cc17abe20950364 (patch) | |
tree | 7b6ac8ad0f3524fcb03e2c69e692a8b758b28cf6 /chrome/browser/ssl | |
parent | 0a9ae818d22d4f5630f94e2d10a724dc625d2f8d (diff) | |
download | chromium_src-7a23d81958a00cbfd11ca17d6cc17abe20950364.zip chromium_src-7a23d81958a00cbfd11ca17d6cc17abe20950364.tar.gz chromium_src-7a23d81958a00cbfd11ca17d6cc17abe20950364.tar.bz2 |
Revert 238283 "Infobar system refactor."
Crashes on android
BUG=325216
> Infobar system refactor.
>
> This changes the ownership model of infobars so that InfoBars are long-lived and
> own their InfoBarDelegates directly. The InfoBarService pseudo-owns the
> InfoBars (instead of deleting them directly, it tells them when they're unowned
> and expects them to delete themselves).
>
> This fixes leaks when infobars are closed while not visible (e.g. in a
> background tab) and in general makes the system clearer and easier to reason
> about.
>
> BUG=62154
> TEST=none
> R=erg@chromium.org, sail@chromium.org, sky@chromium.org
>
> Review URL: https://codereview.chromium.org/22694006
TBR=pkasting@chromium.org
Review URL: https://codereview.chromium.org/102163002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238402 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ssl')
-rw-r--r-- | chrome/browser/ssl/ssl_tab_helper.cc | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/chrome/browser/ssl/ssl_tab_helper.cc b/chrome/browser/ssl/ssl_tab_helper.cc index 1048e3c..ece2ea6 100644 --- a/chrome/browser/ssl/ssl_tab_helper.cc +++ b/chrome/browser/ssl/ssl_tab_helper.cc @@ -42,17 +42,18 @@ namespace { class SSLCertResultInfoBarDelegate : public ConfirmInfoBarDelegate { public: - // Creates an SSL cert result infobar and delegate. If |previous_infobar| is + // Creates an SSL cert result infobar delegate. If |previous_infobar| is // NULL, adds the infobar to |infobar_service|; otherwise, replaces // |previous_infobar|. Returns the new infobar if it was successfully added. // |cert| is valid iff cert addition was successful. - static InfoBar* Create(InfoBarService* infobar_service, - InfoBar* previous_infobar, - const string16& message, - net::X509Certificate* cert); + static InfoBarDelegate* Create(InfoBarService* infobar_service, + InfoBarDelegate* previous_infobar, + const string16& message, + net::X509Certificate* cert); private: - SSLCertResultInfoBarDelegate(const string16& message, + SSLCertResultInfoBarDelegate(InfoBarService* infobar_service, + const string16& message, net::X509Certificate* cert); virtual ~SSLCertResultInfoBarDelegate(); @@ -71,22 +72,23 @@ class SSLCertResultInfoBarDelegate : public ConfirmInfoBarDelegate { }; // static -InfoBar* SSLCertResultInfoBarDelegate::Create(InfoBarService* infobar_service, - InfoBar* previous_infobar, - const string16& message, - net::X509Certificate* cert) { - scoped_ptr<InfoBar> infobar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr<ConfirmInfoBarDelegate>( - new SSLCertResultInfoBarDelegate(message, cert)))); +InfoBarDelegate* SSLCertResultInfoBarDelegate::Create( + InfoBarService* infobar_service, + InfoBarDelegate* previous_infobar, + const string16& message, + net::X509Certificate* cert) { + scoped_ptr<InfoBarDelegate> infobar( + new SSLCertResultInfoBarDelegate(infobar_service, message, cert)); return previous_infobar ? infobar_service->ReplaceInfoBar(previous_infobar, infobar.Pass()) : infobar_service->AddInfoBar(infobar.Pass()); } SSLCertResultInfoBarDelegate::SSLCertResultInfoBarDelegate( + InfoBarService* infobar_service, const string16& message, net::X509Certificate* cert) - : ConfirmInfoBarDelegate(), + : ConfirmInfoBarDelegate(infobar_service), message_(message), cert_(cert) { } @@ -145,7 +147,7 @@ class SSLTabHelper::SSLAddCertData const content::NotificationDetails& details) OVERRIDE; InfoBarService* infobar_service_; - InfoBar* infobar_; + InfoBarDelegate* infobar_; content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(SSLAddCertData); |