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

Unified Diff: chrome/browser/installable/installable_manager.cc

Issue 2630523002: Ensure the entire page is secure for PWAs. (Closed)
Patch Set: Whitelist localhost Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/installable/installable_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/installable/installable_manager.cc
diff --git a/chrome/browser/installable/installable_manager.cc b/chrome/browser/installable/installable_manager.cc
index f7df24ded7763000fae4ed17ee79e48ad77afa7f..b49b281d7243e78e9587328e8ba021f3f7fdf64b 100644
--- a/chrome/browser/installable/installable_manager.cc
+++ b/chrome/browser/installable/installable_manager.cc
@@ -9,11 +9,14 @@
#include "chrome/browser/manifest/manifest_icon_downloader.h"
#include "chrome/browser/manifest/manifest_icon_selector.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ssl/security_state_tab_helper.h"
+#include "components/security_state/core/security_state.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/storage_partition.h"
+#include "net/base/url_util.h"
#include "third_party/WebKit/public/platform/WebDisplayMode.h"
namespace {
@@ -95,6 +98,23 @@ InstallableManager::InstallableManager(content::WebContents* web_contents)
InstallableManager::~InstallableManager() = default;
// static
+bool InstallableManager::IsContentSecure(content::WebContents* web_contents) {
+ if (!web_contents)
+ return false;
+
+ // Whitelist localhost. Check the VisibleURL to match what the
+ // SecurityStateTabHelper looks at.
+ if (net::IsLocalhost(web_contents->GetVisibleURL().HostNoBrackets()))
benwells 2017/01/13 04:34:13 Hmm, it's a bit unfortunate you need to manually c
dominickn 2017/01/13 04:38:54 Yeah, that's what I expected too. Then it failed a
+ return true;
+
+ security_state::SecurityInfo security_info;
+ SecurityStateTabHelper::FromWebContents(web_contents)
+ ->GetSecurityInfo(&security_info);
+ return security_info.security_level == security_state::SECURE ||
+ security_info.security_level == security_state::EV_SECURE;
+}
+
+// static
int InstallableManager::GetMinimumIconSizeInPx() {
return kIconMinimumSizeInPx;
}
« no previous file with comments | « chrome/browser/installable/installable_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698