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

Unified Diff: chrome/browser/ui/views/infobars/infobar_view.cc

Issue 793783003: Move infobar constants and the code that uses them from components/ to chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NULL -> nullptr Created 6 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/ui/views/infobars/infobar_view.cc
diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc
index fc620e9997c2fe8f49ea55967ffc09ece30e3f84..f651a8d69378616001ae421f0caa1bb00e841991 100644
--- a/chrome/browser/ui/views/infobars/infobar_view.cc
+++ b/chrome/browser/ui/views/infobars/infobar_view.cc
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/ui/infobar_container_delegate.h"
#include "chrome/browser/ui/views/infobars/infobar_background.h"
#include "chrome/grit/generated_resources.h"
#include "components/infobars/core/infobar_delegate.h"
@@ -48,18 +49,6 @@ bool SortLabelsByDecreasingWidth(views::Label* label_1, views::Label* label_2) {
} // namespace
-// InfoBar --------------------------------------------------------------------
-
-// static
-const int infobars::InfoBar::kSeparatorLineHeight =
- views::NonClientFrameView::kClientEdgeThickness;
-const int infobars::InfoBar::kDefaultArrowTargetHeight = 9;
-const int infobars::InfoBar::kMaximumArrowTargetHeight = 24;
-const int infobars::InfoBar::kDefaultArrowTargetHalfWidth =
- kDefaultArrowTargetHeight;
-const int infobars::InfoBar::kMaximumArrowTargetHalfWidth = 14;
-const int infobars::InfoBar::kDefaultBarTargetHeight = 36;
-
// InfoBarView ----------------------------------------------------------------
// static
@@ -154,10 +143,11 @@ void InfoBarView::Layout() {
static_cast<InfoBarBackground*>(background())->set_separator_color(
delegate->GetInfoBarSeparatorColor());
int arrow_x;
- SkScalar arrow_fill_height =
- SkIntToScalar(std::max(arrow_height() - kSeparatorLineHeight, 0));
+ SkScalar arrow_fill_height = SkIntToScalar(std::max(
+ arrow_height() - InfoBarContainerDelegate::kSeparatorLineHeight, 0));
SkScalar arrow_fill_half_width = SkIntToScalar(arrow_half_width());
- SkScalar separator_height = SkIntToScalar(kSeparatorLineHeight);
+ SkScalar separator_height =
+ SkIntToScalar(InfoBarContainerDelegate::kSeparatorLineHeight);
if (delegate->DrawInfoBarArrows(&arrow_x) && arrow_fill_height) {
// Skia pixel centers are at the half-values, so the arrow is horizontally
// centered at |arrow_x| + 0.5. Vertically, the stroke path is the center
@@ -184,8 +174,10 @@ void InfoBarView::Layout() {
}
}
if (bar_height()) {
- fill_path_.addRect(0.0, SkIntToScalar(arrow_height()),
- SkIntToScalar(width()), SkIntToScalar(height() - kSeparatorLineHeight));
+ fill_path_.addRect(
+ 0.0, SkIntToScalar(arrow_height()), SkIntToScalar(width()),
+ SkIntToScalar(
+ height() - InfoBarContainerDelegate::kSeparatorLineHeight));
}
int start_x = kEdgeItemPadding;
@@ -239,7 +231,7 @@ void InfoBarView::ViewHierarchyChanged(
// Ensure the infobar is tall enough to display its contents.
const int kMinimumVerticalPadding = 6;
- int height = kDefaultBarTargetHeight;
+ int height = InfoBarContainerDelegate::kDefaultBarTargetHeight;
for (int i = 0; i < child_count(); ++i) {
const int child_height = child_at(i)->height();
height = std::max(height, child_height + kMinimumVerticalPadding);

Powered by Google App Engine
This is Rietveld 408576698