OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 AddDefaultHandler(const ProtocolHandler& handler); | |
197 | |
194 private: | 198 private: |
195 friend class base::DeleteHelper<ProtocolHandlerRegistry>; | 199 friend class base::DeleteHelper<ProtocolHandlerRegistry>; |
196 friend struct content::BrowserThread::DeleteOnThread< | 200 friend struct content::BrowserThread::DeleteOnThread< |
197 content::BrowserThread::IO>; | 201 content::BrowserThread::IO>; |
198 friend class ProtocolHandlerRegistryTest; | 202 friend class ProtocolHandlerRegistryTest; |
199 friend class RegisterProtocolHandlerBrowserTest; | 203 friend class RegisterProtocolHandlerBrowserTest; |
200 | 204 |
201 ~ProtocolHandlerRegistry(); | 205 ~ProtocolHandlerRegistry(); |
202 | 206 |
203 // Puts the given handler at the top of the list of handlers for its | 207 // Puts the given handler at the top of the list of handlers for its |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 // If false then registered protocol handlers will not be used to handle | 277 // If false then registered protocol handlers will not be used to handle |
274 // requests. | 278 // requests. |
275 bool enabled_; | 279 bool enabled_; |
276 | 280 |
277 // Copy of enabled_ that is only accessed on the IO thread. | 281 // Copy of enabled_ that is only accessed on the IO thread. |
278 bool enabled_io_; | 282 bool enabled_io_; |
279 | 283 |
280 // Whether or not we are loading. | 284 // Whether or not we are loading. |
281 bool is_loading_; | 285 bool is_loading_; |
282 | 286 |
287 // When the table gets loaded this flag will be set and any further calls to | |
288 // AddDefaultHandler will be rejected. | |
289 bool is_loaded_; | |
tony
2012/04/27 22:17:15
Nit: has_loaded_ is more grammatically correct.
| |
290 | |
283 DefaultClientObserverList default_client_observers_; | 291 DefaultClientObserverList default_client_observers_; |
284 | 292 |
285 // Copy of default_handlers_ that is only accessed on the IO thread. | 293 // Copy of default_handlers_ that is only accessed on the IO thread. |
286 ProtocolHandlerMap default_handlers_io_; | 294 ProtocolHandlerMap default_handlers_io_; |
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 |