| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/stl_util-inl.h" | 12 #include "base/stl_util-inl.h" |
| 13 #include "chrome/browser/custom_handlers/protocol_handler.h" | 13 #include "chrome/browser/custom_handlers/protocol_handler.h" |
| 14 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" | 14 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" |
| 15 #include "chrome/browser/net/chrome_url_request_context.h" | 15 #include "chrome/browser/net/chrome_url_request_context.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile_io_data.h" | 17 #include "chrome/browser/profiles/profile_io_data.h" |
| 18 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 20 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
| 21 #include "content/browser/child_process_security_policy.h" | 22 #include "content/browser/child_process_security_policy.h" |
| 22 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
| 23 #include "net/base/network_delegate.h" | 24 #include "net/base/network_delegate.h" |
| 24 #include "net/url_request/url_request_redirect_job.h" | 25 #include "net/url_request/url_request_redirect_job.h" |
| 25 | 26 |
| 26 // ProtocolHandlerRegistry ----------------------------------------------------- | 27 // ProtocolHandlerRegistry ----------------------------------------------------- |
| 27 | 28 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 for (i = 0, p = handlers->begin(); p != handlers->end(); ++p, ++i) { | 470 for (i = 0, p = handlers->begin(); p != handlers->end(); ++p, ++i) { |
| 470 if (*p == handler) | 471 if (*p == handler) |
| 471 return i; | 472 return i; |
| 472 } | 473 } |
| 473 return -1; | 474 return -1; |
| 474 } | 475 } |
| 475 | 476 |
| 476 void ProtocolHandlerRegistry::NotifyChanged() { | 477 void ProtocolHandlerRegistry::NotifyChanged() { |
| 477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 478 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 478 NotificationService::current()->Notify( | 479 NotificationService::current()->Notify( |
| 479 NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED, | 480 chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, |
| 480 Source<Profile>(profile_), | 481 Source<Profile>(profile_), |
| 481 NotificationService::NoDetails()); | 482 NotificationService::NoDetails()); |
| 482 } | 483 } |
| 483 | 484 |
| 484 // IO thread methods ----------------------------------------------------------- | 485 // IO thread methods ----------------------------------------------------------- |
| 485 | 486 |
| 486 void ProtocolHandlerRegistry::ClearDefaultIO(const std::string& scheme) { | 487 void ProtocolHandlerRegistry::ClearDefaultIO(const std::string& scheme) { |
| 487 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 488 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 488 default_handlers_io_.erase(scheme); | 489 default_handlers_io_.erase(scheme); |
| 489 } | 490 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 registry_->RemoveDefaultHandler(worker_->protocol()); | 571 registry_->RemoveDefaultHandler(worker_->protocol()); |
| 571 } else { | 572 } else { |
| 572 NOTREACHED(); | 573 NOTREACHED(); |
| 573 } | 574 } |
| 574 } | 575 } |
| 575 | 576 |
| 576 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker( | 577 void ProtocolHandlerRegistry::DefaultClientObserver::SetWorker( |
| 577 ShellIntegration::DefaultProtocolClientWorker* worker) { | 578 ShellIntegration::DefaultProtocolClientWorker* worker) { |
| 578 worker_ = worker; | 579 worker_ = worker; |
| 579 } | 580 } |
| OLD | NEW |