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