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

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

Issue 553333006: Makes InfoBarService not close infobars on a reload from browser instant (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review feedback Created 6 years, 3 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_service.h ('k') | chrome/browser/ui/browser_instant_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/infobars/infobar_service.cc
diff --git a/chrome/browser/infobars/infobar_service.cc b/chrome/browser/infobars/infobar_service.cc
index db73ec38b903aa3fe7f407d30f7a0addcc88bfaa..a748e0576173e2da8c85cb60837df52d4cd1c703 100644
--- a/chrome/browser/infobars/infobar_service.cc
+++ b/chrome/browser/infobars/infobar_service.cc
@@ -20,6 +20,16 @@ using infobars::InfoBar;
using infobars::InfoBarDelegate;
using infobars::InfoBarManager;
+namespace {
+
+bool IsReload(const content::LoadCommittedDetails& details) {
+ return content::PageTransitionStripQualifier(
+ details.entry->GetTransitionType()) == content::PAGE_TRANSITION_RELOAD;
+
+}
+
+} // namespace
+
// static
InfoBarDelegate::NavigationDetails
InfoBarService::NavigationDetailsFromLoadCommittedDetails(
@@ -32,9 +42,7 @@ InfoBarDelegate::NavigationDetails
navigation_details.is_main_frame = details.is_main_frame;
const content::PageTransition transition = details.entry->GetTransitionType();
- navigation_details.is_reload =
- content::PageTransitionStripQualifier(transition) ==
- content::PAGE_TRANSITION_RELOAD;
+ navigation_details.is_reload = IsReload(details);
navigation_details.is_redirect =
(transition & content::PAGE_TRANSITION_IS_REDIRECT_MASK) != 0;
@@ -51,7 +59,8 @@ content::WebContents* InfoBarService::WebContentsFromInfoBar(InfoBar* infobar) {
}
InfoBarService::InfoBarService(content::WebContents* web_contents)
- : content::WebContentsObserver(web_contents) {
+ : content::WebContentsObserver(web_contents),
+ ignore_next_reload_(false) {
DCHECK(web_contents);
}
@@ -90,9 +99,18 @@ void InfoBarService::RenderProcessGone(base::TerminationStatus status) {
RemoveAllInfoBars(true);
}
+void InfoBarService::DidStartNavigationToPendingEntry(
+ const GURL& url,
+ content::NavigationController::ReloadType reload_type) {
+ ignore_next_reload_ = false;
+}
+
void InfoBarService::NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) {
- OnNavigation(NavigationDetailsFromLoadCommittedDetails(load_details));
+ const bool ignore = ignore_next_reload_ && IsReload(load_details);
+ ignore_next_reload_ = false;
+ if (!ignore)
+ OnNavigation(NavigationDetailsFromLoadCommittedDetails(load_details));
}
void InfoBarService::WebContentsDestroyed() {
« no previous file with comments | « chrome/browser/infobars/infobar_service.h ('k') | chrome/browser/ui/browser_instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698