| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 5 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 close_button_->SetIcon(gfx::VectorIconId::BAR_CLOSE); | 174 close_button_->SetIcon(gfx::VectorIconId::BAR_CLOSE); |
| 175 close_button_->SetAccessibleName( | 175 close_button_->SetAccessibleName( |
| 176 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 176 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 177 close_button_->SetFocusForPlatform(); | 177 close_button_->SetFocusForPlatform(); |
| 178 // Subclasses should already be done adding child views by this point (see | 178 // Subclasses should already be done adding child views by this point (see |
| 179 // related DCHECK in Layout()). | 179 // related DCHECK in Layout()). |
| 180 child_container_->AddChildView(close_button_); | 180 child_container_->AddChildView(close_button_); |
| 181 } | 181 } |
| 182 | 182 |
| 183 // Ensure the infobar is tall enough to display its contents. | 183 // Ensure the infobar is tall enough to display its contents. |
| 184 int height = InfoBarContainerDelegate::kDefaultBarTargetHeight; | 184 int height = InfoBarContainerDelegate::kDefaultBarTargetHeightMd; |
| 185 const int kMinimumVerticalPadding = 6; | 185 const int kMinimumVerticalPadding = 6; |
| 186 for (int i = 0; i < child_container_->child_count(); ++i) { | 186 for (int i = 0; i < child_container_->child_count(); ++i) { |
| 187 const int child_height = child_container_->child_at(i)->height(); | 187 const int child_height = child_container_->child_at(i)->height(); |
| 188 height = std::max(height, child_height + kMinimumVerticalPadding); | 188 height = std::max(height, child_height + kMinimumVerticalPadding); |
| 189 } | 189 } |
| 190 SetBarTargetHeight(height); | 190 SetBarTargetHeight(height); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void InfoBarView::ButtonPressed(views::Button* sender, | 193 void InfoBarView::ButtonPressed(views::Button* sender, |
| 194 const ui::Event& event) { | 194 const ui::Event& event) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 307 } |
| 308 | 308 |
| 309 bool InfoBarView::DoesIntersectRect(const View* target, | 309 bool InfoBarView::DoesIntersectRect(const View* target, |
| 310 const gfx::Rect& rect) const { | 310 const gfx::Rect& rect) const { |
| 311 DCHECK_EQ(this, target); | 311 DCHECK_EQ(this, target); |
| 312 // Only events that intersect the portion below the arrow are interesting. | 312 // Only events that intersect the portion below the arrow are interesting. |
| 313 gfx::Rect non_arrow_bounds = GetLocalBounds(); | 313 gfx::Rect non_arrow_bounds = GetLocalBounds(); |
| 314 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); | 314 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); |
| 315 return rect.Intersects(non_arrow_bounds); | 315 return rect.Intersects(non_arrow_bounds); |
| 316 } | 316 } |
| OLD | NEW |