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

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

Issue 7635019: Set Extension Infobars to have a fixed height determined by the developer (clamped to sane min an... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months 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 96544)
+++ chrome/browser/extensions/extension_infobar_delegate.cc (working copy)
@@ -7,6 +7,7 @@
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/tab_contents/infobar.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
@@ -16,7 +17,8 @@
ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(Browser* browser,
TabContents* tab_contents,
const Extension* extension,
- const GURL& url)
+ const GURL& url,
+ int height)
: InfoBarDelegate(tab_contents),
observer_(NULL),
extension_(extension),
@@ -30,6 +32,18 @@
Source<Profile>(browser->profile()));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
Source<Profile>(browser->profile()));
+
+#if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK)
+ 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_);
+ if (height_ == 0)
+ height_ = default_height;
}
ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() {

Powered by Google App Engine
This is Rietveld 408576698