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 #ifndef CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
6 #define CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 6 #define CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 }; | 79 }; |
80 | 80 |
81 typedef std::map<std::string, ProtocolHandler> ProtocolHandlerMap; | 81 typedef std::map<std::string, ProtocolHandler> ProtocolHandlerMap; |
82 typedef std::vector<ProtocolHandler> ProtocolHandlerList; | 82 typedef std::vector<ProtocolHandler> ProtocolHandlerList; |
83 typedef std::map<std::string, ProtocolHandlerList> ProtocolHandlerMultiMap; | 83 typedef std::map<std::string, ProtocolHandlerList> ProtocolHandlerMultiMap; |
84 typedef std::vector<DefaultClientObserver*> DefaultClientObserverList; | 84 typedef std::vector<DefaultClientObserver*> DefaultClientObserverList; |
85 | 85 |
86 ProtocolHandlerRegistry(Profile* profile, Delegate* delegate); | 86 ProtocolHandlerRegistry(Profile* profile, Delegate* delegate); |
87 ~ProtocolHandlerRegistry(); | 87 ~ProtocolHandlerRegistry(); |
88 | 88 |
| 89 // Called when a site tries to register as a protocol handler. If the request |
| 90 // can be handled silently by the registry - either to ignore the request |
| 91 // or to update an existing handler - the request will succeed. If this |
| 92 // function returns false the user needs to be prompted for confirmation. |
| 93 bool SilentlyHandleRegisterHandlerRequest(const ProtocolHandler& handler); |
| 94 |
89 // Called when the user accepts the registration of a given protocol handler. | 95 // Called when the user accepts the registration of a given protocol handler. |
90 void OnAcceptRegisterProtocolHandler(const ProtocolHandler& handler); | 96 void OnAcceptRegisterProtocolHandler(const ProtocolHandler& handler); |
91 | 97 |
92 // Called when the user denies the registration of a given protocol handler. | 98 // Called when the user denies the registration of a given protocol handler. |
93 void OnDenyRegisterProtocolHandler(const ProtocolHandler& handler); | 99 void OnDenyRegisterProtocolHandler(const ProtocolHandler& handler); |
94 | 100 |
95 // Called when the user indicates that they don't want to be asked about the | 101 // Called when the user indicates that they don't want to be asked about the |
96 // given protocol handler again. | 102 // given protocol handler again. |
97 void OnIgnoreRegisterProtocolHandler(const ProtocolHandler& handler); | 103 void OnIgnoreRegisterProtocolHandler(const ProtocolHandler& handler); |
98 | 104 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 DefaultClientObserverList default_client_observers_; | 280 DefaultClientObserverList default_client_observers_; |
275 | 281 |
276 // Copy of default_handlers_ that is only accessed on the IO thread. | 282 // Copy of default_handlers_ that is only accessed on the IO thread. |
277 ProtocolHandlerMap default_handlers_io_; | 283 ProtocolHandlerMap default_handlers_io_; |
278 | 284 |
279 friend class ProtocolHandlerRegistryTest; | 285 friend class ProtocolHandlerRegistryTest; |
280 | 286 |
281 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); | 287 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); |
282 }; | 288 }; |
283 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 289 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
OLD | NEW |