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

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

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
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: chrome/browser/extensions/extension_infobar_delegate.cc
===================================================================
--- chrome/browser/extensions/extension_infobar_delegate.cc (revision 238220)
+++ chrome/browser/extensions/extension_infobar_delegate.cc (working copy)
@@ -16,8 +16,6 @@
#include "extensions/common/extension.h"
ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() {
- if (observer_)
- observer_->OnDelegateDeleted();
}
// static
@@ -26,23 +24,21 @@
const extensions::Extension* extension,
const GURL& url,
int height) {
- infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
- new ExtensionInfoBarDelegate(browser, infobar_service, extension, url,
- infobar_service->web_contents(), height)));
+ infobar_service->AddInfoBar(ExtensionInfoBarDelegate::CreateInfoBar(
+ scoped_ptr<ExtensionInfoBarDelegate>(new ExtensionInfoBarDelegate(
+ browser, 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(infobar_service),
+ : InfoBarDelegate(),
#if defined(TOOLKIT_VIEWS)
browser_(browser),
#endif
- observer_(NULL),
extension_(extension),
closing_(false) {
extension_view_host_.reset(
@@ -54,21 +50,15 @@
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 * default_height, height_);
+ height_ = std::min(2 * InfoBar::kDefaultBarTargetHeight, height_);
if (height_ == 0)
- height_ = default_height;
+ height_ = InfoBar::kDefaultBarTargetHeight;
}
+// ExtensionInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
+// files.
+
bool ExtensionInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
ExtensionInfoBarDelegate* extension_delegate =
delegate->AsExtensionInfoBarDelegate();
@@ -105,11 +95,11 @@
if (type == chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE) {
if (extension_view_host_.get() ==
content::Details<extensions::ExtensionHost>(details).ptr())
- RemoveSelf();
+ infobar()->RemoveSelf();
} else {
DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED);
if (extension_ == content::Details<extensions::UnloadedExtensionInfo>(
details)->extension)
- RemoveSelf();
+ infobar()->RemoveSelf();
}
}
« no previous file with comments | « chrome/browser/extensions/extension_infobar_delegate.h ('k') | chrome/browser/extensions/extension_install_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698