summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-24 21:28:50 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-24 21:28:50 +0000
commit388df8dc8379a4c9df3f127a95e9c36e408002a6 (patch)
tree038f8cff28f45207ec4763104403de0e724db9fc /chrome/browser/views
parent6801423490ff5b2d62e19b0e7de5c07cb347be3a (diff)
downloadchromium_src-388df8dc8379a4c9df3f127a95e9c36e408002a6.zip
chromium_src-388df8dc8379a4c9df3f127a95e9c36e408002a6.tar.gz
chromium_src-388df8dc8379a4c9df3f127a95e9c36e408002a6.tar.bz2
rollback
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5933 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/infobars/infobar_container.cc4
-rw-r--r--chrome/browser/views/infobars/infobars.cc37
-rw-r--r--chrome/browser/views/infobars/infobars.h10
3 files changed, 9 insertions, 42 deletions
diff --git a/chrome/browser/views/infobars/infobar_container.cc b/chrome/browser/views/infobars/infobar_container.cc
index bb48b12..2fe7a35 100644
--- a/chrome/browser/views/infobars/infobar_container.cc
+++ b/chrome/browser/views/infobars/infobar_container.cc
@@ -103,7 +103,7 @@ void InfoBarContainer::UpdateInfoBars() {
// Clear out all the old child views.
RemoveAllChildViews(true);
- for (int i = 0; i < tab_contents_->infobar_delegate_count(); ++i) {
+ for (size_t i = 0; i < tab_contents_->infobar_delegate_count(); ++i) {
InfoBarDelegate* delegate = tab_contents_->GetInfoBarDelegateAt(i);
InfoBar* infobar = delegate->CreateInfoBar();
infobar->set_container(this);
@@ -120,7 +120,7 @@ void InfoBarContainer::AddInfoBar(InfoBarDelegate* delegate) {
}
void InfoBarContainer::RemoveInfoBar(InfoBarDelegate* delegate) {
- int index = 0;
+ size_t index = 0;
for (; index < tab_contents_->infobar_delegate_count(); ++index) {
if (tab_contents_->GetInfoBarDelegateAt(index) == delegate)
break;
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_);
}
diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h
index 7b94735..1e02f96 100644
--- a/chrome/browser/views/infobars/infobars.h
+++ b/chrome/browser/views/infobars/infobars.h
@@ -13,7 +13,6 @@ class InfoBarContainer;
class SlideAnimation;
namespace views {
class Button;
-class ExternalFocusTracker;
class ImageView;
class Label;
}
@@ -53,11 +52,6 @@ class InfoBar : public views::View,
virtual void Layout();
protected:
- // Overridden from views::View:
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child);
-
// Returns the available width of the View for use by child view layout,
// excluding the close button.
virtual int GetAvailableWidth() const;
@@ -82,10 +76,6 @@ class InfoBar : public views::View,
// The animation that runs when the InfoBar is opened or closed.
scoped_ptr<SlideAnimation> animation_;
- // Tracks and stores the last focused view which is not the InfoBar or any of
- // its children. Used to restore focus once the InfoBar is closed.
- scoped_ptr<views::ExternalFocusTracker> focus_tracker_;
-
DISALLOW_COPY_AND_ASSIGN(InfoBar);
};