| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 private: | 194 private: |
| 195 friend class base::RefCountedThreadSafe<ProtocolHandlerRegistry>; | 195 friend class base::RefCountedThreadSafe<ProtocolHandlerRegistry>; |
| 196 | 196 |
| 197 // Install the default handlers. |
| 198 void InstallFixedHandlers(); |
| 199 |
| 197 // Puts the given handler at the top of the list of handlers for its | 200 // Puts the given handler at the top of the list of handlers for its |
| 198 // protocol. | 201 // protocol. |
| 199 void PromoteHandler(const ProtocolHandler& handler); | 202 void PromoteHandler(const ProtocolHandler& handler); |
| 200 | 203 |
| 201 // Clears the default for the provided protocol. | 204 // Clears the default for the provided protocol. |
| 202 // Should be called only from the IO thread. | 205 // Should be called only from the IO thread. |
| 203 void ClearDefaultIO(const std::string& scheme); | 206 void ClearDefaultIO(const std::string& scheme); |
| 204 | 207 |
| 205 // Makes this ProtocolHandler the default handler for its protocol. | 208 // Makes this ProtocolHandler the default handler for its protocol. |
| 206 // Should be called only from the IO thread. | 209 // Should be called only from the IO thread. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // If false then registered protocol handlers will not be used to handle | 273 // If false then registered protocol handlers will not be used to handle |
| 271 // requests. | 274 // requests. |
| 272 bool enabled_; | 275 bool enabled_; |
| 273 | 276 |
| 274 // Copy of enabled_ that is only accessed on the IO thread. | 277 // Copy of enabled_ that is only accessed on the IO thread. |
| 275 bool enabled_io_; | 278 bool enabled_io_; |
| 276 | 279 |
| 277 // Whether or not we are loading. | 280 // Whether or not we are loading. |
| 278 bool is_loading_; | 281 bool is_loading_; |
| 279 | 282 |
| 283 // Once predefined defaults are set, this will be set and an overwrite of |
| 284 // them won't be possible anymore. |
| 285 bool fixed_handlers_loaded_; |
| 286 |
| 280 DefaultClientObserverList default_client_observers_; | 287 DefaultClientObserverList default_client_observers_; |
| 281 | 288 |
| 282 // Copy of default_handlers_ that is only accessed on the IO thread. | 289 // Copy of default_handlers_ that is only accessed on the IO thread. |
| 283 ProtocolHandlerMap default_handlers_io_; | 290 ProtocolHandlerMap default_handlers_io_; |
| 284 | 291 |
| 285 friend class ProtocolHandlerRegistryTest; | 292 friend class ProtocolHandlerRegistryTest; |
| 286 friend class RegisterProtocolHandlerBrowserTest; | 293 friend class RegisterProtocolHandlerBrowserTest; |
| 287 | 294 |
| 288 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); | 295 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); |
| 289 }; | 296 }; |
| 290 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 297 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
| OLD | NEW |