| 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);
|
| +}
|
| +
|
| +
|
|
|