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

Side by Side Diff: chrome/browser/banners/app_banner_manager.cc

Issue 2670963002: Android: Fire the appinstalled event on WebAPK installation. (Closed)
Patch Set: Respond to review. Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/banners/app_banner_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/banners/app_banner_manager.h" 5 #include "chrome/browser/banners/app_banner_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 133 }
134 134
135 void AppBannerManager::SendBannerDismissed(int request_id) { 135 void AppBannerManager::SendBannerDismissed(int request_id) {
136 if (request_id != gCurrentRequestID) 136 if (request_id != gCurrentRequestID)
137 return; 137 return;
138 138
139 DCHECK(event_.is_bound()); 139 DCHECK(event_.is_bound());
140 event_->BannerDismissed(); 140 event_->BannerDismissed();
141 } 141 }
142 142
143 base::WeakPtr<AppBannerManager> AppBannerManager::GetWeakPtr() {
144 return weak_factory_.GetWeakPtr();
145 }
146
143 AppBannerManager::AppBannerManager(content::WebContents* web_contents) 147 AppBannerManager::AppBannerManager(content::WebContents* web_contents)
144 : content::WebContentsObserver(web_contents), 148 : content::WebContentsObserver(web_contents),
145 SiteEngagementObserver(SiteEngagementService::Get( 149 SiteEngagementObserver(SiteEngagementService::Get(
146 Profile::FromBrowserContext(web_contents->GetBrowserContext()))), 150 Profile::FromBrowserContext(web_contents->GetBrowserContext()))),
147 state_(State::INACTIVE), 151 state_(State::INACTIVE),
148 manager_(nullptr), 152 manager_(nullptr),
149 event_request_id_(-1), 153 event_request_id_(-1),
150 binding_(this), 154 binding_(this),
151 has_sufficient_engagement_(false), 155 has_sufficient_engagement_(false),
152 load_finished_(false), 156 load_finished_(false),
(...skipping 29 matching lines...) Expand all
182 } 186 }
183 187
184 int AppBannerManager::GetIdealPrimaryIconSizeInPx() { 188 int AppBannerManager::GetIdealPrimaryIconSizeInPx() {
185 return InstallableManager::GetMinimumIconSizeInPx(); 189 return InstallableManager::GetMinimumIconSizeInPx();
186 } 190 }
187 191
188 int AppBannerManager::GetMinimumPrimaryIconSizeInPx() { 192 int AppBannerManager::GetMinimumPrimaryIconSizeInPx() {
189 return InstallableManager::GetMinimumIconSizeInPx(); 193 return InstallableManager::GetMinimumIconSizeInPx();
190 } 194 }
191 195
192 base::WeakPtr<AppBannerManager> AppBannerManager::GetWeakPtr() {
193 return weak_factory_.GetWeakPtr();
194 }
195
196 bool AppBannerManager::IsDebugMode() const { 196 bool AppBannerManager::IsDebugMode() const {
197 return is_debug_mode_ || 197 return is_debug_mode_ ||
198 base::CommandLine::ForCurrentProcess()->HasSwitch( 198 base::CommandLine::ForCurrentProcess()->HasSwitch(
199 switches::kBypassAppBannerEngagementChecks); 199 switches::kBypassAppBannerEngagementChecks);
200 } 200 }
201 201
202 bool AppBannerManager::IsWebAppInstalled( 202 bool AppBannerManager::IsWebAppInstalled(
203 content::BrowserContext* browser_context, 203 content::BrowserContext* browser_context,
204 const GURL& start_url, 204 const GURL& start_url,
205 const GURL& manifest_url) { 205 const GURL& manifest_url) {
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 if (is_pending_event()) { 551 if (is_pending_event()) {
552 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. 552 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner.
553 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); 553 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_);
554 } else { 554 } else {
555 // Log that the prompt request was made for when we get the prompt reply. 555 // Log that the prompt request was made for when we get the prompt reply.
556 page_requested_prompt_ = true; 556 page_requested_prompt_ = true;
557 } 557 }
558 } 558 }
559 559
560 } // namespace banners 560 } // namespace banners
OLDNEW
« no previous file with comments | « chrome/browser/banners/app_banner_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698