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

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

Issue 518673003: Add policy indicator for protocol handlers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes nits Created 6 years, 4 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 74188c62824c7a1213e1a22b08dc1530361743ee..0818bf837c0b2f6aa8a7510acf9a32177d8e9926 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -533,6 +533,17 @@ bool ProtocolHandlerRegistry::IsRegistered(
handlers->end();
}
+bool ProtocolHandlerRegistry::IsRegisteredByUser(
+ const ProtocolHandler& handler) {
+ return HandlerExists(handler, &user_protocol_handlers_);
+}
+
+bool ProtocolHandlerRegistry::HasPolicyRegisteredHandler(
+ const std::string& scheme) {
+ return (policy_protocol_handlers_.find(scheme) !=
+ policy_protocol_handlers_.end());
+}
+
bool ProtocolHandlerRegistry::IsIgnored(const ProtocolHandler& handler) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ProtocolHandlerList::const_iterator i;
@@ -605,10 +616,9 @@ void ProtocolHandlerRegistry::RemoveHandler(
if (HandlerExists(handler, handlers) &&
HandlerExists(handler, &user_protocol_handlers_)) {
EraseHandler(handler, &user_protocol_handlers_);
- if (!HandlerExists(handler, &policy_protocol_handlers_)) {
- erase_success = true;
+ erase_success = true;
+ if (!HandlerExists(handler, &policy_protocol_handlers_))
EraseHandler(handler, &protocol_handlers_);
- }
}
ProtocolHandlerMap::iterator q = default_handlers_.find(handler.protocol());
if (erase_success && q != default_handlers_.end() && q->second == handler) {

Powered by Google App Engine
This is Rietveld 408576698