1 // Copyright 2013 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 #include "net/websockets/websocket_extension.h"
10 #include "base/logging.h"
14 WebSocketExtension::Parameter::Parameter(const std::string
& name
)
17 WebSocketExtension::Parameter::Parameter(const std::string
& name
,
18 const std::string
& value
)
19 : name_(name
), value_(value
) {
20 DCHECK(!value
.empty());
23 bool WebSocketExtension::Parameter::Equals(const Parameter
& other
) const {
24 return name_
== other
.name_
&& value_
== other
.value_
;
27 WebSocketExtension::WebSocketExtension() {}
29 WebSocketExtension::WebSocketExtension(const std::string
& name
)
32 WebSocketExtension::~WebSocketExtension() {}
34 bool WebSocketExtension::Equals(const WebSocketExtension
& other
) const {
35 if (name_
!= other
.name_
) return false;
36 if (parameters_
.size() != other
.parameters_
.size()) return false;
38 std::multimap
<std::string
, std::string
> this_parameters
, other_parameters
;
39 for (const auto& p
: parameters_
) {
40 this_parameters
.insert(std::make_pair(p
.name(), p
.value()));
42 for (const auto& p
: other
.parameters_
) {
43 other_parameters
.insert(std::make_pair(p
.name(), p
.value()));
45 return this_parameters
== other_parameters
;