| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_VIEWS_INFOBARS_INFOBAR_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_INFOBAR_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_INFOBAR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "ui/base/animation/animation_delegate.h" | 11 #include "ui/base/animation/animation_delegate.h" |
| 12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
| 13 | 13 |
| 14 class InfoBarContainer; | 14 class InfoBarContainer; |
| 15 class InfoBarDelegate; | 15 class InfoBarDelegate; |
| 16 class TabContents; |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 class SlideAnimation; | 19 class SlideAnimation; |
| 19 } | 20 } |
| 20 | 21 |
| 21 class InfoBar : public ui::AnimationDelegate { | 22 class InfoBar : public ui::AnimationDelegate { |
| 22 public: | 23 public: |
| 23 explicit InfoBar(InfoBarDelegate* delegate); | 24 InfoBar(TabContents* owner, InfoBarDelegate* delegate); |
| 24 virtual ~InfoBar(); | 25 virtual ~InfoBar(); |
| 25 | 26 |
| 26 // Platforms must define these. | 27 // Platforms must define these. |
| 27 static const int kSeparatorLineHeight; | 28 static const int kSeparatorLineHeight; |
| 28 static const int kDefaultArrowTargetHeight; | 29 static const int kDefaultArrowTargetHeight; |
| 29 static const int kMaximumArrowTargetHeight; | 30 static const int kMaximumArrowTargetHeight; |
| 30 // The half-width (see comments on |arrow_half_width_| below) scales to its | 31 // The half-width (see comments on |arrow_half_width_| below) scales to its |
| 31 // default and maximum values proportionally to how the height scales to its. | 32 // default and maximum values proportionally to how the height scales to its. |
| 32 static const int kDefaultArrowTargetHalfWidth; | 33 static const int kDefaultArrowTargetHalfWidth; |
| 33 static const int kMaximumArrowTargetHalfWidth; | 34 static const int kMaximumArrowTargetHalfWidth; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // current ones, calls PlatformSpecificOnHeightRecalculated(). Informs our | 90 // current ones, calls PlatformSpecificOnHeightRecalculated(). Informs our |
| 90 // container our state has changed if either the heights have changed or | 91 // container our state has changed if either the heights have changed or |
| 91 // |force_notify| is set. | 92 // |force_notify| is set. |
| 92 void RecalculateHeights(bool force_notify); | 93 void RecalculateHeights(bool force_notify); |
| 93 | 94 |
| 94 // Checks whether we're closed. If so, notifies the container that it should | 95 // Checks whether we're closed. If so, notifies the container that it should |
| 95 // remove us (which will cause the platform-specific code to asynchronously | 96 // remove us (which will cause the platform-specific code to asynchronously |
| 96 // delete us) and closes the delegate. | 97 // delete us) and closes the delegate. |
| 97 void MaybeDelete(); | 98 void MaybeDelete(); |
| 98 | 99 |
| 100 TabContents* owner_; // TODO(pkasting): Transition to using this. |
| 99 InfoBarDelegate* delegate_; | 101 InfoBarDelegate* delegate_; |
| 100 InfoBarContainer* container_; | 102 InfoBarContainer* container_; |
| 101 scoped_ptr<ui::SlideAnimation> animation_; | 103 scoped_ptr<ui::SlideAnimation> animation_; |
| 102 | 104 |
| 103 // The current and target heights of the arrow and bar portions, and half the | 105 // The current and target heights of the arrow and bar portions, and half the |
| 104 // current arrow width. (It's easier to work in half-widths as we draw the | 106 // current arrow width. (It's easier to work in half-widths as we draw the |
| 105 // arrow as two halves on either side of a center point.) | 107 // arrow as two halves on either side of a center point.) |
| 106 int arrow_height_; // Includes both fill and top stroke. | 108 int arrow_height_; // Includes both fill and top stroke. |
| 107 int arrow_target_height_; | 109 int arrow_target_height_; |
| 108 int arrow_half_width_; // Includes only fill. | 110 int arrow_half_width_; // Includes only fill. |
| 109 int bar_height_; // Includes both fill and bottom separator. | 111 int bar_height_; // Includes both fill and bottom separator. |
| 110 int bar_target_height_; | 112 int bar_target_height_; |
| 111 | 113 |
| 112 DISALLOW_COPY_AND_ASSIGN(InfoBar); | 114 DISALLOW_COPY_AND_ASSIGN(InfoBar); |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_H_ | 117 #endif // CHROME_BROWSER_TAB_CONTENTS_INFOBAR_H_ |
| OLD | NEW |