Roll src/third_party/WebKit 3aa9dd9:183b2b0 (svn 201777:201778)
[chromium-blink-merge.git] / net / websockets / websocket_extension.cc
blobedcd8e8657fbbcaa09ffc2234b305e44ec6b13d6
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"
7 #include <string>
9 #include "base/logging.h"
11 namespace net {
13 WebSocketExtension::Parameter::Parameter(const std::string& name)
14 : name_(name) {}
16 WebSocketExtension::Parameter::Parameter(const std::string& name,
17 const std::string& value)
18 : name_(name), value_(value) {
19 DCHECK(!value.empty());
22 bool WebSocketExtension::Parameter::Equals(const Parameter& other) const {
23 return name_ == other.name_ && value_ == other.value_;
26 WebSocketExtension::WebSocketExtension() {}
28 WebSocketExtension::WebSocketExtension(const std::string& name)
29 : name_(name) {}
31 WebSocketExtension::~WebSocketExtension() {}
33 bool WebSocketExtension::Equals(const WebSocketExtension& other) const {
34 if (name_ != other.name_) return false;
35 if (parameters_.size() != other.parameters_.size()) return false;
36 for (size_t i = 0; i < other.parameters_.size(); ++i) {
37 if (!parameters_[i].Equals(other.parameters_[i]))
38 return false;
40 return true;
43 } // namespace net