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

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: Addressed 4th review 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 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) {
+ // 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) {

Powered by Google App Engine
This is Rietveld 408576698