summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/infobars/infobars.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views/infobars/infobars.cc')
-rw-r--r--chrome/browser/views/infobars/infobars.cc37
1 files changed, 7 insertions, 30 deletions
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index c9b6f2e..5733d33 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -11,10 +11,8 @@
#include "chrome/common/slide_animation.h"
#include "chrome/views/background.h"
#include "chrome/views/button.h"
-#include "chrome/views/external_focus_tracker.h"
#include "chrome/views/image_view.h"
#include "chrome/views/label.h"
-#include "chrome/views/widget.h"
#include "generated_resources.h"
@@ -104,8 +102,6 @@ void InfoBar::AnimateClose() {
void InfoBar::Close() {
GetParent()->RemoveChildView(this);
- if (focus_tracker_.get())
- focus_tracker_->FocusLastFocusedExternalView();
if (delegate())
delegate()->InfoBarClosed();
delete this;
@@ -126,25 +122,6 @@ void InfoBar::Layout() {
}
-void InfoBar::ViewHierarchyChanged(bool is_add, views::View* parent,
- views::View* child) {
- if (child == this) {
- views::Widget* widget = GetWidget();
- if (is_add && widget) {
- // When we're added to a view hierarchy within a widget, we create an
- // external focus tracker to track what was focused in case we obtain
- // focus so that we can restore focus when we're removed.
- focus_tracker_.reset(
- new views::ExternalFocusTracker(this,
- views::FocusManager::GetFocusManager(widget->GetHWND())));
- } else if (focus_tracker_.get()) {
- // When we're removed from a view hierarchy, our focus manager is no
- // longer valid.
- focus_tracker_->SetFocusManager(NULL);
- }
- }
-}
-
// InfoBar, protected: ---------------------------------------------------------
int InfoBar::GetAvailableWidth() const {
@@ -222,12 +199,6 @@ ConfirmInfoBar::ConfirmInfoBar(ConfirmInfoBarDelegate* delegate)
cancel_button_(NULL),
initialized_(false),
AlertInfoBar(delegate) {
- ok_button_ = new views::NativeButton(
- delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
- ok_button_->SetListener(this);
- cancel_button_ = new views::NativeButton(
- delegate->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL));
- cancel_button_->SetListener(this);
}
ConfirmInfoBar::~ConfirmInfoBar() {
@@ -261,7 +232,6 @@ void ConfirmInfoBar::Layout() {
void ConfirmInfoBar::ViewHierarchyChanged(bool is_add,
views::View* parent,
views::View* child) {
- InfoBar::ViewHierarchyChanged(is_add, parent, child);
if (is_add && child == this && !initialized_) {
Init();
initialized_ = true;
@@ -297,7 +267,14 @@ ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() {
}
void ConfirmInfoBar::Init() {
+ ok_button_ = new views::NativeButton(
+ GetDelegate()->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_OK));
+ ok_button_->SetListener(this);
AddChildView(ok_button_);
+
+ cancel_button_ = new views::NativeButton(
+ GetDelegate()->GetButtonLabel(ConfirmInfoBarDelegate::BUTTON_CANCEL));
+ cancel_button_->SetListener(this);
AddChildView(cancel_button_);
}