| 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_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
| 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 int version_number); | 71 int version_number); |
| 72 | 72 |
| 73 // Deletes all data. Works asynchronously, but if a |completion| callback is | 73 // Deletes all data. Works asynchronously, but if a |completion| callback is |
| 74 // provided, it will be fired on the pref thread when everything is done. | 74 // provided, it will be fired on the pref thread when everything is done. |
| 75 void Clear(const base::Closure& completion); | 75 void Clear(const base::Closure& completion); |
| 76 | 76 |
| 77 // ---------------------------------- | 77 // ---------------------------------- |
| 78 // HttpServerProperties methods: | 78 // HttpServerProperties methods: |
| 79 // ---------------------------------- | 79 // ---------------------------------- |
| 80 | 80 |
| 81 // Gets a weak pointer for this object. | |
| 82 base::WeakPtr<HttpServerProperties> GetWeakPtr() override; | 81 base::WeakPtr<HttpServerProperties> GetWeakPtr() override; |
| 83 | |
| 84 // Deletes all data. Works asynchronously. | |
| 85 void Clear() override; | 82 void Clear() override; |
| 86 | |
| 87 // Returns true if |server| supports SPDY. Should only be called from IO | |
| 88 // thread. | |
| 89 bool SupportsSpdy(const HostPortPair& server) override; | 83 bool SupportsSpdy(const HostPortPair& server) override; |
| 90 | |
| 91 // Add |server| as the SPDY server which supports SPDY protocol into the | |
| 92 // persisitent store. Should only be called from IO thread. | |
| 93 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override; | 84 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override; |
| 94 | |
| 95 // Returns true if |server| has required HTTP/1.1 via HTTP/2 error code. | |
| 96 bool RequiresHTTP11(const HostPortPair& server) override; | 85 bool RequiresHTTP11(const HostPortPair& server) override; |
| 97 | |
| 98 // Require HTTP/1.1 on subsequent connections. Not persisted. | |
| 99 void SetHTTP11Required(const HostPortPair& server) override; | 86 void SetHTTP11Required(const HostPortPair& server) override; |
| 100 | |
| 101 // Modify SSLConfig to force HTTP/1.1 if necessary. | |
| 102 void MaybeForceHTTP11(const HostPortPair& server, | 87 void MaybeForceHTTP11(const HostPortPair& server, |
| 103 SSLConfig* ssl_config) override; | 88 SSLConfig* ssl_config) override; |
| 104 | |
| 105 // Returns true if |server| has an Alternate-Protocol header. | |
| 106 bool HasAlternateProtocol(const HostPortPair& server) override; | 89 bool HasAlternateProtocol(const HostPortPair& server) override; |
| 107 | |
| 108 // Returns the Alternate-Protocol and port for |server|. | |
| 109 // HasAlternateProtocol(server) must be true. | |
| 110 AlternateProtocolInfo GetAlternateProtocol( | 90 AlternateProtocolInfo GetAlternateProtocol( |
| 111 const HostPortPair& server) override; | 91 const HostPortPair& server) override; |
| 112 | |
| 113 // Sets the Alternate-Protocol for |server|. | |
| 114 void SetAlternateProtocol(const HostPortPair& server, | 92 void SetAlternateProtocol(const HostPortPair& server, |
| 115 uint16 alternate_port, | 93 uint16 alternate_port, |
| 116 AlternateProtocol alternate_protocol, | 94 AlternateProtocol alternate_protocol, |
| 117 double alternate_probability) override; | 95 double alternate_probability) override; |
| 118 | |
| 119 // Sets the Alternate-Protocol for |server| to be BROKEN. | |
| 120 void SetBrokenAlternateProtocol(const HostPortPair& server) override; | 96 void SetBrokenAlternateProtocol(const HostPortPair& server) override; |
| 121 | |
| 122 // Returns true if Alternate-Protocol for |server| was recently BROKEN. | |
| 123 bool WasAlternateProtocolRecentlyBroken(const HostPortPair& server) override; | 97 bool WasAlternateProtocolRecentlyBroken(const HostPortPair& server) override; |
| 124 | |
| 125 // Confirms that Alternate-Protocol for |server| is working. | |
| 126 void ConfirmAlternateProtocol(const HostPortPair& server) override; | 98 void ConfirmAlternateProtocol(const HostPortPair& server) override; |
| 127 | |
| 128 // Clears the Alternate-Protocol for |server|. | |
| 129 void ClearAlternateProtocol(const HostPortPair& server) override; | 99 void ClearAlternateProtocol(const HostPortPair& server) override; |
| 130 | |
| 131 // Returns all Alternate-Protocol mappings. | |
| 132 const AlternateProtocolMap& alternate_protocol_map() const override; | 100 const AlternateProtocolMap& alternate_protocol_map() const override; |
| 133 | |
| 134 void SetAlternateProtocolProbabilityThreshold(double threshold) override; | 101 void SetAlternateProtocolProbabilityThreshold(double threshold) override; |
| 135 | |
| 136 // Gets a reference to the SettingsMap stored for a host. | |
| 137 // If no settings are stored, returns an empty SettingsMap. | |
| 138 const SettingsMap& GetSpdySettings( | 102 const SettingsMap& GetSpdySettings( |
| 139 const HostPortPair& host_port_pair) override; | 103 const HostPortPair& host_port_pair) override; |
| 140 | |
| 141 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | |
| 142 // is to be persisted. | |
| 143 bool SetSpdySetting(const HostPortPair& host_port_pair, | 104 bool SetSpdySetting(const HostPortPair& host_port_pair, |
| 144 SpdySettingsIds id, | 105 SpdySettingsIds id, |
| 145 SpdySettingsFlags flags, | 106 SpdySettingsFlags flags, |
| 146 uint32 value) override; | 107 uint32 value) override; |
| 147 | |
| 148 // Clears all SPDY settings for a host. | |
| 149 void ClearSpdySettings(const HostPortPair& host_port_pair) override; | 108 void ClearSpdySettings(const HostPortPair& host_port_pair) override; |
| 150 | |
| 151 // Clears all SPDY settings for all hosts. | |
| 152 void ClearAllSpdySettings() override; | 109 void ClearAllSpdySettings() override; |
| 153 | |
| 154 // Returns all SPDY persistent settings. | |
| 155 const SpdySettingsMap& spdy_settings_map() const override; | 110 const SpdySettingsMap& spdy_settings_map() const override; |
| 156 | |
| 157 // Methods for SupportsQuic. | |
| 158 SupportsQuic GetSupportsQuic( | 111 SupportsQuic GetSupportsQuic( |
| 159 const HostPortPair& host_port_pair) const override; | 112 const HostPortPair& host_port_pair) const override; |
| 160 | |
| 161 void SetSupportsQuic(const HostPortPair& host_port_pair, | 113 void SetSupportsQuic(const HostPortPair& host_port_pair, |
| 162 bool used_quic, | 114 bool used_quic, |
| 163 const std::string& address) override; | 115 const std::string& address) override; |
| 164 | |
| 165 const SupportsQuicMap& supports_quic_map() const override; | 116 const SupportsQuicMap& supports_quic_map() const override; |
| 166 | |
| 167 void SetServerNetworkStats(const HostPortPair& host_port_pair, | 117 void SetServerNetworkStats(const HostPortPair& host_port_pair, |
| 168 ServerNetworkStats stats) override; | 118 ServerNetworkStats stats) override; |
| 169 | |
| 170 const ServerNetworkStats* GetServerNetworkStats( | 119 const ServerNetworkStats* GetServerNetworkStats( |
| 171 const HostPortPair& host_port_pair) override; | 120 const HostPortPair& host_port_pair) override; |
| 172 | |
| 173 const ServerNetworkStatsMap& server_network_stats_map() const override; | 121 const ServerNetworkStatsMap& server_network_stats_map() const override; |
| 174 | 122 |
| 175 protected: | 123 protected: |
| 176 // -------------------- | 124 // -------------------- |
| 177 // SPDY related methods | 125 // SPDY related methods |
| 178 | 126 |
| 179 // These are used to delay updating of the cached data in | 127 // These are used to delay updating of the cached data in |
| 180 // |http_server_properties_impl_| while the preferences are changing, and | 128 // |http_server_properties_impl_| while the preferences are changing, and |
| 181 // execute only one update per simultaneous prefs changes. | 129 // execute only one update per simultaneous prefs changes. |
| 182 void ScheduleUpdateCacheOnPrefThread(); | 130 void ScheduleUpdateCacheOnPrefThread(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // Used to get |weak_ptr_| to self on the network thread. | 218 // Used to get |weak_ptr_| to self on the network thread. |
| 271 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > | 219 scoped_ptr<base::WeakPtrFactory<HttpServerPropertiesManager> > |
| 272 network_weak_ptr_factory_; | 220 network_weak_ptr_factory_; |
| 273 | 221 |
| 274 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); | 222 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManager); |
| 275 }; | 223 }; |
| 276 | 224 |
| 277 } // namespace net | 225 } // namespace net |
| 278 | 226 |
| 279 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ | 227 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ |
| OLD | NEW |