diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-25 01:06:05 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-25 01:06:05 +0000 |
commit | f86a07024080cd1b000105bce34ce45b2bd5159b (patch) | |
tree | d47e27fae62581ffb7f4e4209c7dd0106b88763f /chrome/browser/views/infobars/infobars.h | |
parent | 2d42a37132679537eb9e8db9f45a6dfe92dde996 (diff) | |
download | chromium_src-f86a07024080cd1b000105bce34ce45b2bd5159b.zip chromium_src-f86a07024080cd1b000105bce34ce45b2bd5159b.tar.gz chromium_src-f86a07024080cd1b000105bce34ce45b2bd5159b.tar.bz2 |
Re-land 5929 (r5882) with crash fix and also this change:
http://codereview.chromium.org/11392/show
which fixes the remainder of the UI test issues apparently.
http://crbug.com/4620
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/infobars/infobars.h')
-rw-r--r-- | chrome/browser/views/infobars/infobars.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/browser/views/infobars/infobars.h b/chrome/browser/views/infobars/infobars.h index 1e02f96..f2ccc73 100644 --- a/chrome/browser/views/infobars/infobars.h +++ b/chrome/browser/views/infobars/infobars.h @@ -13,6 +13,7 @@ class InfoBarContainer; class SlideAnimation; namespace views { class Button; +class ExternalFocusTracker; class ImageView; class Label; } @@ -30,6 +31,8 @@ class InfoBar : public views::View, InfoBarDelegate* delegate() const { return delegate_; } + // Set a link to the parent InfoBarContainer. This must be set before the + // InfoBar is added to the view hierarchy. void set_container(InfoBarContainer* container) { container_ = container; } // Starts animating the InfoBar open. @@ -52,6 +55,11 @@ 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; @@ -64,6 +72,20 @@ class InfoBar : public views::View, virtual void AnimationProgressed(const Animation* animation); virtual void AnimationEnded(const Animation* animation); + // Called when an InfoBar is added or removed from a view hierarchy to do + // setup and shutdown. + void InfoBarAdded(); + void InfoBarRemoved(); + + // Destroys the external focus tracker, if present. If |restore_focus| is + // true, restores focus to the view tracked by the focus tracker before doing + // so. + void DestroyFocusTracker(bool restore_focus); + + // Deletes this object (called after a return to the message loop to allow + // the stack in ViewHierarchyChanged to unwind). + void DeleteSelf(); + // The InfoBar's container InfoBarContainer* container_; @@ -76,6 +98,13 @@ 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_; + + // Used to delete this object after a return to the message loop. + ScopedRunnableMethodFactory<InfoBar> delete_factory_; + DISALLOW_COPY_AND_ASSIGN(InfoBar); }; |