blob: fda9220c17fc1cec02a4d45bc59c3a1910719be6 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <string>
#include <vector>
#include "base/logging.h"
#include "base/macros.h"
namespace optimization_guide {
// URLPatternWithWildcards parses and stores one URL pattern. A URL pattern is a
// single substring to match against a URL. A URL pattern may
// contain multiple wildcard characters ('*'), each of which can match more than
// one character. An implicit wildcard character ('*') is assumed to be present
// at the beginning and end of a pattern.
class URLPatternWithWildcards {
explicit URLPatternWithWildcards(const std::string& url_pattern);
// Returns true if |url_string| matches |this| pattern.
bool Matches(const std::string& url_string) const;
// A single pattern string is split into multiple strings (each separated by
// '*'), and stored in |split_subpatterns_|.
const std::vector<std::string> split_subpatterns_;
} // namespace optimization_guide