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

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

Issue 12386019: Instant: Use only one hidden WebContents per profile. (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 20 matching lines...) Expand all
31 // InfoBarContainer is responsible for telling particular InfoBars that they 31 // InfoBarContainer is responsible for telling particular InfoBars that they
32 // should be hidden or visible. 32 // should be hidden or visible.
33 // 33 //
34 // Platforms need to subclass this to implement a few platform-specific 34 // Platforms need to subclass this to implement a few platform-specific
35 // functions, which are pure virtual here. 35 // functions, which are pure virtual here.
36 // 36 //
37 // This class also observes changes to the SearchModel modes. It hides infobars 37 // This class also observes changes to the SearchModel modes. It hides infobars
38 // temporarily if the user changes into |SEARCH_SUGGESTIONS| mode (refer to 38 // temporarily if the user changes into |SEARCH_SUGGESTIONS| mode (refer to
39 // chrome::search::Mode in chrome/common/search_types.h for all search modes) 39 // chrome::search::Mode in chrome/common/search_types.h for all search modes)
40 // when on a : 40 // when on a :
41 // - |DEFAULT| page: when instant preview is ready; 41 // - |DEFAULT| page: when Instant overlay is ready;
42 // - |NTP| or |SEARCH_RESULTS| page: immediately; 42 // - |NTP| or |SEARCH_RESULTS| page: immediately;
43 // TODO(kuan): this scenario requires more complex synchronization with 43 // TODO(kuan): this scenario requires more complex synchronization with
44 // renderer SearchBoxAPI and will be implemented as the next step; 44 // renderer SearchBoxAPI and will be implemented as the next step;
45 // for now, hiding is immediate. 45 // for now, hiding is immediate.
46 // When the user changes back out of |SEARCH_SUGGESTIONS| mode, it reshows any 46 // When the user changes back out of |SEARCH_SUGGESTIONS| mode, it reshows any
47 // infobars, and starts a 50 ms window during which any attempts to re-hide any 47 // infobars, and starts a 50 ms window during which any attempts to re-hide any
48 // infobars are handled without animation. This prevents glitchy-looking 48 // infobars are handled without animation. This prevents glitchy-looking
49 // behavior when the user navigates following a mode change, which otherwise 49 // behavior when the user navigates following a mode change, which otherwise
50 // would re-show the infobars only to instantly animate them closed. The window 50 // would re-show the infobars only to instantly animate them closed. The window
51 // to re-hide infobars without animation is canceled if a tab change occurs. 51 // to re-hide infobars without animation is canceled if a tab change occurs.
52 class InfoBarContainer : public content::NotificationObserver, 52 class InfoBarContainer : public content::NotificationObserver,
53 public chrome::search::SearchModelObserver, 53 public chrome::search::SearchModelObserver,
54 public InstantModelObserver { 54 public InstantModelObserver {
55 public: 55 public:
56 class Delegate { 56 class Delegate {
57 public: 57 public:
58 // The separator color may vary depending on where the container is hosted. 58 // The separator color may vary depending on where the container is hosted.
59 virtual SkColor GetInfoBarSeparatorColor() const = 0; 59 virtual SkColor GetInfoBarSeparatorColor() const = 0;
60 60
61 // The delegate is notified each time the infobar container changes height, 61 // The delegate is notified each time the infobar container changes height,
62 // as well as when it stops animating. 62 // as well as when it stops animating.
63 virtual void InfoBarContainerStateChanged(bool is_animating) = 0; 63 virtual void InfoBarContainerStateChanged(bool is_animating) = 0;
64 64
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // InstantModelObserver: 113 // InstantModelObserver:
114 virtual void PreviewStateChanged(const InstantModel& model) OVERRIDE; 114 virtual void OverlayStateChanged(const InstantModel& 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,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Extended. 180 // Extended.
181 chrome::search::SearchModel* search_model_; 181 chrome::search::SearchModel* search_model_;
182 182
183 // Calculated in SetMaxTopArrowHeight(). 183 // Calculated in SetMaxTopArrowHeight().
184 int top_arrow_target_height_; 184 int top_arrow_target_height_;
185 185
186 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); 186 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer);
187 }; 187 };
188 188
189 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_H_ 189 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698