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

Unified Diff: trunk/src/chrome/browser/extensions/extension_infobar_delegate.cc

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/extensions/extension_infobar_delegate.cc
===================================================================
--- trunk/src/chrome/browser/extensions/extension_infobar_delegate.cc (revision 238401)
+++ trunk/src/chrome/browser/extensions/extension_infobar_delegate.cc (working copy)
@@ -16,6 +16,8 @@
#include "extensions/common/extension.h"
ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() {
+ if (observer_)
+ observer_->OnDelegateDeleted();
}
// static
@@ -24,21 +26,23 @@
const extensions::Extension* extension,
const GURL& url,
int height) {
- infobar_service->AddInfoBar(ExtensionInfoBarDelegate::CreateInfoBar(
- scoped_ptr<ExtensionInfoBarDelegate>(new ExtensionInfoBarDelegate(
- browser, extension, url, infobar_service->web_contents(), height))));
+ infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
+ new ExtensionInfoBarDelegate(browser, infobar_service, extension, url,
+ infobar_service->web_contents(), height)));
}
ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(
Browser* browser,
+ InfoBarService* infobar_service,
const extensions::Extension* extension,
const GURL& url,
content::WebContents* web_contents,
int height)
- : InfoBarDelegate(),
+ : InfoBarDelegate(infobar_service),
#if defined(TOOLKIT_VIEWS)
browser_(browser),
#endif
+ observer_(NULL),
extension_(extension),
closing_(false) {
extension_view_host_.reset(
@@ -50,15 +54,21 @@
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
content::Source<Profile>(browser->profile()));
+#if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK) || defined(OS_ANDROID)
+ // TODO(dtrainor): On Android, this is not used. Might need to pull this from
+ // Android UI level in the future. Tracked via issue 115303.
+ int default_height = InfoBar::kDefaultBarTargetHeight;
+#elif defined(OS_MACOSX)
+ // TODO(pkasting): Once Infobars have been ported to Mac, we can remove the
+ // ifdefs and just use the Infobar constant below.
+ int default_height = 36;
+#endif
height_ = std::max(0, height);
- height_ = std::min(2 * InfoBar::kDefaultBarTargetHeight, height_);
+ height_ = std::min(2 * default_height, height_);
if (height_ == 0)
- height_ = InfoBar::kDefaultBarTargetHeight;
+ height_ = default_height;
}
-// ExtensionInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
-// files.
-
bool ExtensionInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
ExtensionInfoBarDelegate* extension_delegate =
delegate->AsExtensionInfoBarDelegate();
@@ -95,11 +105,11 @@
if (type == chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE) {
if (extension_view_host_.get() ==
content::Details<extensions::ExtensionHost>(details).ptr())
- infobar()->RemoveSelf();
+ RemoveSelf();
} else {
DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED);
if (extension_ == content::Details<extensions::UnloadedExtensionInfo>(
details)->extension)
- infobar()->RemoveSelf();
+ RemoveSelf();
}
}

Powered by Google App Engine
This is Rietveld 408576698