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

Unified Diff: chrome/browser/external_protocol/external_protocol_handler.cc

Issue 2076253002: Simplify the text in the external protocol confirmation dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ChromeOS compile Created 4 years, 2 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
Index: chrome/browser/external_protocol/external_protocol_handler.cc
diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc
index 540ffbafe93572eab5b343b4c2dabcd895ca1907..2e4dcc1aaa251c9fd1a34d00cc89b0ae108ed734 100644
--- a/chrome/browser/external_protocol/external_protocol_handler.cc
+++ b/chrome/browser/external_protocol/external_protocol_handler.cc
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
@@ -131,57 +132,6 @@ void OnDefaultProtocolClientWorkerFinished(
} // namespace
// static
-void ExternalProtocolHandler::PrepopulateDictionary(
- base::DictionaryValue* win_pref) {
- static bool is_warm = false;
- if (is_warm)
- return;
- is_warm = true;
-
- static const char* const denied_schemes[] = {
- "afp",
- "data",
- "disk",
- "disks",
- // ShellExecuting file:///C:/WINDOWS/system32/notepad.exe will simply
- // execute the file specified! Hopefully we won't see any "file" schemes
- // because we think of file:// URLs as handled URLs, but better to be safe
- // than to let an attacker format the user's hard drive.
- "file",
- "hcp",
- "javascript",
- "ms-help",
- "nntp",
- "shell",
- "vbscript",
- // view-source is a special case in chrome. When it comes through an
- // iframe or a redirect, it looks like an external protocol, but we don't
- // want to shellexecute it.
- "view-source",
- "vnd.ms.radio",
- };
-
- static const char* const allowed_schemes[] = {
- "mailto",
- "news",
- "snews",
- };
-
- bool should_block;
- for (size_t i = 0; i < arraysize(denied_schemes); ++i) {
- if (!win_pref->GetBoolean(denied_schemes[i], &should_block)) {
- win_pref->SetBoolean(denied_schemes[i], true);
- }
- }
-
- for (size_t i = 0; i < arraysize(allowed_schemes); ++i) {
- if (!win_pref->GetBoolean(allowed_schemes[i], &should_block)) {
- win_pref->SetBoolean(allowed_schemes[i], false);
- }
- }
-}
-
-// static
ExternalProtocolHandler::BlockState ExternalProtocolHandler::GetBlockState(
const std::string& scheme) {
// If we are being carpet bombed, block the request.
@@ -284,12 +234,69 @@ void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(
}
// static
-void ExternalProtocolHandler::RegisterPrefs(PrefRegistrySimple* registry) {
- registry->RegisterDictionaryPref(prefs::kExcludedSchemes);
-}
-
-// static
void ExternalProtocolHandler::PermitLaunchUrl() {
DCHECK(base::MessageLoopForUI::IsCurrent());
g_accept_requests = true;
}
+
+// static
+void ExternalProtocolHandler::PrepopulateDictionary(
+ base::DictionaryValue* win_pref) {
+ static bool is_warm = false;
+ if (is_warm)
+ return;
+ is_warm = true;
+
+ static const char* const denied_schemes[] = {
+ "afp",
+ "data",
+ "disk",
+ "disks",
+ // ShellExecuting file:///C:/WINDOWS/system32/notepad.exe will simply
+ // execute the file specified! Hopefully we won't see any "file" schemes
+ // because we think of file:// URLs as handled URLs, but better to be safe
+ // than to let an attacker format the user's hard drive.
+ "file",
+ "hcp",
+ "javascript",
+ "ms-help",
+ "nntp",
+ "shell",
+ "vbscript",
+ // view-source is a special case in chrome. When it comes through an
+ // iframe or a redirect, it looks like an external protocol, but we don't
+ // want to shellexecute it.
+ "view-source",
+ "vnd.ms.radio",
+ };
+
+ static const char* const allowed_schemes[] = {
+ "mailto",
+ "news",
+ "snews",
+ };
+
+ bool should_block;
+ for (size_t i = 0; i < arraysize(denied_schemes); ++i) {
+ if (!win_pref->GetBoolean(denied_schemes[i], &should_block)) {
+ win_pref->SetBoolean(denied_schemes[i], true);
+ }
+ }
+
+ for (size_t i = 0; i < arraysize(allowed_schemes); ++i) {
+ if (!win_pref->GetBoolean(allowed_schemes[i], &should_block)) {
+ win_pref->SetBoolean(allowed_schemes[i], false);
+ }
+ }
+}
+
+// static
+void ExternalProtocolHandler::RecordMetrics(bool selected) {
+ UMA_HISTOGRAM_BOOLEAN("BrowserDialogs.ExternalProtocol.RememberCheckbox",
+ selected);
+}
+
+// static
+void ExternalProtocolHandler::RegisterPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(prefs::kExcludedSchemes);
+}

Powered by Google App Engine
This is Rietveld 408576698