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

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: nit fixes. 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 // Overlap the previous view by this amount, vertically, so that
71 // desired location of the center of the arrow in the |outer_view| 72 // this InfoBarView may draw its tab on top.
72 // coordinate system. 73 int VerticalOverlap() const { return AnimatedTabHeight(); }
Peter Kasting 2011/03/09 00:41:45 Nit: Just make AnimatedTabHeight() public. If you
Sheridan Rawlins 2011/03/09 01:09:34 Done.
73 void PaintArrow(gfx::Canvas* canvas, View* outer_view, int arrow_center_x); 74
75 SkPath* fill_path() const { return fill_path_.get(); }
76 SkPath* stroke_path() const { return stroke_path_.get(); }
74 77
75 protected: 78 protected:
76 // The target height of the InfoBar, regardless of what its current height 79 // The target height of the InfoBar, regardless of what its current height
77 // is (due to animation). 80 // is (due to animation).
78 static const int kDefaultTargetHeight; 81 static const int kDefaultTargetHeight;
79 static const int kButtonButtonSpacing; 82 static const int kButtonButtonSpacing;
80 static const int kEndOfLabelSpacing; 83 static const int kEndOfLabelSpacing;
81 84
82 virtual ~InfoBarView(); 85 virtual ~InfoBarView();
83 86
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 void set_target_height(int height) { target_height_ = height; } 125 void set_target_height(int height) { target_height_ = height; }
123 126
124 ui::SlideAnimation* animation() { return animation_.get(); } 127 ui::SlideAnimation* animation() { return animation_.get(); }
125 128
126 // These return x coordinates delimiting the usable area for subclasses to lay 129 // These return x coordinates delimiting the usable area for subclasses to lay
127 // out their controls. 130 // out their controls.
128 int StartX() const; 131 int StartX() const;
129 int EndX() const; 132 int EndX() const;
130 133
131 // Returns a centered y-position of a control of height specified in 134 // 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 135 // |prefsize| within the standard InfoBar height, adjusted according to the
137 // current amount of animation offset the |parent| InfoBar currently has. 136 // current amount of animation offset the |parent| InfoBar currently has.
138 // Changes during an animation. 137 // Changes during an animation.
139 int OffsetY(const gfx::Size prefsize) const; 138 int OffsetY(const gfx::Size prefsize) const;
140 139
141 private: 140 private:
141 static const int kCurveWidth;
142 static const int kHorizontalPadding; 142 static const int kHorizontalPadding;
143 static const int kMaxIconWidth;
144 static const int kTabHeight;
145 static const int kTabIconPadding;
146 static const int kTabWidth;
143 147
144 // views::View: 148 // views::View:
145 virtual AccessibilityTypes::Role GetAccessibleRole(); 149 virtual AccessibilityTypes::Role GetAccessibleRole();
146 virtual gfx::Size GetPreferredSize(); 150 virtual gfx::Size GetPreferredSize();
151 virtual void OnBoundsChanged();
152 virtual void PaintChildren(gfx::Canvas* canvas);
147 153
148 // views::FocusChangeListener: 154 // views::FocusChangeListener:
149 virtual void FocusWillChange(View* focused_before, View* focused_now); 155 virtual void FocusWillChange(View* focused_before, View* focused_now);
150 156
151 // ui::AnimationDelegate: 157 // ui::AnimationDelegate:
152 virtual void AnimationEnded(const ui::Animation* animation); 158 virtual void AnimationEnded(const ui::Animation* animation);
153 159
160 // Returns a centered y-position of a control of height specified in
161 // |prefsize| within the standard InfoBar height. Stable during an animation.
162 int CenterY(const gfx::Size prefsize) const;
163
164 int AnimatedTabHeight() const;
165 int AnimatedBarHeight() const;
166
154 // Destroys the external focus tracker, if present. If |restore_focus| is 167 // 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 168 // true, restores focus to the view tracked by the focus tracker before doing
156 // so. 169 // so.
157 void DestroyFocusTracker(bool restore_focus); 170 void DestroyFocusTracker(bool restore_focus);
158 171
159 // Closes the InfoBar immediately and removes it from its container. Notifies 172 // 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 173 // the delegate that it has closed. The InfoBar is deleted after this function
161 // is called. 174 // is called.
162 void Close(); 175 void Close();
163 176
(...skipping 16 matching lines...) Expand all
180 // The animation that runs when the InfoBar is opened or closed. 193 // The animation that runs when the InfoBar is opened or closed.
181 scoped_ptr<ui::SlideAnimation> animation_; 194 scoped_ptr<ui::SlideAnimation> animation_;
182 195
183 // Tracks and stores the last focused view which is not the InfoBar or any of 196 // 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. 197 // its children. Used to restore focus once the InfoBar is closed.
185 scoped_ptr<views::ExternalFocusTracker> focus_tracker_; 198 scoped_ptr<views::ExternalFocusTracker> focus_tracker_;
186 199
187 // Used to delete this object after a return to the message loop. 200 // Used to delete this object after a return to the message loop.
188 ScopedRunnableMethodFactory<InfoBarView> delete_factory_; 201 ScopedRunnableMethodFactory<InfoBarView> delete_factory_;
189 202
190 // The target height for the InfoBarView. 203 // The target height for the bar portion of the InfoBarView.
191 int target_height_; 204 int target_height_;
192 205
206 scoped_ptr<SkPath> fill_path_;
207 scoped_ptr<SkPath> stroke_path_;
208
193 DISALLOW_COPY_AND_ASSIGN(InfoBarView); 209 DISALLOW_COPY_AND_ASSIGN(InfoBarView);
194 }; 210 };
195 211
196 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ 212 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698