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

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

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: changed mechanism to receive PreviewStateChanged 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
« no previous file with comments | « chrome/browser/infobars/infobar_container.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/infobars/infobar_container.cc
diff --git a/chrome/browser/infobars/infobar_container.cc b/chrome/browser/infobars/infobar_container.cc
index a25202563ee06c2918cbd4893d273a07bb040e7d..51d3ac761acd87f4b45a517a32b089ac32921a7e 100644
--- a/chrome/browser/infobars/infobar_container.cc
+++ b/chrome/browser/infobars/infobar_container.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/api/infobars/infobar_delegate.h"
#include "chrome/browser/api/infobars/infobar_service.h"
#include "chrome/browser/infobars/infobar.h"
+#include "chrome/browser/instant/instant_model.h"
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/notification_details.h"
@@ -164,6 +165,12 @@ void InfoBarContainer::ModeChanged(const chrome::search::Mode& old_mode,
const chrome::search::Mode& new_mode) {
// Hide infobars when showing Instant Extended suggestions.
if (new_mode.is_search_suggestions()) {
+ // If suggestions are being shown on a |DEFAULT| page, delay the hiding
+ // until notification that instant preview is ready is received via
+ // PreviewStateChanged(); this prevents jankiness caused by infobars hiding
+ // followed by suggestions appearing.
+ if (new_mode.is_origin_default())
+ return;
HideAllInfoBars();
OnInfoBarStateChanged(false);
} else {
@@ -172,6 +179,16 @@ void InfoBarContainer::ModeChanged(const chrome::search::Mode& old_mode,
}
}
+void InfoBarContainer::PreviewStateChanged(const InstantModel& model) {
+ // If suggestions are being shown on a |DEFAULT| page, hide the infobars now.
+ // See comments for ModeChanged() for explanation.
+ if (model.mode().is_search_suggestions() &&
+ model.mode().is_origin_default()) {
+ HideAllInfoBars();
+ OnInfoBarStateChanged(false);
+ }
+}
+
size_t InfoBarContainer::HideInfoBar(InfoBarDelegate* delegate,
bool use_animation) {
bool should_animate = use_animation &&
« no previous file with comments | « chrome/browser/infobars/infobar_container.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698