Chromium Code Reviews| 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 base::Value* EncodeRegisteredHandlers(); | 280 base::Value* EncodeRegisteredHandlers(); |
| 281 | 281 |
| 282 // Returns a JSON list of ignored protocol handlers. The caller is | 282 // Returns a JSON list of ignored protocol handlers. The caller is |
| 283 // responsible for deleting this Value. | 283 // responsible for deleting this Value. |
| 284 base::Value* EncodeIgnoredHandlers(); | 284 base::Value* EncodeIgnoredHandlers(); |
| 285 | 285 |
| 286 // Sends a notification of the given type to the NotificationService. | 286 // Sends a notification of the given type to the NotificationService. |
| 287 void NotifyChanged(); | 287 void NotifyChanged(); |
| 288 | 288 |
| 289 // Registers a new protocol handler. | 289 // Registers a new protocol handler. |
| 290 void RegisterProtocolHandler(const ProtocolHandler& handler); | 290 void RegisterProtocolHandler(const ProtocolHandler& handler, |
| 291 const bool policy_managed); | |
|
koz (OOO until 15th September)
2014/05/22 00:51:31
Can you replace the bool here with an enum, e.g.
kaliamoorthi
2014/05/30 10:01:09
Done.
| |
| 291 | 292 |
| 292 // Get the DictionaryValues stored under the given pref name that are valid | 293 // Get the DictionaryValues stored under the given pref name that are valid |
| 293 // ProtocolHandler values. | 294 // ProtocolHandler values. |
| 294 std::vector<const base::DictionaryValue*> GetHandlersFromPref( | 295 std::vector<const base::DictionaryValue*> GetHandlersFromPref( |
| 295 const char* pref_name) const; | 296 const char* pref_name) const; |
| 296 | 297 |
| 297 // Ignores future requests to register the given protocol handler. | 298 // Ignores future requests to register the given protocol handler. |
| 298 void IgnoreProtocolHandler(const ProtocolHandler& handler); | 299 void IgnoreProtocolHandler(const ProtocolHandler& handler, |
| 300 const bool policy_managed); | |
| 301 | |
| 302 bool HandlerExists(const ProtocolHandler& handler, | |
| 303 ProtocolHandlerMultiMap* map); | |
| 304 | |
| 305 bool HandlerExists(const ProtocolHandler& handler, | |
| 306 const ProtocolHandlerList& list); | |
| 307 | |
| 308 void EraseHandler(const ProtocolHandler& handler, | |
| 309 ProtocolHandlerMultiMap* map); | |
| 310 | |
| 311 void EraseHandler(const ProtocolHandler& handler, ProtocolHandlerList* list); | |
| 299 | 312 |
| 300 // Map from protocols (strings) to protocol handlers. | 313 // Map from protocols (strings) to protocol handlers. |
| 301 ProtocolHandlerMultiMap protocol_handlers_; | 314 ProtocolHandlerMultiMap protocol_handlers_; |
| 302 | 315 |
| 303 // Protocol handlers that the user has told us to ignore. | 316 // Protocol handlers that the user has told us to ignore. |
| 304 ProtocolHandlerList ignored_protocol_handlers_; | 317 ProtocolHandlerList ignored_protocol_handlers_; |
| 305 | 318 |
| 319 // User/policy specific Map from protocols (strings) to protocol handlers. | |
| 320 ProtocolHandlerMultiMap user_protocol_handlers_; | |
|
koz (OOO until 15th September)
2014/05/22 00:51:31
I think this comment could be a bit clearer, e.g.
kaliamoorthi
2014/05/30 10:01:09
Done.
| |
| 321 ProtocolHandlerMultiMap policy_protocol_handlers_; | |
| 322 | |
| 323 // Protocol handlers that the user/policy has told us to ignore. | |
| 324 ProtocolHandlerList user_ignored_protocol_handlers_; | |
| 325 ProtocolHandlerList policy_ignored_protocol_handlers_; | |
| 326 | |
| 306 // Protocol handlers that are the defaults for a given protocol. | 327 // Protocol handlers that are the defaults for a given protocol. |
| 307 ProtocolHandlerMap default_handlers_; | 328 ProtocolHandlerMap default_handlers_; |
| 308 | 329 |
| 309 // The Profile that owns this ProtocolHandlerRegistry. | 330 // The Profile that owns this ProtocolHandlerRegistry. |
| 310 Profile* profile_; | 331 Profile* profile_; |
| 311 | 332 |
| 312 // The Delegate that registers / deregisters external handlers on our behalf. | 333 // The Delegate that registers / deregisters external handlers on our behalf. |
| 313 scoped_ptr<Delegate> delegate_; | 334 scoped_ptr<Delegate> delegate_; |
| 314 | 335 |
| 315 // If false then registered protocol handlers will not be used to handle | 336 // If false then registered protocol handlers will not be used to handle |
| 316 // requests. | 337 // requests. |
| 317 bool enabled_; | 338 bool enabled_; |
| 318 | 339 |
| 319 // Whether or not we are loading. | 340 // Whether or not we are loading. |
| 320 bool is_loading_; | 341 bool is_loading_; |
| 321 | 342 |
| 322 // When the table gets loaded this flag will be set and any further calls to | 343 // When the table gets loaded this flag will be set and any further calls to |
| 323 // AddPredefinedHandler will be rejected. | 344 // AddPredefinedHandler will be rejected. |
| 324 bool is_loaded_; | 345 bool is_loaded_; |
| 325 | 346 |
| 326 // Copy of registry data for use on the IO thread. Changes to the registry | 347 // Copy of registry data for use on the IO thread. Changes to the registry |
| 327 // are posted to the IO thread where updates are applied to this object. | 348 // are posted to the IO thread where updates are applied to this object. |
| 328 scoped_refptr<IOThreadDelegate> io_thread_delegate_; | 349 scoped_refptr<IOThreadDelegate> io_thread_delegate_; |
| 329 | 350 |
| 330 DefaultClientObserverList default_client_observers_; | 351 DefaultClientObserverList default_client_observers_; |
| 331 | 352 |
| 332 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); | 353 DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistry); |
| 333 }; | 354 }; |
| 334 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ | 355 #endif // CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ |
| OLD | NEW |