| 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());
|
|
|