Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 NET_BASE_SDCH_OBSERVER_H_ | 5 #ifndef NET_BASE_SDCH_OBSERVER_H_ |
| 6 #define NET_BASE_SDCH_OBSERVER_H_ | 6 #define NET_BASE_SDCH_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class SdchManager; | 17 class SdchManager; |
| 18 | 18 |
| 19 // Observer interface for SDCH. Observers can register with | 19 // Observer interface for SDCH. Observers can register with |
| 20 // the SdchManager to receive notifications of various SDCH events. | 20 // the SdchManager to receive notifications of various SDCH events. |
| 21 class NET_EXPORT SdchObserver { | 21 class NET_EXPORT SdchObserver { |
| 22 public: | 22 public: |
| 23 virtual ~SdchObserver(); | 23 virtual ~SdchObserver(); |
| 24 | 24 |
| 25 // TODO(rdsmith): Add Added/Removed signals. These are only needed if | 25 // A dictionary has been added to the observed manager. |
| 26 // we end up with an implementation in which more than one observer | 26 virtual void OnDictionaryAdded(SdchManager* manager, |
| 27 // generates Add/Removed events; otherwise, tracking can be done internally. | 27 const GURL& dictionary_url, |
| 28 const std::string& server_hash) = 0; | |
| 29 | |
| 30 // A dictionary has been removed from the observed manager. | |
|
mmenke
2015/05/12 15:46:42
Should mention this isn't called on clear.
Elly Fong-Jones
2015/05/14 19:29:28
Done.
| |
| 31 virtual void OnDictionaryRemoved(SdchManager* manager, | |
| 32 const std::string& server_hash) = 0; | |
| 28 | 33 |
| 29 // TODO(rdsmith): Add signal that an Avail-Dictionary header was generated. | 34 // TODO(rdsmith): Add signal that an Avail-Dictionary header was generated. |
| 30 // Should be added if/when an observer wants to use it to fine-tune | 35 // Should be added if/when an observer wants to use it to fine-tune |
| 31 // dictionary deprecation (e.g. if Avail-Dictionary is generated and | 36 // dictionary deprecation (e.g. if Avail-Dictionary is generated and |
| 32 // the remote *doesn't* use it, that should deprecate the dictionary faster) | 37 // the remote *doesn't* use it, that should deprecate the dictionary faster) |
| 33 | 38 |
| 34 // A SDCH encoded response was received and the specified dictionary | 39 // A SDCH encoded response was received and the specified dictionary |
| 35 // was used to decode it. This notification only occurs for successful | 40 // was used to decode it. This notification only occurs for successful |
| 36 // decodes. Note that this notification may occur for dictionaries that | 41 // decodes. Note that this notification may occur for dictionaries that |
| 37 // have been deleted from the SdchManager, since DictionarySets retain | 42 // have been deleted from the SdchManager, since DictionarySets retain |
| 38 // references to deleted dictionaries. Observers must handle this case. | 43 // references to deleted dictionaries. Observers must handle this case. |
| 39 // TODO(rdsmith): Should this notification indicate how much | 44 // TODO(rdsmith): Should this notification indicate how much |
| 40 // compression the dictionary provided? | 45 // compression the dictionary provided? |
| 41 virtual void OnDictionaryUsed(SdchManager* manager, | 46 virtual void OnDictionaryUsed(SdchManager* manager, |
| 42 const std::string& server_hash) = 0; | 47 const std::string& server_hash) = 0; |
| 43 | 48 |
| 44 // A "Get-Dictionary" header has been seen. | 49 // A "Get-Dictionary" header has been seen. |
| 45 virtual void OnGetDictionary(SdchManager* manager, | 50 virtual void OnGetDictionary(SdchManager* manager, |
| 46 const GURL& request_url, | 51 const GURL& request_url, |
| 47 const GURL& dictionary_url) = 0; | 52 const GURL& dictionary_url) = 0; |
| 48 | 53 |
| 49 // Notification that SDCH has received a request to clear all | 54 // Notification that SDCH has received a request to clear all |
| 50 // its dictionaries. | 55 // its dictionaries. |
| 51 virtual void OnClearDictionaries(SdchManager* manager) = 0; | 56 virtual void OnClearDictionaries(SdchManager* manager) = 0; |
| 52 }; | 57 }; |
| 53 | 58 |
| 54 } // namespace net | 59 } // namespace net |
| 55 | 60 |
| 56 #endif // NET_BASE_SDCH_MANAGER_H_ | 61 #endif // NET_BASE_SDCH_MANAGER_H_ |
| OLD | NEW |