Chromium Code Reviews| Index: chrome/browser/banners/app_banner_manager.cc |
| diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc |
| index ee166f2f946fd83b6c08b95142952d2ccc8668de..2692f31cfe5f243fc9720bb06c07b076ec8efe73 100644 |
| --- a/chrome/browser/banners/app_banner_manager.cc |
| +++ b/chrome/browser/banners/app_banner_manager.cc |
| @@ -30,7 +30,6 @@ |
| namespace { |
| -int gCurrentRequestID = -1; |
| int gTimeDeltaInDaysForTesting = 0; |
| InstallableParams ParamsToGetManifest() { |
| @@ -66,6 +65,9 @@ void AppBannerManager::RequestAppBanner(const GURL& validated_url, |
| if (is_active_or_pending()) { |
| DCHECK(is_debug_mode); |
| weak_factory_.InvalidateWeakPtrs(); |
|
benwells
2017/07/06 07:22:39
Nit: can you factor this out into a separate funct
dominickn
2017/07/07 00:35:40
Done.
|
| + binding_.Close(); |
| + controller_.reset(); |
| + event_.reset(); |
| } |
| UpdateState(State::ACTIVE); |
| @@ -115,20 +117,14 @@ void AppBannerManager::OnInstall() { |
| installation_service->OnInstall(); |
| } |
| -void AppBannerManager::SendBannerAccepted(int request_id) { |
| - if (request_id != gCurrentRequestID) |
| - return; |
| - |
| - DCHECK(event_.is_bound()); |
| - event_->BannerAccepted(GetBannerType()); |
| +void AppBannerManager::SendBannerAccepted() { |
| + if (event_.is_bound()) |
| + event_->BannerAccepted(GetBannerType()); |
| } |
| -void AppBannerManager::SendBannerDismissed(int request_id) { |
| - if (request_id != gCurrentRequestID) |
| - return; |
| - |
| - DCHECK(event_.is_bound()); |
| - event_->BannerDismissed(); |
| +void AppBannerManager::SendBannerDismissed() { |
| + if (event_.is_bound()) |
| + event_->BannerDismissed(); |
| } |
| base::WeakPtr<AppBannerManager> AppBannerManager::GetWeakPtr() { |
| @@ -141,7 +137,6 @@ AppBannerManager::AppBannerManager(content::WebContents* web_contents) |
| Profile::FromBrowserContext(web_contents->GetBrowserContext()))), |
| state_(State::INACTIVE), |
| manager_(InstallableManager::FromWebContents(web_contents)), |
| - event_request_id_(-1), |
| binding_(this), |
| has_sufficient_engagement_(false), |
| load_finished_(false), |
| @@ -352,9 +347,7 @@ void AppBannerManager::Stop() { |
| void AppBannerManager::SendBannerPromptRequest() { |
| RecordCouldShowBanner(); |
| - |
| TrackBeforeInstallEvent(BEFORE_INSTALL_EVENT_CREATED); |
| - event_request_id_ = ++gCurrentRequestID; |
| web_contents()->GetMainFrame()->GetRemoteInterfaces()->GetInterface( |
| mojo::MakeRequest(&controller_)); |