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

Unified Diff: chrome/browser/ui/tab_contents/core_tab_helper.cc

Issue 2190783002: Remove one content::SSLStatus usage in the renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unneeded header Created 4 years, 5 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/ui/tab_contents/core_tab_helper.h ('k') | chrome/renderer/chrome_render_frame_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/tab_contents/core_tab_helper.cc
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc
index 3cefb93fc57abd3f9c4d21b8b4435e600c691ee4..a32e7616a76cdf6fcc4f3fff365caf26e2b43417 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.cc
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc
@@ -26,12 +26,16 @@
#include "components/search_engines/template_url_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/web_cache/browser/web_cache_manager.h"
+#include "content/public/browser/navigation_controller.h"
+#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/context_menu_params.h"
+#include "content/public/common/ssl_status.h"
#include "net/base/load_states.h"
+#include "net/base/url_util.h"
#include "net/http/http_request_headers.h"
#include "ui/base/l10n/l10n_util.h"
@@ -247,6 +251,33 @@ void CoreTabHelper::DidStartLoading() {
UpdateContentRestrictions(0);
}
+void CoreTabHelper::DocumentOnLoadCompletedInMainFrame() {
+ bool allow_localhost = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAllowInsecureLocalhost);
+ if (!allow_localhost)
+ return;
+
+ content::NavigationEntry* entry =
+ web_contents()->GetController().GetLastCommittedEntry();
+ if (!net::IsLocalhost(entry->GetURL().host()))
+ return;
+
+ content::SSLStatus ssl_status = entry->GetSSL();
+ bool is_cert_error = net::IsCertStatusError(ssl_status.cert_status) &&
+ !net::IsCertStatusMinorError(ssl_status.cert_status);
+ if (!is_cert_error)
+ return;
+
+ web_contents()->GetMainFrame()->AddMessageToConsole(
+ content::CONSOLE_MESSAGE_LEVEL_WARNING,
+ base::StringPrintf(
+ "This site does not have a valid SSL "
+ "certificate! Without SSL, your site's and "
+ "visitors' data is vulnerable to theft and "
+ "tampering. Get a valid SSL certificate before"
+ " releasing your website to the public."));
+}
+
void CoreTabHelper::WasShown() {
web_cache::WebCacheManager::GetInstance()->ObserveActivity(
web_contents()->GetRenderProcessHost()->GetID());
« no previous file with comments | « chrome/browser/ui/tab_contents/core_tab_helper.h ('k') | chrome/renderer/chrome_render_frame_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698