Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_view.h

Issue 6609047: [linux_views][Win] spoof proof redesign infobar extension with tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: renames, don't const_cast, ditch InfoBarView::VerticalOffset. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "ui/base/animation/animation_delegate.h" 10 #include "ui/base/animation/animation_delegate.h"
11 #include "views/controls/button/button.h" 11 #include "views/controls/button/button.h"
12 #include "views/focus/focus_manager.h" 12 #include "views/focus/focus_manager.h"
13 13
14 class InfoBarContainer; 14 class InfoBarContainer;
15 class InfoBarDelegate; 15 class InfoBarDelegate;
16 class SkPath;
16 17
17 namespace ui { 18 namespace ui {
18 class SlideAnimation; 19 class SlideAnimation;
19 } 20 }
20 21
21 namespace views { 22 namespace views {
22 class ExternalFocusTracker; 23 class ExternalFocusTracker;
23 class ImageButton; 24 class ImageButton;
24 class ImageView; 25 class ImageView;
25 class Label; 26 class Label;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 61
61 // Makes the infobar visible. If |animate| is true, the infobar is then 62 // Makes the infobar visible. If |animate| is true, the infobar is then
62 // animated to full size. 63 // animated to full size.
63 void Show(bool animate); 64 void Show(bool animate);
64 65
65 // Makes the infobar hidden. If |animate| is true, the infobar is first 66 // Makes the infobar hidden. If |animate| is true, the infobar is first
66 // animated to zero size. Once the infobar is hidden, it is removed from its 67 // animated to zero size. Once the infobar is hidden, it is removed from its
67 // container (triggering its deletion), and its delegate is closed. 68 // container (triggering its deletion), and its delegate is closed.
68 void Hide(bool animate); 69 void Hide(bool animate);
69 70
70 // Paint the arrow on |canvas|. |arrow_center_x| indicates the 71 SkPath* fill_path() const { return fill_path_.get(); }
71 // desired location of the center of the arrow in the |outer_view| 72 SkPath* stroke_path() const { return stroke_path_.get(); }
72 // coordinate system. 73
73 void PaintArrow(gfx::Canvas* canvas, View* outer_view, int arrow_center_x); 74 int AnimatedTabHeight() const;
Peter Kasting 2011/03/09 01:11:18 Nit: Probably should comment this and AnimatedBarH
74 75
75 protected: 76 protected:
76 // The target height of the InfoBar, regardless of what its current height 77 // The target height of the InfoBar, regardless of what its current height
77 // is (due to animation). 78 // is (due to animation).
78 static const int kDefaultTargetHeight; 79 static const int kDefaultTargetHeight;
79 static const int kButtonButtonSpacing; 80 static const int kButtonButtonSpacing;
80 static const int kEndOfLabelSpacing; 81 static const int kEndOfLabelSpacing;
81 82
82 virtual ~InfoBarView(); 83 virtual ~InfoBarView();
83 84
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 void set_target_height(int height) { target_height_ = height; } 123 void set_target_height(int height) { target_height_ = height; }
123 124
124 ui::SlideAnimation* animation() { return animation_.get(); } 125 ui::SlideAnimation* animation() { return animation_.get(); }
125 126
126 // These return x coordinates delimiting the usable area for subclasses to lay 127 // These return x coordinates delimiting the usable area for subclasses to lay
127 // out their controls. 128 // out their controls.
128 int StartX() const; 129 int StartX() const;
129 int EndX() const; 130 int EndX() const;
130 131
131 // Returns a centered y-position of a control of height specified in 132 // Returns a centered y-position of a control of height specified in
132 // |prefsize| within the standard InfoBar height. Stable during an animation.
133 int CenterY(const gfx::Size prefsize) const;
134
135 // Returns a centered y-position of a control of height specified in
136 // |prefsize| within the standard InfoBar height, adjusted according to the 133 // |prefsize| within the standard InfoBar height, adjusted according to the
137 // current amount of animation offset the |parent| InfoBar currently has. 134 // current amount of animation offset the |parent| InfoBar currently has.
138 // Changes during an animation. 135 // Changes during an animation.
139 int OffsetY(const gfx::Size prefsize) const; 136 int OffsetY(const gfx::Size prefsize) const;
140 137
141 private: 138 private:
139 static const int kCurveWidth;
142 static const int kHorizontalPadding; 140 static const int kHorizontalPadding;
141 static const int kMaxIconWidth;
142 static const int kTabHeight;
143 static const int kTabIconPadding;
144 static const int kTabWidth;
143 145
144 // views::View: 146 // views::View:
145 virtual AccessibilityTypes::Role GetAccessibleRole(); 147 virtual AccessibilityTypes::Role GetAccessibleRole();
146 virtual gfx::Size GetPreferredSize(); 148 virtual gfx::Size GetPreferredSize();
149 virtual void OnBoundsChanged();
150 virtual void PaintChildren(gfx::Canvas* canvas);
147 151
148 // views::FocusChangeListener: 152 // views::FocusChangeListener:
149 virtual void FocusWillChange(View* focused_before, View* focused_now); 153 virtual void FocusWillChange(View* focused_before, View* focused_now);
150 154
151 // ui::AnimationDelegate: 155 // ui::AnimationDelegate:
152 virtual void AnimationEnded(const ui::Animation* animation); 156 virtual void AnimationEnded(const ui::Animation* animation);
153 157
158 // Returns a centered y-position of a control of height specified in
159 // |prefsize| within the standard InfoBar height. Stable during an animation.
160 int CenterY(const gfx::Size prefsize) const;
161
162 int AnimatedBarHeight() const;
163
154 // Destroys the external focus tracker, if present. If |restore_focus| is 164 // Destroys the external focus tracker, if present. If |restore_focus| is
155 // true, restores focus to the view tracked by the focus tracker before doing 165 // true, restores focus to the view tracked by the focus tracker before doing
156 // so. 166 // so.
157 void DestroyFocusTracker(bool restore_focus); 167 void DestroyFocusTracker(bool restore_focus);
158 168
159 // Closes the InfoBar immediately and removes it from its container. Notifies 169 // Closes the InfoBar immediately and removes it from its container. Notifies
160 // the delegate that it has closed. The InfoBar is deleted after this function 170 // the delegate that it has closed. The InfoBar is deleted after this function
161 // is called. 171 // is called.
162 void Close(); 172 void Close();
163 173
(...skipping 16 matching lines...) Expand all
180 // The animation that runs when the InfoBar is opened or closed. 190 // The animation that runs when the InfoBar is opened or closed.
181 scoped_ptr<ui::SlideAnimation> animation_; 191 scoped_ptr<ui::SlideAnimation> animation_;
182 192
183 // Tracks and stores the last focused view which is not the InfoBar or any of 193 // Tracks and stores the last focused view which is not the InfoBar or any of
184 // its children. Used to restore focus once the InfoBar is closed. 194 // its children. Used to restore focus once the InfoBar is closed.
185 scoped_ptr<views::ExternalFocusTracker> focus_tracker_; 195 scoped_ptr<views::ExternalFocusTracker> focus_tracker_;
186 196
187 // Used to delete this object after a return to the message loop. 197 // Used to delete this object after a return to the message loop.
188 ScopedRunnableMethodFactory<InfoBarView> delete_factory_; 198 ScopedRunnableMethodFactory<InfoBarView> delete_factory_;
189 199
190 // The target height for the InfoBarView. 200 // The target height for the bar portion of the InfoBarView.
191 int target_height_; 201 int target_height_;
192 202
203 scoped_ptr<SkPath> fill_path_;
204 scoped_ptr<SkPath> stroke_path_;
205
193 DISALLOW_COPY_AND_ASSIGN(InfoBarView); 206 DISALLOW_COPY_AND_ASSIGN(InfoBarView);
194 }; 207 };
195 208
196 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ 209 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_container.cc ('k') | chrome/browser/ui/views/infobars/infobar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698