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

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 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"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "chrome/browser/instant/instant_overlay_model_observer.h"
13 #include "chrome/browser/ui/search/search_model_observer.h" 12 #include "chrome/browser/ui/search/search_model_observer.h"
14 #include "chrome/common/search_types.h" 13 #include "chrome/common/search_types.h"
15 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
17 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
18 17
19 class InfoBar; 18 class InfoBar;
20 class InfoBarDelegate; 19 class InfoBarDelegate;
21 class InfoBarService; 20 class InfoBarService;
22 21
(...skipping 20 matching lines...) Expand all
43 // TODO(kuan): this scenario requires more complex synchronization with 42 // TODO(kuan): this scenario requires more complex synchronization with
44 // renderer SearchBoxAPI and will be implemented as the next step; 43 // renderer SearchBoxAPI and will be implemented as the next step;
45 // for now, hiding is immediate. 44 // for now, hiding is immediate.
46 // When the user changes back out of |SEARCH_SUGGESTIONS| mode, it reshows any 45 // 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 46 // 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 47 // infobars are handled without animation. This prevents glitchy-looking
49 // behavior when the user navigates following a mode change, which otherwise 48 // 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 49 // 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. 50 // to re-hide infobars without animation is canceled if a tab change occurs.
52 class InfoBarContainer : public content::NotificationObserver, 51 class InfoBarContainer : public content::NotificationObserver,
53 public chrome::search::SearchModelObserver, 52 public chrome::search::SearchModelObserver {
54 public InstantOverlayModelObserver {
55 public: 53 public:
56 class Delegate { 54 class Delegate {
57 public: 55 public:
58 // The separator color may vary depending on where the container is hosted. 56 // The separator color may vary depending on where the container is hosted.
59 virtual SkColor GetInfoBarSeparatorColor() const = 0; 57 virtual SkColor GetInfoBarSeparatorColor() const = 0;
60 58
61 // The delegate is notified each time the infobar container changes height, 59 // The delegate is notified each time the infobar container changes height,
62 // as well as when it stops animating. 60 // as well as when it stops animating.
63 virtual void InfoBarContainerStateChanged(bool is_animating) = 0; 61 virtual void InfoBarContainerStateChanged(bool is_animating) = 0;
64 62
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // anything necessary to respond, e.g. re-layout. 101 // anything necessary to respond, e.g. re-layout.
104 void OnInfoBarStateChanged(bool is_animating); 102 void OnInfoBarStateChanged(bool is_animating);
105 103
106 // Called by |infobar| to request that it be removed from the container, as it 104 // 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 105 // is about to delete itself. At this point, |infobar| should already be
108 // hidden. 106 // hidden.
109 void RemoveInfoBar(InfoBar* infobar); 107 void RemoveInfoBar(InfoBar* infobar);
110 108
111 const Delegate* delegate() const { return delegate_; } 109 const Delegate* delegate() const { return delegate_; }
112 110
113 // InstantOverlayModelObserver: 111 void InstantOverlayShown();
114 virtual void OverlayStateChanged(const InstantOverlayModel& model) OVERRIDE;
115 112
116 protected: 113 protected:
117 // Subclasses must call this during destruction, so that we can remove 114 // Subclasses must call this during destruction, so that we can remove
118 // infobars (which will call the pure virtual functions below) while the 115 // infobars (which will call the pure virtual functions below) while the
119 // subclass portion of |this| has not yet been destroyed. 116 // subclass portion of |this| has not yet been destroyed.
120 void RemoveAllInfoBarsForDestruction(); 117 void RemoveAllInfoBarsForDestruction();
121 118
122 // These must be implemented on each platform to e.g. adjust the visible 119 // These must be implemented on each platform to e.g. adjust the visible
123 // object hierarchy. 120 // object hierarchy.
124 virtual void PlatformSpecificAddInfoBar(InfoBar* infobar, 121 virtual void PlatformSpecificAddInfoBar(InfoBar* infobar,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Extended. 177 // Extended.
181 chrome::search::SearchModel* search_model_; 178 chrome::search::SearchModel* search_model_;
182 179
183 // Calculated in SetMaxTopArrowHeight(). 180 // Calculated in SetMaxTopArrowHeight().
184 int top_arrow_target_height_; 181 int top_arrow_target_height_;
185 182
186 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); 183 DISALLOW_COPY_AND_ASSIGN(InfoBarContainer);
187 }; 184 };
188 185
189 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_H_ 186 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_CONTAINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698