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

Side by Side Diff: chrome/browser/infobars/infobar_container.h

Issue 12631008: alternate ntp: implement Show/HideBars API to reduce jank when showing/hiding bars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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_INFOBARS_INFOBAR_CONTAINER_H_ 5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_H_
6 #define CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_H_ 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // anything necessary to respond, e.g. re-layout. 103 // anything necessary to respond, e.g. re-layout.
104 void OnInfoBarStateChanged(bool is_animating); 104 void OnInfoBarStateChanged(bool is_animating);
105 105
106 // Called by |infobar| to request that it be removed from the container, as it 106 // Called by |infobar| to request that it be removed from the container, as it
107 // is about to delete itself. At this point, |infobar| should already be 107 // is about to delete itself. At this point, |infobar| should already be
108 // hidden. 108 // hidden.
109 void RemoveInfoBar(InfoBar* infobar); 109 void RemoveInfoBar(InfoBar* infobar);
110 110
111 const Delegate* delegate() const { return delegate_; } 111 const Delegate* delegate() const { return delegate_; }
112 112
113 // InstantOverlayModelObserver: 113 // InstantOverlayModelObserver:
dhollowa 2013/03/08 00:03:32 This should be moved down under the SearchModelObs
kuan 2013/03/12 18:00:38 this method has been removed.
114 virtual void OverlayStateChanged(const InstantOverlayModel& model) OVERRIDE; 114 virtual void OverlayStateChanged(const InstantOverlayModel& model) OVERRIDE;
115 115
116 protected: 116 protected:
117 // Subclasses must call this during destruction, so that we can remove 117 // Subclasses must call this during destruction, so that we can remove
118 // infobars (which will call the pure virtual functions below) while the 118 // infobars (which will call the pure virtual functions below) while the
119 // subclass portion of |this| has not yet been destroyed. 119 // subclass portion of |this| has not yet been destroyed.
120 void RemoveAllInfoBarsForDestruction(); 120 void RemoveAllInfoBarsForDestruction();
121 121
122 // These must be implemented on each platform to e.g. adjust the visible 122 // These must be implemented on each platform to e.g. adjust the visible
123 // object hierarchy. 123 // object hierarchy.
124 virtual void PlatformSpecificAddInfoBar(InfoBar* infobar, 124 virtual void PlatformSpecificAddInfoBar(InfoBar* infobar,
125 size_t position) = 0; 125 size_t position) = 0;
126 virtual void PlatformSpecificRemoveInfoBar(InfoBar* infobar) = 0; 126 virtual void PlatformSpecificRemoveInfoBar(InfoBar* infobar) = 0;
127 virtual void PlatformSpecificInfoBarStateChanged(bool is_animating) {} 127 virtual void PlatformSpecificInfoBarStateChanged(bool is_animating) {}
128 128
129 private: 129 private:
130 typedef std::vector<InfoBar*> InfoBars; 130 typedef std::vector<InfoBar*> InfoBars;
131 131
132 // content::NotificationObserver: 132 // content::NotificationObserver:
133 virtual void Observe(int type, 133 virtual void Observe(int type,
134 const content::NotificationSource& source, 134 const content::NotificationSource& source,
135 const content::NotificationDetails& details) OVERRIDE; 135 const content::NotificationDetails& details) OVERRIDE;
136 136
137 // chrome::search::SearchModelObserver: 137 // chrome::search::SearchModelObserver:
138 virtual void ModeChanged(const chrome::search::Mode& old_mode, 138 virtual void ModeChanged(const chrome::search::Mode& old_mode,
139 const chrome::search::Mode& new_mode) OVERRIDE; 139 const chrome::search::Mode& new_mode) OVERRIDE;
140 virtual void TopBarsVisibilityChanged(const chrome::search::Mode& mode,
141 bool visible) OVERRIDE;
140 142
141 // Hides an InfoBar for the specified delegate, in response to a notification 143 // Hides an InfoBar for the specified delegate, in response to a notification
142 // from the selected InfoBarService. The InfoBar's disappearance will be 144 // from the selected InfoBarService. The InfoBar's disappearance will be
143 // animated if |use_animation| is true and it has been more than 50ms since 145 // animated if |use_animation| is true and it has been more than 50ms since
144 // infobars were reshown due to an Instant Extended mode change. The InfoBar 146 // infobars were reshown due to an Instant Extended mode change. The InfoBar
145 // will call back to RemoveInfoBar() to remove itself once it's hidden (which 147 // will call back to RemoveInfoBar() to remove itself once it's hidden (which
146 // may mean synchronously). Returns the position within |infobars_| the 148 // may mean synchronously). Returns the position within |infobars_| the
147 // infobar was previously at. 149 // infobar was previously at.
148 size_t HideInfoBar(InfoBarDelegate* delegate, bool use_animation); 150 size_t HideInfoBar(InfoBarDelegate* delegate, bool use_animation);
149 151
(...skipping 30 matching lines...) Expand all
180 // Extended. 182 // Extended.
181 chrome::search::SearchModel* search_model_; 183 chrome::search::SearchModel* search_model_;
182 184
183 // Calculated in SetMaxTopArrowHeight(). 185 // Calculated in SetMaxTopArrowHeight().
184 int top_arrow_target_height_; 186 int top_arrow_target_height_;
185 187
186 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); 188 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer);
187 }; 189 };
188 190
189 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_H_ 191 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/infobars/infobar_container.cc » ('j') | chrome/browser/infobars/infobar_container.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698