| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 return; | 247 return; |
| 248 } | 248 } |
| 249 scoped_ptr<Value> registered_protocol_handlers(EncodeRegisteredHandlers()); | 249 scoped_ptr<Value> registered_protocol_handlers(EncodeRegisteredHandlers()); |
| 250 scoped_ptr<Value> ignored_protocol_handlers(EncodeIgnoredHandlers()); | 250 scoped_ptr<Value> ignored_protocol_handlers(EncodeIgnoredHandlers()); |
| 251 scoped_ptr<Value> enabled(Value::CreateBooleanValue(enabled_)); | 251 scoped_ptr<Value> enabled(Value::CreateBooleanValue(enabled_)); |
| 252 profile_->GetPrefs()->Set(prefs::kRegisteredProtocolHandlers, | 252 profile_->GetPrefs()->Set(prefs::kRegisteredProtocolHandlers, |
| 253 *registered_protocol_handlers); | 253 *registered_protocol_handlers); |
| 254 profile_->GetPrefs()->Set(prefs::kIgnoredProtocolHandlers, | 254 profile_->GetPrefs()->Set(prefs::kIgnoredProtocolHandlers, |
| 255 *ignored_protocol_handlers); | 255 *ignored_protocol_handlers); |
| 256 profile_->GetPrefs()->Set(prefs::kCustomHandlersEnabled, *enabled); | 256 profile_->GetPrefs()->Set(prefs::kCustomHandlersEnabled, *enabled); |
| 257 profile_->GetPrefs()->ScheduleSavePersistentPrefs(); | |
| 258 } | 257 } |
| 259 | 258 |
| 260 bool ProtocolHandlerRegistry::CanSchemeBeOverridden( | 259 bool ProtocolHandlerRegistry::CanSchemeBeOverridden( |
| 261 const std::string& scheme) const { | 260 const std::string& scheme) const { |
| 262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 261 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 263 const ProtocolHandlerList* handlers = GetHandlerList(scheme); | 262 const ProtocolHandlerList* handlers = GetHandlerList(scheme); |
| 264 // If we already have a handler for this scheme, we can add more. | 263 // If we already have a handler for this scheme, we can add more. |
| 265 if (handlers != NULL && !handlers->empty()) | 264 if (handlers != NULL && !handlers->empty()) |
| 266 return true; | 265 return true; |
| 267 // Don't override a scheme if it already has an external handler. | 266 // Don't override a scheme if it already has an external handler. |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 } | 689 } |
| 691 } else { | 690 } else { |
| 692 NOTREACHED(); | 691 NOTREACHED(); |
| 693 } | 692 } |
| 694 } | 693 } |
| 695 | 694 |
| 696 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker( | 695 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker( |
| 697 ShellIntegration::DefaultProtocolClientWorker* worker) { | 696 ShellIntegration::DefaultProtocolClientWorker* worker) { |
| 698 worker_ = worker; | 697 worker_ = worker; |
| 699 } | 698 } |
| OLD | NEW |