OLD | NEW |
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 "chrome/browser/ssl/ssl_blocking_page.h" | 5 #include "chrome/browser/ssl/ssl_blocking_page.h" |
6 | 6 |
7 #include "base/build_time.h" | 7 #include "base/build_time.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/process/launch.h" | 13 #include "base/process/launch.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
21 #include "chrome/browser/history/history_service_factory.h" | 22 #include "chrome/browser/history/history_service_factory.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/renderer_preferences_util.h" | 24 #include "chrome/browser/renderer_preferences_util.h" |
24 #include "chrome/browser/ssl/ssl_error_classification.h" | 25 #include "chrome/browser/ssl/ssl_error_classification.h" |
25 #include "chrome/browser/ssl/ssl_error_info.h" | 26 #include "chrome/browser/ssl/ssl_error_info.h" |
26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/grit/chromium_strings.h" | 28 #include "chrome/grit/chromium_strings.h" |
28 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
| 30 #include "components/google/core/browser/google_util.h" |
29 #include "content/public/browser/cert_store.h" | 31 #include "content/public/browser/cert_store.h" |
30 #include "content/public/browser/interstitial_page.h" | 32 #include "content/public/browser/interstitial_page.h" |
31 #include "content/public/browser/navigation_controller.h" | 33 #include "content/public/browser/navigation_controller.h" |
32 #include "content/public/browser/navigation_entry.h" | 34 #include "content/public/browser/navigation_entry.h" |
33 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
35 #include "content/public/browser/render_process_host.h" | 37 #include "content/public/browser/render_process_host.h" |
36 #include "content/public/browser/render_view_host.h" | 38 #include "content/public/browser/render_view_host.h" |
37 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
38 #include "content/public/common/ssl_status.h" | 40 #include "content/public/common/ssl_status.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 using content::InterstitialPage; | 74 using content::InterstitialPage; |
73 using content::NavigationController; | 75 using content::NavigationController; |
74 using content::NavigationEntry; | 76 using content::NavigationEntry; |
75 | 77 |
76 #if defined(ENABLE_EXTENSIONS) | 78 #if defined(ENABLE_EXTENSIONS) |
77 using extensions::ExperienceSamplingEvent; | 79 using extensions::ExperienceSamplingEvent; |
78 #endif | 80 #endif |
79 | 81 |
80 namespace { | 82 namespace { |
81 | 83 |
| 84 // URL for help page. |
| 85 const char kHelpURL[] = "https://support.google.com/chrome/answer/4454607"; |
| 86 |
82 // Constants for the Experience Sampling instrumentation. | 87 // Constants for the Experience Sampling instrumentation. |
83 #if defined(ENABLE_EXTENSIONS) | 88 #if defined(ENABLE_EXTENSIONS) |
84 const char kEventNameBase[] = "ssl_interstitial_"; | 89 const char kEventNameBase[] = "ssl_interstitial_"; |
85 const char kEventNotOverridable[] = "notoverridable_"; | 90 const char kEventNotOverridable[] = "notoverridable_"; |
86 const char kEventOverridable[] = "overridable_"; | 91 const char kEventOverridable[] = "overridable_"; |
87 #endif | 92 #endif |
88 | 93 |
89 // Events for UMA. Do not reorder or change! | 94 // Events for UMA. Do not reorder or change! |
90 enum SSLBlockingPageEvent { | 95 enum SSLBlockingPageEvent { |
91 SHOW_ALL, | 96 SHOW_ALL, |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 sampling_event_->set_has_viewed_details(true); | 581 sampling_event_->set_has_viewed_details(true); |
577 #endif | 582 #endif |
578 break; | 583 break; |
579 } | 584 } |
580 case CMD_RELOAD: { | 585 case CMD_RELOAD: { |
581 // The interstitial can't refresh itself. | 586 // The interstitial can't refresh itself. |
582 web_contents_->GetController().Reload(true); | 587 web_contents_->GetController().Reload(true); |
583 break; | 588 break; |
584 } | 589 } |
585 case CMD_HELP: { | 590 case CMD_HELP: { |
586 content::NavigationController::LoadURLParams help_page_params(GURL( | 591 content::NavigationController::LoadURLParams help_page_params( |
587 "https://support.google.com/chrome/answer/4454607")); | 592 google_util::AppendGoogleLocaleParam( |
| 593 GURL(kHelpURL), g_browser_process->GetApplicationLocale())); |
588 #if defined(ENABLE_EXTENSIONS) | 594 #if defined(ENABLE_EXTENSIONS) |
589 if (sampling_event_.get()) | 595 if (sampling_event_.get()) |
590 sampling_event_->set_has_viewed_learn_more(true); | 596 sampling_event_->set_has_viewed_learn_more(true); |
591 #endif | 597 #endif |
592 web_contents_->GetController().LoadURLWithParams(help_page_params); | 598 web_contents_->GetController().LoadURLWithParams(help_page_params); |
593 break; | 599 break; |
594 } | 600 } |
595 case CMD_CLOCK: { | 601 case CMD_CLOCK: { |
596 LaunchDateAndTimeSettings(); | 602 LaunchDateAndTimeSettings(); |
597 break; | 603 break; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 // sure we don't clear the captive portal flag, since the interstitial was | 720 // sure we don't clear the captive portal flag, since the interstitial was |
715 // potentially caused by the captive portal. | 721 // potentially caused by the captive portal. |
716 captive_portal_detected_ = captive_portal_detected_ || | 722 captive_portal_detected_ = captive_portal_detected_ || |
717 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 723 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
718 // Also keep track of non-HTTP portals and error cases. | 724 // Also keep track of non-HTTP portals and error cases. |
719 captive_portal_no_response_ = captive_portal_no_response_ || | 725 captive_portal_no_response_ = captive_portal_no_response_ || |
720 (results->result == captive_portal::RESULT_NO_RESPONSE); | 726 (results->result == captive_portal::RESULT_NO_RESPONSE); |
721 } | 727 } |
722 #endif | 728 #endif |
723 } | 729 } |
OLD | NEW |