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
3 // found in the LICENSE file.
5 #ifndef NET_BASE_SDCH_OBSERVER_H_
6 #define NET_BASE_SDCH_OBSERVER_H_
11 #include "net/base/net_export.h"
19 // Observer interface for SDCH. Observers can register with
20 // the SdchManager to receive notifications of various SDCH events.
21 class NET_EXPORT SdchObserver
{
23 virtual ~SdchObserver();
25 // A dictionary has been added to the observed manager.
26 virtual void OnDictionaryAdded(const GURL
& dictionary_url
,
27 const std::string
& server_hash
) = 0;
29 // A dictionary has been removed from the observed manager. Note that this is
30 // not called when dictionaries are cleared, so observers that want to track
31 // the loaded dictionary set need to observe OnClearDictionaries as well.
32 virtual void OnDictionaryRemoved(const std::string
& server_hash
) = 0;
34 // TODO(rdsmith): Add signal that an Avail-Dictionary header was generated.
35 // Should be added if/when an observer wants to use it to fine-tune
36 // dictionary deprecation (e.g. if Avail-Dictionary is generated and
37 // the remote *doesn't* use it, that should deprecate the dictionary faster)
39 // A SDCH encoded response was received and the specified dictionary
40 // was used to decode it. This notification only occurs for successful
41 // decodes. Note that this notification may occur for dictionaries that
42 // have been deleted from the SdchManager, since DictionarySets retain
43 // references to deleted dictionaries. Observers must handle this case.
44 // TODO(rdsmith): Should this notification indicate how much
45 // compression the dictionary provided?
46 virtual void OnDictionaryUsed(const std::string
& server_hash
) = 0;
48 // A "Get-Dictionary" header has been seen.
49 virtual void OnGetDictionary(const GURL
& request_url
,
50 const GURL
& dictionary_url
) = 0;
52 // Notification that SDCH has received a request to clear all
54 virtual void OnClearDictionaries() = 0;
59 #endif // NET_BASE_SDCH_MANAGER_H_