| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ |
| 6 #define CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ | 6 #define CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "app/animation.h" | 9 #include "app/animation.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| 11 #include "chrome/browser/tab_contents/infobar_delegate.h" | 11 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 12 #include "views/controls/button/button.h" | 12 #include "views/controls/button/button.h" |
| 13 #include "views/controls/link.h" | 13 #include "views/controls/link.h" |
| 14 #include "views/focus/focus_manager.h" |
| 14 | 15 |
| 15 class InfoBarContainer; | 16 class InfoBarContainer; |
| 16 class SlideAnimation; | 17 class SlideAnimation; |
| 17 namespace views { | 18 namespace views { |
| 18 class ExternalFocusTracker; | 19 class ExternalFocusTracker; |
| 19 class ImageButton; | 20 class ImageButton; |
| 20 class ImageView; | 21 class ImageView; |
| 21 class Label; | 22 class Label; |
| 22 class NativeButton; | 23 class NativeButton; |
| 23 } | 24 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 virtual void Paint(gfx::Canvas* canvas, views::View* view) const; | 35 virtual void Paint(gfx::Canvas* canvas, views::View* view) const; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 scoped_ptr<views::Background> gradient_background_; | 38 scoped_ptr<views::Background> gradient_background_; |
| 38 | 39 |
| 39 DISALLOW_COPY_AND_ASSIGN(InfoBarBackground); | 40 DISALLOW_COPY_AND_ASSIGN(InfoBarBackground); |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 class InfoBar : public views::View, | 43 class InfoBar : public views::View, |
| 43 public views::ButtonListener, | 44 public views::ButtonListener, |
| 45 public views::FocusChangeListener, |
| 44 public AnimationDelegate { | 46 public AnimationDelegate { |
| 45 public: | 47 public: |
| 46 explicit InfoBar(InfoBarDelegate* delegate); | 48 explicit InfoBar(InfoBarDelegate* delegate); |
| 47 virtual ~InfoBar(); | 49 virtual ~InfoBar(); |
| 48 | 50 |
| 49 InfoBarDelegate* delegate() const { return delegate_; } | 51 InfoBarDelegate* delegate() const { return delegate_; } |
| 50 | 52 |
| 51 // Set a link to the parent InfoBarContainer. This must be set before the | 53 // Set a link to the parent InfoBarContainer. This must be set before the |
| 52 // InfoBar is added to the view hierarchy. | 54 // InfoBar is added to the view hierarchy. |
| 53 void set_container(InfoBarContainer* container) { container_ = container; } | 55 void set_container(InfoBarContainer* container) { container_ = container; } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 94 |
| 93 // Returns a centered y-position of a control of height specified in | 95 // Returns a centered y-position of a control of height specified in |
| 94 // |prefsize| within the standard InfoBar height, adjusted according to the | 96 // |prefsize| within the standard InfoBar height, adjusted according to the |
| 95 // current amount of animation offset the |parent| InfoBar currently has. | 97 // current amount of animation offset the |parent| InfoBar currently has. |
| 96 // Changes during an animation. | 98 // Changes during an animation. |
| 97 int OffsetY(views::View* parent, const gfx::Size prefsize); | 99 int OffsetY(views::View* parent, const gfx::Size prefsize); |
| 98 | 100 |
| 99 // Overridden from views::ButtonListener: | 101 // Overridden from views::ButtonListener: |
| 100 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 102 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 101 | 103 |
| 104 // Overridden from views::FocusChangeListener: |
| 105 virtual void FocusWillChange(View* focused_before, View* focused_now); |
| 106 |
| 102 // Overridden from AnimationDelegate: | 107 // Overridden from AnimationDelegate: |
| 103 virtual void AnimationProgressed(const Animation* animation); | 108 virtual void AnimationProgressed(const Animation* animation); |
| 104 virtual void AnimationEnded(const Animation* animation); | 109 virtual void AnimationEnded(const Animation* animation); |
| 105 | 110 |
| 106 private: | 111 private: |
| 107 friend class InfoBarContainer; | 112 friend class InfoBarContainer; |
| 108 | 113 |
| 109 // Starts animating the InfoBar open. | 114 // Starts animating the InfoBar open. |
| 110 void AnimateOpen(); | 115 void AnimateOpen(); |
| 111 | 116 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 views::NativeButton* cancel_button_; | 242 views::NativeButton* cancel_button_; |
| 238 views::Link* link_; | 243 views::Link* link_; |
| 239 | 244 |
| 240 bool initialized_; | 245 bool initialized_; |
| 241 | 246 |
| 242 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); | 247 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBar); |
| 243 }; | 248 }; |
| 244 | 249 |
| 245 | 250 |
| 246 #endif // CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ | 251 #endif // CHROME_BROWSER_VIEWS_INFOBARS_INFOBARS_H_ |
| OLD | NEW |