Commit d74f79c5 authored by Zhen Wang's avatar Zhen Wang Committed by Commit Bot

Show throbber when background tab resumes loading

This CL fixes a bug about the spinner logic for staggered background
tab opening feature. In this fix, we keep track of if the WebContents
was hiding throbber. So later when we need to show throbber, we can force
update the spinner even if the loading state is not changing.

Before: background tab keeps showing favicon even when it resume to load.
After: background tab will show spinner when it resumes to load.

For more details, see crbug.com/762133 for the desired behavior.

Bug: 762133,751210
Change-Id: Ice1643f3ebf08d2f1bf94a47245b6e272187d0fa
Reviewed-on: https://chromium-review.googlesource.com/810037
Commit-Queue: Zhen Wang <zhenw@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522128}
parent d4571659
......@@ -158,6 +158,9 @@ class WebContents;
// added in fullscreen in 10.10+.
base::scoped_nsobject<CustomWindowControlsView> customWindowControls_;
base::scoped_nsobject<CrTrackingArea> customWindowControlsTrackingArea_;
// The set stores the WebContens that were hiding their throbbers.
std::set<content::WebContents*> wasHidingThrobberSet_;
}
@property(nonatomic) CGFloat leadingIndentForControls;
......
......@@ -18,6 +18,7 @@
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/stl_util.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
......@@ -1324,6 +1325,13 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
[delegate_ onTabInsertedWithContents:contents inForeground:inForeground];
}
// Called when a notification is received from the model to close the tab with
// the WebContents.
- (void)tabClosingWithContents:(content::WebContents*)contents
atIndex:(NSInteger)index {
wasHidingThrobberSet_.erase(contents);
}
// Called before |contents| is deactivated.
- (void)tabDeactivatedWithContents:(content::WebContents*)contents {
contents->StoreFocus();
......@@ -1647,8 +1655,11 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
[tabController
setIconImage:[self iconImageForContents:contents atIndex:modelIndex]];
}
} else if (newState == kTabDone || oldState != newState ||
wasHidingThrobberSet_.insert(contents);
} else if (base::ContainsKey(wasHidingThrobberSet_, contents) ||
newState == kTabDone || oldState != newState ||
oldHasIcon != newHasIcon) {
wasHidingThrobberSet_.erase(contents);
if (newHasIcon) {
if (newState == kTabDone) {
[tabController setIconImage:[self iconImageForContents:contents
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment