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

Unified Diff: chrome/browser/custom_handlers/protocol_handler_registry.cc

Issue 10139002: Preventing our default handlers for ChromeOS to show up or confuse the user (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Resolving merge issues Created 8 years, 8 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/custom_handlers/protocol_handler_registry.cc
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index ab8753a58b5fab79be1633c088a6bdec5088e091..aee6ea0b76060233fd1c8ecc11a5bc0b65b93a6f 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -151,7 +151,8 @@ ProtocolHandlerRegistry::ProtocolHandlerRegistry(Profile* profile,
delegate_(delegate),
enabled_(true),
enabled_io_(enabled_),
- is_loading_(false) {
+ is_loading_(false),
+ is_loaded_(false) {
}
bool ProtocolHandlerRegistry::SilentlyHandleRegisterHandlerRequest(
@@ -247,6 +248,8 @@ bool ProtocolHandlerRegistry::IsDefault(
}
void ProtocolHandlerRegistry::Load() {
+ // Any further default additions to the table will get rejected from now on.
+ is_loaded_ = true;
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
is_loading_ = true;
PrefService* prefs = profile_->GetPrefs();
@@ -708,3 +711,13 @@ void ProtocolHandlerRegistry::IgnoreProtocolHandler(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ignored_protocol_handlers_.push_back(handler);
}
+
+void ProtocolHandlerRegistry::AddDefaultHandler(
+ const ProtocolHandler& handler) {
+ // If called after the load command was issued this function will fail.
+ DCHECK(!is_loaded_);
+ RegisterProtocolHandler(handler);
+ SetDefault(handler);
+}
+
+

Powered by Google App Engine
This is Rietveld 408576698