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

Unified Diff: chrome/browser/infobars/infobar_container.h

Issue 12036075: alternate ntp: fix website page jankiness when suggestions show and top bars are hidden (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed all comments Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
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..d0f3439b0835251e49b81bd57e3d6485b95debbe 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,25 @@ 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 |SEARCH_SUGGESTIONS|
+// mode (refer to chrome::search::Mode in chrome/common/search_types.h for all
+// search modes) when:
+// - on a page that is not |NTP| or |SEARCH_RESULTS|: when instant preview is
+// ready;
+// - on a page that is |NTP| or |SEARCH_RESULTS|: immediately;
+// TODO(kuan): this scenario requires more complex synchronization with
+// renderer SearchBoxAPI and will be implemented as the next step;
+// for now, hiding is immediate.
+// When the user changes back out of |SEARCH_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
+// to re-hide infobars without animation is canceled if a tab change occurs.
class InfoBarContainer : public content::NotificationObserver,
- public chrome::search::SearchModelObserver {
+ public chrome::search::SearchModelObserver,
+ public InstantModelObserver {
public:
class Delegate {
public:
@@ -61,10 +72,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,
+ const InstantModel* instant_model);
virtual ~InfoBarContainer();
// Changes the InfoBarService for which this container is showing
@@ -126,6 +138,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 +180,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_;
« no previous file with comments | « no previous file | chrome/browser/infobars/infobar_container.cc » ('j') | chrome/browser/ui/views/frame/browser_view_layout.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698