This source file includes following definitions.
- partition_
- partition_
- Matches
- Matches
#include "content/browser/shared_worker/shared_worker_instance.h"
#include "base/logging.h"
namespace content {
SharedWorkerInstance::SharedWorkerInstance(
const GURL& url,
const base::string16& name,
const base::string16& content_security_policy,
blink::WebContentSecurityPolicyType security_policy_type,
ResourceContext* resource_context,
const WorkerStoragePartition& partition)
: url_(url),
name_(name),
content_security_policy_(content_security_policy),
security_policy_type_(security_policy_type),
resource_context_(resource_context),
partition_(partition) {
DCHECK(resource_context_);
}
SharedWorkerInstance::SharedWorkerInstance(const SharedWorkerInstance& other)
: url_(other.url_),
name_(other.name_),
content_security_policy_(other.content_security_policy_),
security_policy_type_(other.security_policy_type_),
resource_context_(other.resource_context_),
partition_(other.partition_) {}
SharedWorkerInstance::~SharedWorkerInstance() {}
bool SharedWorkerInstance::Matches(const GURL& match_url,
const base::string16& match_name,
const WorkerStoragePartition& partition,
ResourceContext* resource_context) const {
if (resource_context_ != resource_context)
return false;
if (!partition_.Equals(partition))
return false;
if (url_.GetOrigin() != match_url.GetOrigin())
return false;
if (name_.empty() && match_name.empty())
return url_ == match_url;
return name_ == match_name;
}
bool SharedWorkerInstance::Matches(const SharedWorkerInstance& other) const {
return Matches(
other.url(), other.name(), other.partition(), other.resource_context());
}
}