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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 181253003: Downgrade page security if an inline has invalid certificate. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not set insecure content flag for favicon loading. Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/ssl/page_with_dynamic_insecure_content.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 const char kDotGoogleDotCom[] = ".google.com"; 174 const char kDotGoogleDotCom[] = ".google.com";
175 175
176 #if defined(OS_ANDROID) 176 #if defined(OS_ANDROID)
177 const char kWebContentsAndroidKey[] = "web_contents_android"; 177 const char kWebContentsAndroidKey[] = "web_contents_android";
178 #endif // OS_ANDROID 178 #endif // OS_ANDROID
179 179
180 base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> > 180 base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> >
181 g_created_callbacks = LAZY_INSTANCE_INITIALIZER; 181 g_created_callbacks = LAZY_INSTANCE_INITIALIZER;
182 182
183 bool HasInsecureContent(const net::CertStatus status) {
184 return net::IsCertStatusError(status) && !net::IsCertStatusMinorError(status);
185 }
186
183 static int StartDownload(RenderFrameHost* rfh, 187 static int StartDownload(RenderFrameHost* rfh,
184 const GURL& url, 188 const GURL& url,
185 bool is_favicon, 189 bool is_favicon,
186 uint32_t max_bitmap_size) { 190 uint32_t max_bitmap_size) {
187 static int g_next_image_download_id = 0; 191 static int g_next_image_download_id = 0;
188 rfh->Send(new ImageMsg_DownloadImage(rfh->GetRoutingID(), 192 rfh->Send(new ImageMsg_DownloadImage(rfh->GetRoutingID(),
189 ++g_next_image_download_id, 193 ++g_next_image_download_id,
190 url, 194 url,
191 is_favicon, 195 is_favicon,
192 max_bitmap_size)); 196 max_bitmap_size));
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 if (browser_plugin_embedder_.get()) 2237 if (browser_plugin_embedder_.get())
2234 browser_plugin_embedder_->DragSourceEndedAt(client_x, client_y, 2238 browser_plugin_embedder_->DragSourceEndedAt(client_x, client_y,
2235 screen_x, screen_y, operation); 2239 screen_x, screen_y, operation);
2236 if (GetRenderViewHost()) 2240 if (GetRenderViewHost())
2237 GetRenderViewHostImpl()->DragSourceEndedAt(client_x, client_y, 2241 GetRenderViewHostImpl()->DragSourceEndedAt(client_x, client_y,
2238 screen_x, screen_y, operation); 2242 screen_x, screen_y, operation);
2239 } 2243 }
2240 2244
2241 void WebContentsImpl::DidGetResourceResponseStart( 2245 void WebContentsImpl::DidGetResourceResponseStart(
2242 const ResourceRequestDetails& details) { 2246 const ResourceRequestDetails& details) {
2247
2248 // If inline resource has invalid certificate, set the insecure content flag.
2249 // For all the intended notifications to be sent, we need to call
2250 // SSLManager::NotifySSLInternalStateChanged() after setting the flag.
2251 // In "standard" insecure content scenario (i.e. http resource in https
2252 // context) the flag is set and SSLManager gets notified in
2253 // OnDidDisplayInsecureContent() (Webkit notification handler).
2254 // When, however, the certificate for the inline is invalid, Webkit will not
2255 // tell us about it and we need to set the flag & notify SSLManager manually.
2256 // Note: the call to SSLManager::NotifySSLInternalStateChanged() will be done
2257 // from SSLManager::DidStartResourceResponse().
2258 if (details.resource_type != RESOURCE_TYPE_FAVICON &&
2259 HasInsecureContent(details.ssl_cert_status))
2260 displayed_insecure_content_ = true;
2261
2243 controller_.ssl_manager()->DidStartResourceResponse(details); 2262 controller_.ssl_manager()->DidStartResourceResponse(details);
2244 2263
2245 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2264 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2246 DidGetResourceResponseStart(details)); 2265 DidGetResourceResponseStart(details));
2247 2266
2248 // TODO(avi): Remove. http://crbug.com/170921 2267 // TODO(avi): Remove. http://crbug.com/170921
2249 NotificationService::current()->Notify( 2268 NotificationService::current()->Notify(
2250 NOTIFICATION_RESOURCE_RESPONSE_STARTED, 2269 NOTIFICATION_RESOURCE_RESPONSE_STARTED,
2251 Source<WebContents>(this), 2270 Source<WebContents>(this),
2252 Details<const ResourceRequestDetails>(&details)); 2271 Details<const ResourceRequestDetails>(&details));
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 int connection_status = 0; 2640 int connection_status = 0;
2622 SignedCertificateTimestampIDStatusList signed_certificate_timestamp_ids; 2641 SignedCertificateTimestampIDStatusList signed_certificate_timestamp_ids;
2623 DeserializeSecurityInfo(security_info, &cert_id, &cert_status, 2642 DeserializeSecurityInfo(security_info, &cert_id, &cert_status,
2624 &security_bits, &connection_status, 2643 &security_bits, &connection_status,
2625 &signed_certificate_timestamp_ids); 2644 &signed_certificate_timestamp_ids);
2626 // TODO(alcutter,eranm): Pass signed_certificate_timestamp_ids into details 2645 // TODO(alcutter,eranm): Pass signed_certificate_timestamp_ids into details
2627 LoadFromMemoryCacheDetails details( 2646 LoadFromMemoryCacheDetails details(
2628 url, GetRenderProcessHost()->GetID(), cert_id, cert_status, http_method, 2647 url, GetRenderProcessHost()->GetID(), cert_id, cert_status, http_method,
2629 mime_type, resource_type); 2648 mime_type, resource_type);
2630 2649
2650 // See WebContentsImpl::DidGetResourceResponseStart for an explanation of why
2651 // displayed_insecure_content_ is set here.
2652 if (details.resource_type != RESOURCE_TYPE_FAVICON &&
2653 HasInsecureContent(cert_status))
2654 displayed_insecure_content_ = true;
2655
2631 controller_.ssl_manager()->DidLoadFromMemoryCache(details); 2656 controller_.ssl_manager()->DidLoadFromMemoryCache(details);
2632 2657
2633 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2658 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2634 DidLoadResourceFromMemoryCache(details)); 2659 DidLoadResourceFromMemoryCache(details));
2635 2660
2636 if (url.is_valid() && url.SchemeIsHTTPOrHTTPS()) { 2661 if (url.is_valid() && url.SchemeIsHTTPOrHTTPS()) {
2637 scoped_refptr<net::URLRequestContextGetter> request_context( 2662 scoped_refptr<net::URLRequestContextGetter> request_context(
2638 resource_type == RESOURCE_TYPE_MEDIA ? 2663 resource_type == RESOURCE_TYPE_MEDIA ?
2639 GetBrowserContext()->GetMediaRequestContextForRenderProcess( 2664 GetBrowserContext()->GetMediaRequestContextForRenderProcess(
2640 GetRenderProcessHost()->GetID()) : 2665 GetRenderProcessHost()->GetID()) :
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
4246 node->render_manager()->ResumeResponseDeferredAtStart(); 4271 node->render_manager()->ResumeResponseDeferredAtStart();
4247 } 4272 }
4248 4273
4249 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4274 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4250 force_disable_overscroll_content_ = force_disable; 4275 force_disable_overscroll_content_ = force_disable;
4251 if (view_) 4276 if (view_)
4252 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4277 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4253 } 4278 }
4254 4279
4255 } // namespace content 4280 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/data/ssl/page_with_dynamic_insecure_content.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698