| 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 55e03e54125f80d4a2d922e12309374743c0ca21..ffd07bf143f7d79171869e55a9c8ca8c807d0925 100644
|
| --- a/chrome/browser/banners/app_banner_manager.cc
|
| +++ b/chrome/browser/banners/app_banner_manager.cc
|
| @@ -80,9 +80,10 @@ bool AppBannerManager::URLsAreForTheSamePage(const GURL& first,
|
|
|
| void AppBannerManager::RequestAppBanner(const GURL& validated_url,
|
| bool is_debug_mode) {
|
| + content::WebContents* contents = web_contents();
|
| +
|
| // Don't start a redundant banner request. Otherwise, if one is running,
|
| // invalidate our weak pointers so it terminates.
|
| - content::WebContents* contents = web_contents();
|
| if (is_active_) {
|
| if (URLsAreForTheSamePage(validated_url, contents->GetLastCommittedURL()))
|
| return;
|
| @@ -98,15 +99,18 @@ void AppBannerManager::RequestAppBanner(const GURL& validated_url,
|
| DCHECK(!need_to_log_status_);
|
| need_to_log_status_ = !IsDebugMode();
|
|
|
| - if (contents->GetMainFrame()->GetParent()) {
|
| - ReportStatus(contents, NOT_IN_MAIN_FRAME);
|
| - Stop();
|
| - return;
|
| + // Exit if this is an incognito window, non-main frame, or insecure context.
|
| + InstallableStatusCode code = NO_ERROR_DETECTED;
|
| + if (Profile::FromBrowserContext(contents->GetBrowserContext())
|
| + ->IsOffTheRecord()) {
|
| + code = IN_INCOGNITO;
|
| + } else if (contents->GetMainFrame()->GetParent()) {
|
| + code = NOT_IN_MAIN_FRAME;
|
| + } else if (!content::IsOriginSecure(validated_url)) {
|
| + code = NOT_FROM_SECURE_ORIGIN;
|
| }
|
|
|
| - // A secure origin is required to show banners, so exit early if we see the
|
| - // URL is invalid.
|
| - if (!content::IsOriginSecure(validated_url)) {
|
| + if (code != NO_ERROR_DETECTED) {
|
| ReportStatus(contents, NOT_FROM_SECURE_ORIGIN);
|
| Stop();
|
| return;
|
|
|