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