Chromium Code Reviews| 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 CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ | 5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ |
| 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ | 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "content/browser/worker_host/worker_storage_partition.h" | 11 #include "content/browser/worker_host/worker_storage_partition.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "third_party/WebKit/public/web/WebContentSecurityPolicy.h" | 13 #include "third_party/WebKit/public/web/WebContentSecurityPolicy.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class ResourceContext; | 17 class ResourceContext; |
| 18 | 18 |
| 19 class CONTENT_EXPORT SharedWorkerInstance { | 19 class CONTENT_EXPORT SharedWorkerInstance { |
|
kinuko
2014/04/01 16:01:05
Might be better to have a comment to note that thi
horo
2014/04/02 04:31:57
Done.
| |
| 20 public: | 20 public: |
| 21 SharedWorkerInstance(const GURL& url, | 21 SharedWorkerInstance(const GURL& url, |
| 22 const base::string16& name, | 22 const base::string16& name, |
| 23 const base::string16& content_security_policy, | 23 const base::string16& content_security_policy, |
| 24 blink::WebContentSecurityPolicyType security_policy_type, | 24 blink::WebContentSecurityPolicyType security_policy_type, |
| 25 ResourceContext* resource_context, | 25 ResourceContext* resource_context, |
| 26 const WorkerStoragePartition& partition); | 26 const WorkerStoragePartition& partition); |
| 27 SharedWorkerInstance(const SharedWorkerInstance& other); | |
| 27 ~SharedWorkerInstance(); | 28 ~SharedWorkerInstance(); |
| 28 | 29 |
| 29 // Checks if this SharedWorkerInstance matches the passed url/name params | 30 // Checks if this SharedWorkerInstance matches the passed url/name params |
| 30 // based on the algorithm in the WebWorkers spec - an instance matches if the | 31 // based on the algorithm in the WebWorkers spec - an instance matches if the |
| 31 // origins of the URLs match, and: | 32 // origins of the URLs match, and: |
| 32 // a) the names are non-empty and equal. | 33 // a) the names are non-empty and equal. |
| 33 // -or- | 34 // -or- |
| 34 // b) the names are both empty, and the urls are equal. | 35 // b) the names are both empty, and the urls are equal. |
| 35 bool Matches( | 36 bool Matches( |
| 36 const GURL& url, | 37 const GURL& url, |
| 37 const base::string16& name, | 38 const base::string16& name, |
| 38 const WorkerStoragePartition& partition, | 39 const WorkerStoragePartition& partition, |
| 39 ResourceContext* resource_context) const; | 40 ResourceContext* resource_context) const; |
| 41 bool Matches(const SharedWorkerInstance& other) const; | |
| 40 | 42 |
| 41 // Accessors. | 43 // Accessors. |
| 42 const GURL& url() const { return url_; } | 44 const GURL& url() const { return url_; } |
| 43 const base::string16 name() const { return name_; } | 45 const base::string16 name() const { return name_; } |
| 44 const base::string16 content_security_policy() const { | 46 const base::string16 content_security_policy() const { |
| 45 return content_security_policy_; | 47 return content_security_policy_; |
| 46 } | 48 } |
| 47 blink::WebContentSecurityPolicyType security_policy_type() const { | 49 blink::WebContentSecurityPolicyType security_policy_type() const { |
| 48 return security_policy_type_; | 50 return security_policy_type_; |
| 49 } | 51 } |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 60 const base::string16 content_security_policy_; | 62 const base::string16 content_security_policy_; |
| 61 const blink::WebContentSecurityPolicyType security_policy_type_; | 63 const blink::WebContentSecurityPolicyType security_policy_type_; |
| 62 ResourceContext* const resource_context_; | 64 ResourceContext* const resource_context_; |
| 63 const WorkerStoragePartition partition_; | 65 const WorkerStoragePartition partition_; |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 } // namespace content | 68 } // namespace content |
| 67 | 69 |
| 68 | 70 |
| 69 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ | 71 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ |
| OLD | NEW |