Chromium Code Reviews| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 | 184 |
| 185 // This is called by the UI thread when the system is shutting down. This | 185 // This is called by the UI thread when the system is shutting down. This |
| 186 // does finalization which must be done on the UI thread. | 186 // does finalization which must be done on the UI thread. |
| 187 void Finalize(); | 187 void Finalize(); |
| 188 | 188 |
| 189 // Registers the preferences that we store registered protocol handlers in. | 189 // Registers the preferences that we store registered protocol handlers in. |
| 190 static void RegisterPrefs(PrefService* prefService); | 190 static void RegisterPrefs(PrefService* prefService); |
| 191 | 191 |
| 192 bool enabled() const { return enabled_; } | 192 bool enabled() const { return enabled_; } |
| 193 | 193 |
| 194 // Add a predefined protocol handler. This has to be called before the first | |
| 195 // load command was issued, otherwise the command will be ignored. | |
| 196 void AddFixedHandler(const ProtocolHandler& handler); | |
| 197 | |
| 194 private: | 198 private: |
| 195 friend class base::RefCountedThreadSafe<ProtocolHandlerRegistry>; | 199 friend class base::RefCountedThreadSafe<ProtocolHandlerRegistry>; |
| 196 | 200 |
| 197 // Puts the given handler at the top of the list of handlers for its | 201 // Puts the given handler at the top of the list of handlers for its |
| 198 // protocol. | 202 // protocol. |
| 199 void PromoteHandler(const ProtocolHandler& handler); | 203 void PromoteHandler(const ProtocolHandler& handler); |
| 200 | 204 |
| 201 // Clears the default for the provided protocol. | 205 // Clears the default for the provided protocol. |
| 202 // Should be called only from the IO thread. | 206 // Should be called only from the IO thread. |
| 203 void ClearDefaultIO(const std::string& scheme); | 207 void ClearDefaultIO(const std::string& scheme); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 // If false then registered protocol handlers will not be used to handle | 274 // If false then registered protocol handlers will not be used to handle |
| 271 // requests. | 275 // requests. |
| 272 bool enabled_; | 276 bool enabled_; |
| 273 | 277 |
| 274 // Copy of enabled_ that is only accessed on the IO thread. | 278 // Copy of enabled_ that is only accessed on the IO thread. |
| 275 bool enabled_io_; | 279 bool enabled_io_; |
| 276 | 280 |
| 277 // Whether or not we are loading. | 281 // Whether or not we are loading. |
| 278 bool is_loading_; | 282 bool is_loading_; |
| 279 | 283 |
| 284 // When the table gets loaded this flag will be set and any further calls to | |
| 285 // AddFixedHandler will be rejected. | |
| 286 bool is_loaded_; | |
|
benwells
2012/04/26 00:34:42
Why is this necessary?
Mr4D (OOO till 08-26)
2012/04/26 13:46:35
It is a "debugging" helper: Default handlers can o
| |
| 287 | |
| 280 DefaultClientObserverList default_client_observers_; | 288 DefaultClientObserverList default_client_observers_; |
| 281 | 289 |
| 282 // Copy of default_handlers_ that is only accessed on the IO thread. | 290 // Copy of default_handlers_ that is only accessed on the IO thread. |
| 283 ProtocolHandlerMap default_handlers_io_; | 291 ProtocolHandlerMap default_handlers_io_; |
| 284 | 292 |
| 285 friend class ProtocolHandlerRegistryTest; | 293 friend class ProtocolHandlerRegistryTest; |
| 286 friend class RegisterProtocolHandlerBrowserTest; | 294 friend class RegisterProtocolHandlerBrowserTest; |
| 287 | 295 |
| 288 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); | 296 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); |
| 289 }; | 297 }; |
| 290 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 298 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
| OLD | NEW |