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 "content/browser/shared_worker/worker_storage_partition.h" | 10 #include "content/browser/shared_worker/worker_storage_partition.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "third_party/WebKit/public/platform/WebAddressSpace.h" | 12 #include "third_party/WebKit/public/platform/WebAddressSpace.h" |
13 #include "third_party/WebKit/public/platform/WebContentSecurityPolicy.h" | 13 #include "third_party/WebKit/public/platform/WebContentSecurityPolicy.h" |
| 14 #include "third_party/WebKit/public/web/WebDataSaverFlag.h" |
14 #include "third_party/WebKit/public/web/WebSharedWorkerCreationContextType.h" | 15 #include "third_party/WebKit/public/web/WebSharedWorkerCreationContextType.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 class ResourceContext; | 19 class ResourceContext; |
19 | 20 |
20 // SharedWorkerInstance is copyable value-type data type. It could be passed to | 21 // SharedWorkerInstance is copyable value-type data type. It could be passed to |
21 // the UI thread and be used for comparison in SharedWorkerDevToolsManager. | 22 // the UI thread and be used for comparison in SharedWorkerDevToolsManager. |
22 class CONTENT_EXPORT SharedWorkerInstance { | 23 class CONTENT_EXPORT SharedWorkerInstance { |
23 public: | 24 public: |
24 SharedWorkerInstance( | 25 SharedWorkerInstance( |
25 const GURL& url, | 26 const GURL& url, |
26 const base::string16& name, | 27 const base::string16& name, |
27 const base::string16& content_security_policy, | 28 const base::string16& content_security_policy, |
28 blink::WebContentSecurityPolicyType security_policy_type, | 29 blink::WebContentSecurityPolicyType security_policy_type, |
29 blink::WebAddressSpace creation_address_space, | 30 blink::WebAddressSpace creation_address_space, |
30 ResourceContext* resource_context, | 31 ResourceContext* resource_context, |
31 const WorkerStoragePartitionId& partition_id, | 32 const WorkerStoragePartitionId& partition_id, |
32 blink::WebSharedWorkerCreationContextType creation_context_type); | 33 blink::WebSharedWorkerCreationContextType creation_context_type, |
| 34 blink::WebDataSaverFlag data_saver_flag); |
33 SharedWorkerInstance(const SharedWorkerInstance& other); | 35 SharedWorkerInstance(const SharedWorkerInstance& other); |
34 ~SharedWorkerInstance(); | 36 ~SharedWorkerInstance(); |
35 | 37 |
36 // Checks if this SharedWorkerInstance matches the passed url/name params | 38 // Checks if this SharedWorkerInstance matches the passed url/name params |
37 // based on the algorithm in the WebWorkers spec - an instance matches if the | 39 // based on the algorithm in the WebWorkers spec - an instance matches if the |
38 // origins of the URLs match, and: | 40 // origins of the URLs match, and: |
39 // a) the names are non-empty and equal. | 41 // a) the names are non-empty and equal. |
40 // -or- | 42 // -or- |
41 // b) the names are both empty, and the urls are equal. | 43 // b) the names are both empty, and the urls are equal. |
42 bool Matches(const GURL& url, | 44 bool Matches(const GURL& url, |
(...skipping 14 matching lines...) Expand all Loading... |
57 blink::WebAddressSpace creation_address_space() const { | 59 blink::WebAddressSpace creation_address_space() const { |
58 return creation_address_space_; | 60 return creation_address_space_; |
59 } | 61 } |
60 ResourceContext* resource_context() const { | 62 ResourceContext* resource_context() const { |
61 return resource_context_; | 63 return resource_context_; |
62 } | 64 } |
63 const WorkerStoragePartitionId& partition_id() const { return partition_id_; } | 65 const WorkerStoragePartitionId& partition_id() const { return partition_id_; } |
64 blink::WebSharedWorkerCreationContextType creation_context_type() const { | 66 blink::WebSharedWorkerCreationContextType creation_context_type() const { |
65 return creation_context_type_; | 67 return creation_context_type_; |
66 } | 68 } |
| 69 blink::WebDataSaverFlag data_saver_flag() const { return data_saver_flag_; } |
67 | 70 |
68 private: | 71 private: |
69 const GURL url_; | 72 const GURL url_; |
70 const base::string16 name_; | 73 const base::string16 name_; |
71 const base::string16 content_security_policy_; | 74 const base::string16 content_security_policy_; |
72 const blink::WebContentSecurityPolicyType security_policy_type_; | 75 const blink::WebContentSecurityPolicyType security_policy_type_; |
73 const blink::WebAddressSpace creation_address_space_; | 76 const blink::WebAddressSpace creation_address_space_; |
74 ResourceContext* const resource_context_; | 77 ResourceContext* const resource_context_; |
75 const WorkerStoragePartitionId partition_id_; | 78 const WorkerStoragePartitionId partition_id_; |
76 const blink::WebSharedWorkerCreationContextType creation_context_type_; | 79 const blink::WebSharedWorkerCreationContextType creation_context_type_; |
| 80 const blink::WebDataSaverFlag data_saver_flag_; |
77 }; | 81 }; |
78 | 82 |
79 } // namespace content | 83 } // namespace content |
80 | 84 |
81 | 85 |
82 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ | 86 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_INSTANCE_H_ |
OLD | NEW |