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 // SharedWorkerInstance is copyable value-type data type. It could be passed to |
| 20 // the UI thread and be used for comparison in SharedWorkerDevToolsManager. |
19 class CONTENT_EXPORT SharedWorkerInstance { | 21 class CONTENT_EXPORT SharedWorkerInstance { |
20 public: | 22 public: |
21 SharedWorkerInstance(const GURL& url, | 23 SharedWorkerInstance(const GURL& url, |
22 const base::string16& name, | 24 const base::string16& name, |
23 const base::string16& content_security_policy, | 25 const base::string16& content_security_policy, |
24 blink::WebContentSecurityPolicyType security_policy_type, | 26 blink::WebContentSecurityPolicyType security_policy_type, |
25 ResourceContext* resource_context, | 27 ResourceContext* resource_context, |
26 const WorkerStoragePartition& partition); | 28 const WorkerStoragePartition& partition); |
| 29 SharedWorkerInstance(const SharedWorkerInstance& other); |
27 ~SharedWorkerInstance(); | 30 ~SharedWorkerInstance(); |
28 | 31 |
29 // Checks if this SharedWorkerInstance matches the passed url/name params | 32 // Checks if this SharedWorkerInstance matches the passed url/name params |
30 // based on the algorithm in the WebWorkers spec - an instance matches if the | 33 // based on the algorithm in the WebWorkers spec - an instance matches if the |
31 // origins of the URLs match, and: | 34 // origins of the URLs match, and: |
32 // a) the names are non-empty and equal. | 35 // a) the names are non-empty and equal. |
33 // -or- | 36 // -or- |
34 // b) the names are both empty, and the urls are equal. | 37 // b) the names are both empty, and the urls are equal. |
35 bool Matches( | 38 bool Matches( |
36 const GURL& url, | 39 const GURL& url, |
37 const base::string16& name, | 40 const base::string16& name, |
38 const WorkerStoragePartition& partition, | 41 const WorkerStoragePartition& partition, |
39 ResourceContext* resource_context) const; | 42 ResourceContext* resource_context) const; |
| 43 bool Matches(const SharedWorkerInstance& other) const; |
40 | 44 |
41 // Accessors. | 45 // Accessors. |
42 const GURL& url() const { return url_; } | 46 const GURL& url() const { return url_; } |
43 const base::string16 name() const { return name_; } | 47 const base::string16 name() const { return name_; } |
44 const base::string16 content_security_policy() const { | 48 const base::string16 content_security_policy() const { |
45 return content_security_policy_; | 49 return content_security_policy_; |
46 } | 50 } |
47 blink::WebContentSecurityPolicyType security_policy_type() const { | 51 blink::WebContentSecurityPolicyType security_policy_type() const { |
48 return security_policy_type_; | 52 return security_policy_type_; |
49 } | 53 } |
(...skipping 10 matching lines...) Expand all Loading... |
60 const base::string16 content_security_policy_; | 64 const base::string16 content_security_policy_; |
61 const blink::WebContentSecurityPolicyType security_policy_type_; | 65 const blink::WebContentSecurityPolicyType security_policy_type_; |
62 ResourceContext* const resource_context_; | 66 ResourceContext* const resource_context_; |
63 const WorkerStoragePartition partition_; | 67 const WorkerStoragePartition partition_; |
64 }; | 68 }; |
65 | 69 |
66 } // namespace content | 70 } // namespace content |
67 | 71 |
68 | 72 |
69 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ | 73 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ |
OLD | NEW |