Commit d020af34 authored by Adithya Srinivasan's avatar Adithya Srinivasan Committed by Commit Bot

Remove redundant main frame check in InstallableManager

Found while doing an audit of WebContents::GetMainFrame().
web_contents->GetMainFrame()->GetParent() will always return null.

Change-Id: Idc5d2ed719a400a300198b9c36ab4e3307934556
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422440
Commit-Queue: Adithya Srinivasan <adithyas@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809320}
parent e9b424e9
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
namespace { namespace {
// Error message strings corresponding to the InstallableStatusCode enum. // Error message strings corresponding to the InstallableStatusCode enum.
static const char kNotInMainFrameMessage[] =
"Page is not loaded in the main frame";
static const char kNotFromSecureOriginMessage[] = static const char kNotFromSecureOriginMessage[] =
"Page is not served from a secure origin"; "Page is not served from a secure origin";
static const char kNoManifestMessage[] = "Page has no manifest <link> URL"; static const char kNoManifestMessage[] = "Page has no manifest <link> URL";
...@@ -68,7 +66,6 @@ static const char kManifestDisplayOverrideNotSupportedMessage[] = ...@@ -68,7 +66,6 @@ static const char kManifestDisplayOverrideNotSupportedMessage[] =
"Manifest contains 'display_override' field, and the first supported " "Manifest contains 'display_override' field, and the first supported "
"display mode must be one of 'standalone', 'fullscreen', or 'minimal-ui'"; "display mode must be one of 'standalone', 'fullscreen', or 'minimal-ui'";
static const char kNotInMainFrameId[] = "not-in-main-frame";
static const char kNotFromSecureOriginId[] = "not-from-secure-origin"; static const char kNotFromSecureOriginId[] = "not-from-secure-origin";
static const char kNoManifestId[] = "no-manifest"; static const char kNoManifestId[] = "no-manifest";
static const char kManifestEmptyId[] = "manifest-empty"; static const char kManifestEmptyId[] = "manifest-empty";
...@@ -132,9 +129,6 @@ std::string GetErrorMessage(InstallableStatusCode code) { ...@@ -132,9 +129,6 @@ std::string GetErrorMessage(InstallableStatusCode code) {
case SHOWING_APP_INSTALLATION_DIALOG: case SHOWING_APP_INSTALLATION_DIALOG:
case MAX_ERROR_CODE: case MAX_ERROR_CODE:
break; break;
case NOT_IN_MAIN_FRAME:
message = kNotInMainFrameMessage;
break;
case NOT_FROM_SECURE_ORIGIN: case NOT_FROM_SECURE_ORIGIN:
message = kNotFromSecureOriginMessage; message = kNotFromSecureOriginMessage;
break; break;
...@@ -238,9 +232,6 @@ content::InstallabilityError GetInstallabilityError( ...@@ -238,9 +232,6 @@ content::InstallabilityError GetInstallabilityError(
case SHOWING_APP_INSTALLATION_DIALOG: case SHOWING_APP_INSTALLATION_DIALOG:
case MAX_ERROR_CODE: case MAX_ERROR_CODE:
break; break;
case NOT_IN_MAIN_FRAME:
error_id = kNotInMainFrameId;
break;
case NOT_FROM_SECURE_ORIGIN: case NOT_FROM_SECURE_ORIGIN:
error_id = kNotFromSecureOriginId; error_id = kNotFromSecureOriginId;
break; break;
......
...@@ -22,7 +22,7 @@ enum InstallableStatusCode { ...@@ -22,7 +22,7 @@ enum InstallableStatusCode {
RENDERER_EXITING = 1, RENDERER_EXITING = 1,
RENDERER_CANCELLED = 2, RENDERER_CANCELLED = 2,
USER_NAVIGATED = 3, USER_NAVIGATED = 3,
NOT_IN_MAIN_FRAME = 4, // NOT_IN_MAIN_FRAME = 4 (DEPRECATED),
NOT_FROM_SECURE_ORIGIN = 5, NOT_FROM_SECURE_ORIGIN = 5,
NO_MANIFEST = 6, NO_MANIFEST = 6,
MANIFEST_EMPTY = 7, MANIFEST_EMPTY = 7,
......
...@@ -591,9 +591,6 @@ void InstallableManager::CheckEligiblity() { ...@@ -591,9 +591,6 @@ void InstallableManager::CheckEligiblity() {
->IsOffTheRecord()) { ->IsOffTheRecord()) {
eligibility_->errors.push_back(IN_INCOGNITO); eligibility_->errors.push_back(IN_INCOGNITO);
} }
if (web_contents->GetMainFrame()->GetParent()) {
eligibility_->errors.push_back(NOT_IN_MAIN_FRAME);
}
if (!IsContentSecure(web_contents)) { if (!IsContentSecure(web_contents)) {
eligibility_->errors.push_back(NOT_FROM_SECURE_ORIGIN); eligibility_->errors.push_back(NOT_FROM_SECURE_ORIGIN);
} }
......
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