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> |
| 9 |
8 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
9 | 11 |
10 class GURL; | 12 class GURL; |
11 | 13 |
12 namespace net { | 14 namespace net { |
13 | 15 |
14 class SdchManager; | 16 class SdchManager; |
15 | 17 |
16 // Observer interface for SDCH. Observers can register with | 18 // Observer interface for SDCH. Observers can register with |
17 // the SdchManager to receive notifications of various SDCH events. | 19 // the SdchManager to receive notifications of various SDCH events. |
18 class NET_EXPORT SdchObserver { | 20 class NET_EXPORT SdchObserver { |
19 public: | 21 public: |
20 virtual ~SdchObserver(); | 22 virtual ~SdchObserver(); |
21 | 23 |
22 // Notification that SDCH has seen a "Get-Dictionary" header. | 24 // TODO(rdsmith): Add Added/Removed signals. These are only needed if |
| 25 // we end up with an implementation in which more than one observer |
| 26 // generates Add/Removed events; otherwise, tracking can be done internally. |
| 27 |
| 28 // TODO(rdsmith): Add signal that an Avail-Dictionary header was generated. |
| 29 // Should be added if/when an observer wants to use it to fine-tune |
| 30 // dictionary deprecation (e.g. if Avail-Dictionary is generated and |
| 31 // the remote *doesn't* use it, that should deprecate the dictionary faster) |
| 32 |
| 33 // A SDCH encoded response was received and the specified dictionary |
| 34 // was used to decode it. This notification only occurs for successful |
| 35 // decodes. |
| 36 // TODO(rdsmith): Should this notification indicate how much |
| 37 // compression the dictionary provided? |
| 38 virtual void OnDictionaryUsed(SdchManager* manager, |
| 39 const std::string& server_hash) = 0; |
| 40 |
| 41 // A "Get-Dictionary" header has been seen. |
23 virtual void OnGetDictionary(SdchManager* manager, | 42 virtual void OnGetDictionary(SdchManager* manager, |
24 const GURL& request_url, | 43 const GURL& request_url, |
25 const GURL& dictionary_url) = 0; | 44 const GURL& dictionary_url) = 0; |
26 | 45 |
27 // Notification that SDCH has received a request to clear all | 46 // Notification that SDCH has received a request to clear all |
28 // its dictionaries. | 47 // its dictionaries. |
29 virtual void OnClearDictionaries(SdchManager* manager) = 0; | 48 virtual void OnClearDictionaries(SdchManager* manager) = 0; |
30 }; | 49 }; |
31 | 50 |
32 } // namespace net | 51 } // namespace net |
33 | 52 |
34 #endif // NET_BASE_SDCH_MANAGER_H_ | 53 #endif // NET_BASE_SDCH_MANAGER_H_ |
OLD | NEW |