| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 return; | 250 return; |
| 251 } | 251 } |
| 252 scoped_ptr<Value> registered_protocol_handlers(EncodeRegisteredHandlers()); | 252 scoped_ptr<Value> registered_protocol_handlers(EncodeRegisteredHandlers()); |
| 253 scoped_ptr<Value> ignored_protocol_handlers(EncodeIgnoredHandlers()); | 253 scoped_ptr<Value> ignored_protocol_handlers(EncodeIgnoredHandlers()); |
| 254 scoped_ptr<Value> enabled(Value::CreateBooleanValue(enabled_)); | 254 scoped_ptr<Value> enabled(Value::CreateBooleanValue(enabled_)); |
| 255 profile_->GetPrefs()->Set(prefs::kRegisteredProtocolHandlers, | 255 profile_->GetPrefs()->Set(prefs::kRegisteredProtocolHandlers, |
| 256 *registered_protocol_handlers); | 256 *registered_protocol_handlers); |
| 257 profile_->GetPrefs()->Set(prefs::kIgnoredProtocolHandlers, | 257 profile_->GetPrefs()->Set(prefs::kIgnoredProtocolHandlers, |
| 258 *ignored_protocol_handlers); | 258 *ignored_protocol_handlers); |
| 259 profile_->GetPrefs()->Set(prefs::kCustomHandlersEnabled, *enabled); | 259 profile_->GetPrefs()->Set(prefs::kCustomHandlersEnabled, *enabled); |
| 260 profile_->GetPrefs()->ScheduleSavePersistentPrefs(); | |
| 261 } | 260 } |
| 262 | 261 |
| 263 bool ProtocolHandlerRegistry::CanSchemeBeOverridden( | 262 bool ProtocolHandlerRegistry::CanSchemeBeOverridden( |
| 264 const std::string& scheme) const { | 263 const std::string& scheme) const { |
| 265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 266 const ProtocolHandlerList* handlers = GetHandlerList(scheme); | 265 const ProtocolHandlerList* handlers = GetHandlerList(scheme); |
| 267 // If we already have a handler for this scheme, we can add more. | 266 // If we already have a handler for this scheme, we can add more. |
| 268 if (handlers != NULL && !handlers->empty()) | 267 if (handlers != NULL && !handlers->empty()) |
| 269 return true; | 268 return true; |
| 270 // Don't override a scheme if it already has an external handler. | 269 // Don't override a scheme if it already has an external handler. |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 } | 705 } |
| 707 } else { | 706 } else { |
| 708 NOTREACHED(); | 707 NOTREACHED(); |
| 709 } | 708 } |
| 710 } | 709 } |
| 711 | 710 |
| 712 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker( | 711 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker( |
| 713 ShellIntegration::DefaultProtocolClientWorker* worker) { | 712 ShellIntegration::DefaultProtocolClientWorker* worker) { |
| 714 worker_ = worker; | 713 worker_ = worker; |
| 715 } | 714 } |
| OLD | NEW |