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

Side by Side Diff: chrome/renderer/chrome_render_frame_observer.cc

Issue 2190783002: Remove one content::SSLStatus usage in the renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 4 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/renderer/chrome_render_frame_observer.h ('k') | content/public/renderer/render_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/renderer/chrome_render_frame_observer.h" 5 #include "chrome/renderer/chrome_render_frame_observer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 10 matching lines...) Expand all
21 #include "chrome/common/crash_keys.h" 21 #include "chrome/common/crash_keys.h"
22 #include "chrome/common/prerender_messages.h" 22 #include "chrome/common/prerender_messages.h"
23 #include "chrome/common/render_messages.h" 23 #include "chrome/common/render_messages.h"
24 #include "chrome/renderer/prerender/prerender_helper.h" 24 #include "chrome/renderer/prerender/prerender_helper.h"
25 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" 25 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
26 #include "components/translate/content/renderer/translate_helper.h" 26 #include "components/translate/content/renderer/translate_helper.h"
27 #include "content/public/common/ssl_status.h" 27 #include "content/public/common/ssl_status.h"
28 #include "content/public/renderer/render_frame.h" 28 #include "content/public/renderer/render_frame.h"
29 #include "content/public/renderer/render_view.h" 29 #include "content/public/renderer/render_view.h"
30 #include "extensions/common/constants.h" 30 #include "extensions/common/constants.h"
31 #include "net/base/url_util.h"
32 #include "net/ssl/ssl_cipher_suite_names.h"
33 #include "net/ssl/ssl_connection_status_flags.h" 31 #include "net/ssl/ssl_connection_status_flags.h"
estark 2016/07/28 19:59:35 This can go too, I believe.
34 #include "skia/ext/image_operations.h" 32 #include "skia/ext/image_operations.h"
35 #include "third_party/WebKit/public/platform/WebImage.h" 33 #include "third_party/WebKit/public/platform/WebImage.h"
36 #include "third_party/WebKit/public/platform/WebURLRequest.h" 34 #include "third_party/WebKit/public/platform/WebURLRequest.h"
37 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h" 35 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h"
38 #include "third_party/WebKit/public/web/WebDataSource.h" 36 #include "third_party/WebKit/public/web/WebDataSource.h"
39 #include "third_party/WebKit/public/web/WebDocument.h" 37 #include "third_party/WebKit/public/web/WebDocument.h"
40 #include "third_party/WebKit/public/web/WebElement.h" 38 #include "third_party/WebKit/public/web/WebElement.h"
41 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" 39 #include "third_party/WebKit/public/web/WebFrameContentDumper.h"
42 #include "third_party/WebKit/public/web/WebLocalFrame.h" 40 #include "third_party/WebKit/public/web/WebLocalFrame.h"
43 #include "third_party/WebKit/public/web/WebNode.h" 41 #include "third_party/WebKit/public/web/WebNode.h"
44 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 42 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
45 #include "third_party/skia/include/core/SkBitmap.h" 43 #include "third_party/skia/include/core/SkBitmap.h"
46 #include "ui/gfx/codec/jpeg_codec.h" 44 #include "ui/gfx/codec/jpeg_codec.h"
47 #include "ui/gfx/geometry/size_f.h" 45 #include "ui/gfx/geometry/size_f.h"
48 #include "url/gurl.h" 46 #include "url/gurl.h"
49 47
50 #if defined(ENABLE_PRINTING) 48 #if defined(ENABLE_PRINTING)
51 #include "components/printing/common/print_messages.h" 49 #include "components/printing/common/print_messages.h"
52 #include "components/printing/renderer/print_web_view_helper.h" 50 #include "components/printing/renderer/print_web_view_helper.h"
53 #endif 51 #endif
54 52
55 using blink::WebDataSource; 53 using blink::WebDataSource;
56 using blink::WebElement; 54 using blink::WebElement;
57 using blink::WebFrameContentDumper; 55 using blink::WebFrameContentDumper;
58 using blink::WebLocalFrame; 56 using blink::WebLocalFrame;
59 using blink::WebNode; 57 using blink::WebNode;
60 using blink::WebString; 58 using blink::WebString;
61 using content::SSLStatus;
62 using content::RenderFrame; 59 using content::RenderFrame;
63 60
64 // Maximum number of characters in the document to index. 61 // Maximum number of characters in the document to index.
65 // Any text beyond this point will be clipped. 62 // Any text beyond this point will be clipped.
66 static const size_t kMaxIndexChars = 65535; 63 static const size_t kMaxIndexChars = 65535;
67 64
68 // Constants for UMA statistic collection. 65 // Constants for UMA statistic collection.
69 static const char kTranslateCaptureText[] = "Translate.CaptureText"; 66 static const char kTranslateCaptureText[] = "Translate.CaptureText";
70 67
71 // For a page that auto-refreshes, we still show the bubble, if 68 // For a page that auto-refreshes, we still show the bubble, if
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 bool enable_phishing_detection) { 234 bool enable_phishing_detection) {
238 #if defined(SAFE_BROWSING_CSD) 235 #if defined(SAFE_BROWSING_CSD)
239 phishing_classifier_ = 236 phishing_classifier_ =
240 enable_phishing_detection 237 enable_phishing_detection
241 ? safe_browsing::PhishingClassifierDelegate::Create(render_frame(), 238 ? safe_browsing::PhishingClassifierDelegate::Create(render_frame(),
242 nullptr) 239 nullptr)
243 : nullptr; 240 : nullptr;
244 #endif 241 #endif
245 } 242 }
246 243
247 void ChromeRenderFrameObserver::DidFinishDocumentLoad() {
248 // If the navigation is to a localhost URL (and the flag is set to
249 // allow localhost SSL misconfigurations), print a warning to the
250 // console telling the developer to check their SSL configuration
251 // before going to production.
252 bool allow_localhost = base::CommandLine::ForCurrentProcess()->HasSwitch(
253 switches::kAllowInsecureLocalhost);
254 WebDataSource* ds = render_frame()->GetWebFrame()->dataSource();
255
256 SSLStatus ssl_status = render_frame()->GetRenderView()->GetSSLStatusOfFrame(
257 render_frame()->GetWebFrame());
258
259 if (allow_localhost) {
260 bool is_cert_error = net::IsCertStatusError(ssl_status.cert_status) &&
261 !net::IsCertStatusMinorError(ssl_status.cert_status);
262 bool is_localhost = net::IsLocalhost(GURL(ds->request().url()).host());
263
264 if (is_cert_error && is_localhost) {
265 render_frame()->GetWebFrame()->addMessageToConsole(
266 blink::WebConsoleMessage(
267 blink::WebConsoleMessage::LevelWarning,
268 base::ASCIIToUTF16(
269 "This site does not have a valid SSL "
270 "certificate! Without SSL, your site's and "
271 "visitors' data is vulnerable to theft and "
272 "tampering. Get a valid SSL certificate before"
273 " releasing your website to the public.")));
274 }
275 }
276
277 // DHE is deprecated and will be removed in M52. See https://crbug.com/598109.
278 // TODO(davidben): Remove this logic when DHE is removed.
279 uint16_t cipher_suite =
280 net::SSLConnectionStatusToCipherSuite(ssl_status.connection_status);
281 const char* key_exchange;
282 const char* unused;
283 bool is_aead_unused;
284 net::SSLCipherSuiteToStrings(&key_exchange, &unused, &unused, &is_aead_unused,
285 cipher_suite);
286 if (strcmp(key_exchange, "DHE_RSA") == 0) {
287 render_frame()->GetWebFrame()->addMessageToConsole(blink::WebConsoleMessage(
288 blink::WebConsoleMessage::LevelWarning,
289 base::ASCIIToUTF16("This site requires a DHE-based SSL cipher suite. "
290 "These are deprecated and will be removed in M52, "
291 "around July 2016. See "
292 "https://www.chromestatus.com/feature/"
293 "5752033759985664 for more details.")));
294 }
295 }
296
297 void ChromeRenderFrameObserver::OnAppBannerPromptRequest( 244 void ChromeRenderFrameObserver::OnAppBannerPromptRequest(
298 int request_id, 245 int request_id,
299 const std::string& platform) { 246 const std::string& platform) {
300 // App banner prompt requests are handled in the general chrome render frame 247 // App banner prompt requests are handled in the general chrome render frame
301 // observer, not the AppBannerClient, as the AppBannerClient is created lazily 248 // observer, not the AppBannerClient, as the AppBannerClient is created lazily
302 // by blink and may not exist when the request is sent. 249 // by blink and may not exist when the request is sent.
303 blink::WebAppBannerPromptReply reply = blink::WebAppBannerPromptReply::None; 250 blink::WebAppBannerPromptReply reply = blink::WebAppBannerPromptReply::None;
304 blink::WebString web_platform(base::UTF8ToUTF16(platform)); 251 blink::WebString web_platform(base::UTF8ToUTF16(platform));
305 blink::WebVector<blink::WebString> web_platforms(&web_platform, 1); 252 blink::WebVector<blink::WebString> web_platforms(&web_platform, 1);
306 253
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 CapturePageText(FINAL_CAPTURE); 365 CapturePageText(FINAL_CAPTURE);
419 break; 366 break;
420 default: 367 default:
421 break; 368 break;
422 } 369 }
423 } 370 }
424 371
425 void ChromeRenderFrameObserver::OnDestruct() { 372 void ChromeRenderFrameObserver::OnDestruct() {
426 delete this; 373 delete this;
427 } 374 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_frame_observer.h ('k') | content/public/renderer/render_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698