Remove requestAppBanner from the DevTools protocol.

This CL removes the ability to request an app banner from DevTools. This
follows the removal of the explicit link to trigger this action in
https://crrev.com/c/1370371.

Follow-up CLs will implement a new AppBannerManager::DryRun method which
will be accessed by devtools in order to collect all errors from the
installability check to surface to developers.

BUG=915945

Change-Id: I2d95030965474ebb35d6f8882c1ff00eeeb6a29a
Reviewed-on: https://chromium-review.googlesource.com/c/1393126
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Pavel Feldman <pfeldman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621025}
diff --git a/chrome/browser/android/tab_web_contents_delegate_android.cc b/chrome/browser/android/tab_web_contents_delegate_android.cc
index d7fa7d4..8bd434f 100644
--- a/chrome/browser/android/tab_web_contents_delegate_android.cc
+++ b/chrome/browser/android/tab_web_contents_delegate_android.cc
@@ -436,14 +436,6 @@
                                           security_style_explanations);
 }
 
-void TabWebContentsDelegateAndroid::RequestAppBannerFromDevTools(
-    content::WebContents* web_contents) {
-  banners::AppBannerManagerAndroid* manager =
-      banners::AppBannerManagerAndroid::FromWebContents(web_contents);
-  DCHECK(manager);
-  manager->RequestAppBanner(web_contents->GetLastCommittedURL(), true);
-}
-
 void TabWebContentsDelegateAndroid::OnDidBlockFramebust(
     content::WebContents* web_contents,
     const GURL& url) {
diff --git a/chrome/browser/android/tab_web_contents_delegate_android.h b/chrome/browser/android/tab_web_contents_delegate_android.h
index a14ef59..c21af66 100644
--- a/chrome/browser/android/tab_web_contents_delegate_android.h
+++ b/chrome/browser/android/tab_web_contents_delegate_android.h
@@ -86,8 +86,6 @@
   blink::WebSecurityStyle GetSecurityStyle(
       content::WebContents* web_contents,
       content::SecurityStyleExplanations* security_style_explanations) override;
-  void RequestAppBannerFromDevTools(
-      content::WebContents* web_contents) override;
   void OnDidBlockFramebust(content::WebContents* web_contents,
                            const GURL& url) override;
   void UpdateUserGestureCarryoverInfo(
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 3415796..7b392d0 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -37,7 +37,6 @@
 #include "chrome/browser/background/background_contents.h"
 #include "chrome/browser/background/background_contents_service.h"
 #include "chrome/browser/background/background_contents_service_factory.h"
-#include "chrome/browser/banners/app_banner_manager_desktop.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
@@ -1240,13 +1239,6 @@
   return std::make_unique<SerialChooser>(std::move(bubble_reference));
 }
 
-void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) {
-  banners::AppBannerManagerDesktop::CreateForWebContents(web_contents);
-  banners::AppBannerManagerDesktop* manager =
-      banners::AppBannerManagerDesktop::FromWebContents(web_contents);
-  manager->RequestAppBanner(web_contents->GetLastCommittedURL(), true);
-}
-
 void Browser::PassiveInsecureContentFound(const GURL& resource_url) {
   // Note: this implementation is a mirror of
   // ContentSettingsObserver::passiveInsecureContentFound
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index d5fbbaa6..af984a0 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -498,8 +498,6 @@
       content::RenderFrameHost* frame,
       std::vector<blink::mojom::SerialPortFilterPtr> filters,
       content::SerialChooser::Callback callback) override;
-  void RequestAppBannerFromDevTools(
-      content::WebContents* web_contents) override;
   void PassiveInsecureContentFound(const GURL& resource_url) override;
   bool ShouldAllowRunningInsecureContent(content::WebContents* web_contents,
                                          bool allowed_per_prefs,
diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc
index 40067ec..274d7e2 100644
--- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc
+++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc
@@ -375,9 +375,6 @@
   return Java_WebContentsDelegateAndroid_isFullscreenForTabOrPending(env, obj);
 }
 
-void WebContentsDelegateAndroid::RequestAppBannerFromDevTools(
-    content::WebContents* web_contents) {}
-
 void WebContentsDelegateAndroid::OnDidBlockFramebust(
     content::WebContents* web_contents,
     const GURL& url) {}
diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.h b/components/embedder_support/android/delegate/web_contents_delegate_android.h
index fbb08794..212eb54 100644
--- a/components/embedder_support/android/delegate/web_contents_delegate_android.h
+++ b/components/embedder_support/android/delegate/web_contents_delegate_android.h
@@ -110,8 +110,6 @@
   void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
   bool IsFullscreenForTabOrPending(
       const content::WebContents* web_contents) const override;
-  void RequestAppBannerFromDevTools(
-      content::WebContents* web_contents) override;
   void OnDidBlockFramebust(content::WebContents* web_contents,
                            const GURL& url) override;
   int GetTopControlsHeight() const override;
diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc
index 161ef3d..b0661fb 100644
--- a/content/browser/devtools/protocol/page_handler.cc
+++ b/content/browser/devtools/protocol/page_handler.cc
@@ -856,14 +856,6 @@
   return Response::OK();
 }
 
-Response PageHandler::RequestAppBanner() {
-  WebContentsImpl* web_contents = GetWebContents();
-  if (!web_contents || !web_contents->GetDelegate())
-    return Response::InternalError();
-  web_contents->GetDelegate()->RequestAppBannerFromDevTools(web_contents);
-  return Response::OK();
-}
-
 Response PageHandler::BringToFront() {
   WebContentsImpl* wc = GetWebContents();
   if (wc) {
diff --git a/content/browser/devtools/protocol/page_handler.h b/content/browser/devtools/protocol/page_handler.h
index 2361d21..b3f45b3 100644
--- a/content/browser/devtools/protocol/page_handler.h
+++ b/content/browser/devtools/protocol/page_handler.h
@@ -146,8 +146,6 @@
   Response HandleJavaScriptDialog(bool accept,
                                   Maybe<std::string> prompt_text) override;
 
-  Response RequestAppBanner() override;
-
   Response BringToFront() override;
 
   Response SetDownloadBehavior(const std::string& behavior,
diff --git a/content/browser/devtools/protocol_config.json b/content/browser/devtools/protocol_config.json
index f77a66a5..2bec648 100644
--- a/content/browser/devtools/protocol_config.json
+++ b/content/browser/devtools/protocol_config.json
@@ -48,7 +48,7 @@
             {
                 "domain": "Page",
                 "include": ["enable", "disable", "reload", "navigate", "stopLoading", "getNavigationHistory", "navigateToHistoryEntry", "resetNavigationHistory", "captureScreenshot",
-                    "startScreencast", "stopScreencast", "screencastFrameAck", "handleJavaScriptDialog", "setColorPickerEnabled", "requestAppBanner",
+                    "startScreencast", "stopScreencast", "screencastFrameAck", "handleJavaScriptDialog", "setColorPickerEnabled",
                     "printToPDF", "bringToFront", "setDownloadBehavior", "getAppManifest", "crash", "close", "setWebLifecycleState", "captureSnapshot"],
                 "include_events": ["colorPicked", "interstitialShown", "interstitialHidden", "javascriptDialogOpening", "javascriptDialogClosed", "screencastVisibilityChanged", "screencastFrame"],
                 "async": ["captureScreenshot", "printToPDF", "navigate", "getAppManifest", "reload", "captureSnapshot"]
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index 2c162df..d7ce001 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -556,9 +556,6 @@
       WebContents* web_contents,
       SecurityStyleExplanations* security_style_explanations);
 
-  // Requests the app banner. This method is called from the DevTools.
-  virtual void RequestAppBannerFromDevTools(WebContents* web_contents) {}
-
   // Called when a suspicious navigation of the main frame has been blocked.
   // Allows the delegate to provide some UI to let the user know about the
   // blocked navigation and give them the option to recover from it. The given
diff --git a/third_party/blink/renderer/core/inspector/browser_protocol-1.2.json b/third_party/blink/renderer/core/inspector/browser_protocol-1.2.json
index f5a12c6..6e3e7e12 100644
--- a/third_party/blink/renderer/core/inspector/browser_protocol-1.2.json
+++ b/third_party/blink/renderer/core/inspector/browser_protocol-1.2.json
@@ -478,11 +478,6 @@
                 "handlers": ["none"]
             },
             {
-                "name": "requestAppBanner",
-                "experimental": true,
-                "handlers": ["browser"]
-            },
-            {
                 "name": "setBlockedEventsWarningThreshold",
                 "experimental": true,
                 "parameters": [
diff --git a/third_party/blink/renderer/core/inspector/browser_protocol-1.3.json b/third_party/blink/renderer/core/inspector/browser_protocol-1.3.json
index dbf3b7c..95985359 100644
--- a/third_party/blink/renderer/core/inspector/browser_protocol-1.3.json
+++ b/third_party/blink/renderer/core/inspector/browser_protocol-1.3.json
@@ -602,10 +602,6 @@
                 ]
             },
             {
-                "name": "requestAppBanner",
-                "experimental": true
-            },
-            {
                 "name": "getLayoutMetrics",
                 "description": "Returns metrics relating to the layouting of the page, such as viewport bounds/scale.",
                 "returns": [
diff --git a/third_party/blink/renderer/core/inspector/browser_protocol.pdl b/third_party/blink/renderer/core/inspector/browser_protocol.pdl
index 5570766..0c58644 100644
--- a/third_party/blink/renderer/core/inspector/browser_protocol.pdl
+++ b/third_party/blink/renderer/core/inspector/browser_protocol.pdl
@@ -5229,8 +5229,6 @@
     parameters
       ScriptIdentifier identifier
 
-  experimental command requestAppBanner
-
   # Acknowledges that a screencast frame has been received by the frontend.
   experimental command screencastFrameAck
     parameters
diff --git a/third_party/blink/renderer/core/inspector/inspector_protocol_config.json b/third_party/blink/renderer/core/inspector/inspector_protocol_config.json
index 92d6511..6ff7bad 100644
--- a/third_party/blink/renderer/core/inspector/inspector_protocol_config.json
+++ b/third_party/blink/renderer/core/inspector/inspector_protocol_config.json
@@ -74,7 +74,7 @@
             {
                 "domain": "Page",
                 "exclude": ["getNavigationHistory", "navigateToHistoryEntry", "resetNavigationHistory", "captureScreenshot", "screencastFrameAck", "handleJavaScriptDialog", "setColorPickerEnabled",
-                            "getAppManifest", "requestAppBanner", "setControlNavigations", "processNavigation", "printToPDF", "bringToFront", "setDownloadBehavior", "navigate", "crash", "close", "setWebLifecycleState", "captureSnapshot"],
+                            "getAppManifest", "setControlNavigations", "processNavigation", "printToPDF", "bringToFront", "setDownloadBehavior", "navigate", "crash", "close", "setWebLifecycleState", "captureSnapshot"],
                 "async": ["getResourceContent", "searchInResource"],
                 "exclude_events": ["screencastFrame", "screencastVisibilityChanged", "colorPicked", "interstitialShown", "interstitialHidden", "javascriptDialogOpening", "javascriptDialogClosed", "navigationRequested"]
             },
diff --git a/third_party/blink/renderer/devtools/BUILD.gn b/third_party/blink/renderer/devtools/BUILD.gn
index d242f4d..6c85481 100644
--- a/third_party/blink/renderer/devtools/BUILD.gn
+++ b/third_party/blink/renderer/devtools/BUILD.gn
@@ -361,7 +361,6 @@
   "front_end/inspector_main/nodeIcon.css",
   "front_end/inspector_main/renderingOptions.css",
   "front_end/inspector_main/RenderingOptions.js",
-  "front_end/inspector_main/RequestAppBannerActionDelegate.js",
   "front_end/integration_test_runner.js",
   "front_end/integration_test_runner.json",
   "front_end/javascript_metadata/module.json",
diff --git a/third_party/blink/renderer/devtools/front_end/inspector_main/RequestAppBannerActionDelegate.js b/third_party/blink/renderer/devtools/front_end/inspector_main/RequestAppBannerActionDelegate.js
deleted file mode 100644
index 9dc8491b..0000000
--- a/third_party/blink/renderer/devtools/front_end/inspector_main/RequestAppBannerActionDelegate.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-/**
- * @implements {UI.ActionDelegate}
- * @unrestricted
- */
-InspectorMain.RequestAppBannerActionDelegate = class {
-  /**
-   * @override
-   * @param {!UI.Context} context
-   * @param {string} actionId
-   * @return {boolean}
-   */
-  handleAction(context, actionId) {
-    const target = SDK.targetManager.mainTarget();
-    if (target && target.type() === SDK.Target.Type.Frame) {
-      target.pageAgent().requestAppBanner();
-      Common.console.show();
-    }
-    return true;
-  }
-};
diff --git a/third_party/blink/renderer/devtools/front_end/inspector_main/module.json b/third_party/blink/renderer/devtools/front_end/inspector_main/module.json
index 35ad608..49003d3 100644
--- a/third_party/blink/renderer/devtools/front_end/inspector_main/module.json
+++ b/third_party/blink/renderer/devtools/front_end/inspector_main/module.json
@@ -127,13 +127,6 @@
             "persistence": "closeable",
             "order": 50,
             "className": "InspectorMain.RenderingOptionsView"
-        },
-        {
-            "type": "action",
-            "category": "Mobile",
-            "actionId": "components.request-app-banner",
-            "className": "InspectorMain.RequestAppBannerActionDelegate",
-            "title": "Add to homescreen"
         }
     ],
     "dependencies": [
@@ -142,7 +135,6 @@
     ],
     "scripts": [
         "RenderingOptions.js",
-        "RequestAppBannerActionDelegate.js",
         "InspectorMain.js"
     ],
     "resources": [