Index: chrome/browser/infobars/infobar_container.h |
diff --git a/chrome/browser/infobars/infobar_container.h b/chrome/browser/infobars/infobar_container.h |
index 508bf76dd23826c5d8ecda213526b6d07069a2ea..08c28cf4320c8ff0acc45016bb0f1595779d586f 100644 |
--- a/chrome/browser/infobars/infobar_container.h |
+++ b/chrome/browser/infobars/infobar_container.h |
@@ -9,6 +9,7 @@ |
#include "base/compiler_specific.h" |
#include "base/time.h" |
+#include "chrome/browser/instant/instant_model_observer.h" |
#include "chrome/browser/ui/search/search_model_observer.h" |
#include "chrome/common/search_types.h" |
#include "content/public/browser/notification_observer.h" |
@@ -18,6 +19,7 @@ |
class InfoBar; |
class InfoBarDelegate; |
class InfoBarService; |
+class InstantModel; |
namespace chrome { |
namespace search { |
@@ -33,16 +35,21 @@ class SearchModel; |
// Platforms need to subclass this to implement a few platform-specific |
// functions, which are pure virtual here. |
// |
-// This class also observes changes to the SearchModel mode. If the user changes |
-// into suggestions mode, it hides all the infobars temporarily. When the user |
-// changes back out of suggestions mode, it reshows any infobars, and starts a |
-// 50 ms window during which any attempts to re-hide any infobars are handled |
-// without animation. This prevents glitchy-looking behavior when the user |
-// navigates following a mode change, which otherwise would re-show the infobars |
-// only to instantly animate them closed. The window is canceled if a tab |
-// change occurs. |
+// This class also observes changes to the SearchModel and InstantModel modes. |
+// It hides infobars temporarily if the user changes into suggestions mode when: |
Peter Kasting
2013/01/28 21:51:00
Readers may not know what "suggestions mode" means
kuan
2013/01/29 00:17:08
Done.
|
+// - on a website page: when instant preview is ready; |
+// - not on a website page: immediately; this scenario requires more complex |
Peter Kasting
2013/01/28 21:51:00
It's not clear what "not on a website page" means.
kuan
2013/01/29 00:17:08
Done.
|
+// synchronization with renderer and will be implemented as the next step; |
dhollowa
2013/01/25 21:24:08
nit: this sounds like a TODO and should be marked
Peter Kasting
2013/01/28 21:51:00
Yes, please don't discuss implementation plans in
kuan
2013/01/29 00:17:08
Done.
kuan
2013/01/29 00:17:08
Done.
|
+// for now, hiding is immediate. |
+// When the user changes back out of suggestions mode, it reshows any infobars, |
+// and starts a 50 ms window during which any attempts to re-hide any infobars |
+// are handled without animation. This prevents glitchy-looking behavior when |
+// the user navigates following a mode change, which otherwise would re-show the |
+// infobars only to instantly animate them closed. The window is canceled if a |
dhollowa
2013/01/25 21:24:08
nit: "The *animation* is canceled..." ?
kuan
2013/01/29 00:17:08
i didn't write this comment, but hopefully i've cl
|
+// tab change occurs. |
class InfoBarContainer : public content::NotificationObserver, |
- public chrome::search::SearchModelObserver { |
+ public chrome::search::SearchModelObserver, |
+ public InstantModelObserver { |
public: |
class Delegate { |
public: |
@@ -61,10 +68,11 @@ class InfoBarContainer : public content::NotificationObserver, |
virtual ~Delegate(); |
}; |
- // |search_model| may be NULL if this class is used in a window that does not |
- // support Instant Extended. |
+ // |search_model| and |instant_model| may be NULL if this class is used in a |
+ // window that does not support Instant Extended. |
InfoBarContainer(Delegate* delegate, |
- chrome::search::SearchModel* search_model); |
+ chrome::search::SearchModel* search_model, |
dhollowa
2013/01/25 21:24:08
The const for InstantModel is nice. Could you ple
Peter Kasting
2013/01/27 23:57:28
It does not seem at all correct that you should be
dhollowa
2013/01/28 16:43:06
That's a design choice really. What I like about
|
+ const InstantModel* instant_model); |
virtual ~InfoBarContainer(); |
// Changes the InfoBarService for which this container is showing |
@@ -126,6 +134,9 @@ class InfoBarContainer : public content::NotificationObserver, |
virtual void ModeChanged(const chrome::search::Mode& old_mode, |
const chrome::search::Mode& new_mode) OVERRIDE; |
+ // InstantModelObserver: |
+ virtual void PreviewStateChanged(const InstantModel& model) OVERRIDE; |
+ |
// Hides an InfoBar for the specified delegate, in response to a notification |
// from the selected InfoBarService. The InfoBar's disappearance will be |
// animated if |use_animation| is true and it has been more than 50ms since |
@@ -165,6 +176,9 @@ class InfoBarContainer : public content::NotificationObserver, |
// Extended. |
chrome::search::SearchModel* search_model_; |
+ // Tracks state of instant preview for Instant Extended. |
+ const InstantModel* instant_model_; // Weak. |
+ |
// Calculated in SetMaxTopArrowHeight(). |
int top_arrow_target_height_; |