| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 close_button_ = close; | 267 close_button_ = close; |
| 268 } else { | 268 } else { |
| 269 close_button_ = new views::ImageButton(this); | 269 close_button_ = new views::ImageButton(this); |
| 270 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 270 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 271 close_button_->SetImage(views::CustomButton::STATE_NORMAL, | 271 close_button_->SetImage(views::CustomButton::STATE_NORMAL, |
| 272 rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia()); | 272 rb.GetImageNamed(IDR_CLOSE_1).ToImageSkia()); |
| 273 close_button_->SetImage(views::CustomButton::STATE_HOVERED, | 273 close_button_->SetImage(views::CustomButton::STATE_HOVERED, |
| 274 rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia()); | 274 rb.GetImageNamed(IDR_CLOSE_1_H).ToImageSkia()); |
| 275 close_button_->SetImage(views::CustomButton::STATE_PRESSED, | 275 close_button_->SetImage(views::CustomButton::STATE_PRESSED, |
| 276 rb.GetImageNamed(IDR_CLOSE_1_P).ToImageSkia()); | 276 rb.GetImageNamed(IDR_CLOSE_1_P).ToImageSkia()); |
| 277 close_button_->SizeToPreferredSize(); |
| 277 } | 278 } |
| 278 close_button_->SizeToPreferredSize(); | |
| 279 close_button_->SetAccessibleName( | 279 close_button_->SetAccessibleName( |
| 280 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 280 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 281 close_button_->SetFocusable(true); | 281 close_button_->SetFocusable(true); |
| 282 // Subclasses should already be done adding child views by this point (see | 282 // Subclasses should already be done adding child views by this point (see |
| 283 // related DCHECK in Layout()). | 283 // related DCHECK in Layout()). |
| 284 child_container_->AddChildView(close_button_); | 284 child_container_->AddChildView(close_button_); |
| 285 } | 285 } |
| 286 | 286 |
| 287 // Ensure the infobar is tall enough to display its contents. | 287 // Ensure the infobar is tall enough to display its contents. |
| 288 int height = ui::MaterialDesignController::IsModeMaterial() | 288 int height = ui::MaterialDesignController::IsModeMaterial() |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 } | 431 } |
| 432 | 432 |
| 433 bool InfoBarView::DoesIntersectRect(const View* target, | 433 bool InfoBarView::DoesIntersectRect(const View* target, |
| 434 const gfx::Rect& rect) const { | 434 const gfx::Rect& rect) const { |
| 435 DCHECK_EQ(this, target); | 435 DCHECK_EQ(this, target); |
| 436 // Only events that intersect the portion below the arrow are interesting. | 436 // Only events that intersect the portion below the arrow are interesting. |
| 437 gfx::Rect non_arrow_bounds = GetLocalBounds(); | 437 gfx::Rect non_arrow_bounds = GetLocalBounds(); |
| 438 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); | 438 non_arrow_bounds.Inset(0, arrow_height(), 0, 0); |
| 439 return rect.Intersects(non_arrow_bounds); | 439 return rect.Intersects(non_arrow_bounds); |
| 440 } | 440 } |
| OLD | NEW |