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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // registration for a protocol is no longer Chrome. | 167 // registration for a protocol is no longer Chrome. |
168 bool ShouldRemoveHandlersNotInOS() { | 168 bool ShouldRemoveHandlersNotInOS() { |
169 #if defined(OS_LINUX) | 169 #if defined(OS_LINUX) |
170 // We don't do this on Linux as the OS registration there is not reliable, | 170 // We don't do this on Linux as the OS registration there is not reliable, |
171 // and Chrome OS doesn't have any notion of OS registration. | 171 // and Chrome OS doesn't have any notion of OS registration. |
172 // TODO(benwells): When Linux support is more reliable remove this | 172 // TODO(benwells): When Linux support is more reliable remove this |
173 // difference (http://crbug.com/88255). | 173 // difference (http://crbug.com/88255). |
174 return false; | 174 return false; |
175 #else | 175 #else |
176 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 176 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
177 return !cmd_line.HasSwitch(switches::kDisableCustomProtocolOSCheck); | 177 return ShellIntegration::CanSetAsDefaultProtocolClient() && |
| 178 !cmd_line.HasSwitch(switches::kDisableCustomProtocolOSCheck); |
178 #endif | 179 #endif |
179 } | 180 } |
180 | 181 |
181 } // namespace | 182 } // namespace |
182 | 183 |
183 void ProtocolHandlerRegistry::Load() { | 184 void ProtocolHandlerRegistry::Load() { |
184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 185 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
185 is_loading_ = true; | 186 is_loading_ = true; |
186 PrefService* prefs = profile_->GetPrefs(); | 187 PrefService* prefs = profile_->GetPrefs(); |
187 if (prefs->HasPrefPath(prefs::kCustomHandlersEnabled)) { | 188 if (prefs->HasPrefPath(prefs::kCustomHandlersEnabled)) { |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 registry_->RemoveDefaultHandler(worker_->protocol()); | 572 registry_->RemoveDefaultHandler(worker_->protocol()); |
572 } else { | 573 } else { |
573 NOTREACHED(); | 574 NOTREACHED(); |
574 } | 575 } |
575 } | 576 } |
576 | 577 |
577 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker( | 578 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker( |
578 ShellIntegration::DefaultProtocolClientWorker* worker) { | 579 ShellIntegration::DefaultProtocolClientWorker* worker) { |
579 worker_ = worker; | 580 worker_ = worker; |
580 } | 581 } |
OLD | NEW |