Chromium Code Reviews| 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 d81af988fc58af5d2e7f30e6b30679ff451d30bf..46bff5db78241e4cfe41f7f66f7ab223eec60820 100644 |
| --- a/chrome/browser/custom_handlers/protocol_handler_registry.cc |
| +++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/command_line.h" |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/utf_string_conversions.h" |
| #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h" |
| #include "chrome/browser/net/chrome_url_request_context.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| @@ -35,7 +36,8 @@ ProtocolHandlerRegistry::ProtocolHandlerRegistry(Profile* profile, |
| delegate_(delegate), |
| enabled_(true), |
| enabled_io_(enabled_), |
| - is_loading_(false) { |
| + is_loading_(false), |
| + is_loaded_(false) { |
| } |
| ProtocolHandlerRegistry::~ProtocolHandlerRegistry() { |
| @@ -195,6 +197,8 @@ bool ShouldRemoveHandlersNotInOS() { |
| } // namespace |
| 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(); |
| @@ -591,6 +595,13 @@ void ProtocolHandlerRegistry::NotifyChanged() { |
| content::NotificationService::NoDetails()); |
| } |
| +void ProtocolHandlerRegistry::AddFixedHandler(const ProtocolHandler& handler) { |
|
DaveMoore
2012/04/26 14:45:50
The name "Fixed" handler seems wrong. Isn't it a D
Mr4D (OOO till 08-26)
2012/04/26 16:34:37
Done. In deed. The meaning of this has changed due
koz (OOO until 15th September)
2012/04/30 02:11:26
No, fixed handler is right. "Default handler" is a
|
| + // If called after the load command was issued this function will fail. |
| + DCHECK(!is_loaded_); |
| + RegisterProtocolHandler(handler); |
| + SetDefault(handler); |
| +} |
| + |
| // IO thread methods ----------------------------------------------------------- |
| void ProtocolHandlerRegistry::ClearDefaultIO(const std::string& scheme) { |