Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: content/browser/shared_worker/shared_worker_instance.cc

Issue 223123003: Make DevTools support for the embedded SharedWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed version Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "content/browser/shared_worker/shared_worker_instance.h" 5 #include "content/browser/shared_worker/shared_worker_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 SharedWorkerInstance::SharedWorkerInstance( 11 SharedWorkerInstance::SharedWorkerInstance(
12 const GURL& url, 12 const GURL& url,
13 const base::string16& name, 13 const base::string16& name,
14 const base::string16& content_security_policy, 14 const base::string16& content_security_policy,
15 blink::WebContentSecurityPolicyType security_policy_type, 15 blink::WebContentSecurityPolicyType security_policy_type,
16 ResourceContext* resource_context, 16 ResourceContext* resource_context,
17 const WorkerStoragePartition& partition) 17 const WorkerStoragePartition& partition)
18 : url_(url), 18 : url_(url),
19 name_(name), 19 name_(name),
20 content_security_policy_(content_security_policy), 20 content_security_policy_(content_security_policy),
21 security_policy_type_(security_policy_type), 21 security_policy_type_(security_policy_type),
22 resource_context_(resource_context), 22 resource_context_(resource_context),
23 partition_(partition) { 23 partition_(partition) {
24 DCHECK(resource_context_); 24 DCHECK(resource_context_);
25 } 25 }
26 26
27 SharedWorkerInstance::~SharedWorkerInstance() { 27 SharedWorkerInstance::SharedWorkerInstance(const SharedWorkerInstance& other)
28 } 28 : url_(other.url_),
29 name_(other.name_),
30 content_security_policy_(other.content_security_policy_),
31 security_policy_type_(other.security_policy_type_),
32 resource_context_(other.resource_context_),
33 partition_(other.partition_) {}
34
35 SharedWorkerInstance::~SharedWorkerInstance() {}
29 36
30 bool SharedWorkerInstance::Matches(const GURL& match_url, 37 bool SharedWorkerInstance::Matches(const GURL& match_url,
31 const base::string16& match_name, 38 const base::string16& match_name,
32 const WorkerStoragePartition& partition, 39 const WorkerStoragePartition& partition,
33 ResourceContext* resource_context) const { 40 ResourceContext* resource_context) const {
34 // ResourceContext equivalence is being used as a proxy to ensure we only 41 // ResourceContext equivalence is being used as a proxy to ensure we only
35 // matched shared workers within the same BrowserContext. 42 // matched shared workers within the same BrowserContext.
36 if (resource_context_ != resource_context) 43 if (resource_context_ != resource_context)
37 return false; 44 return false;
38 45
39 // We must be in the same storage partition otherwise sharing will violate 46 // We must be in the same storage partition otherwise sharing will violate
40 // isolation. 47 // isolation.
41 if (!partition_.Equals(partition)) 48 if (!partition_.Equals(partition))
42 return false; 49 return false;
43 50
44 if (url_.GetOrigin() != match_url.GetOrigin()) 51 if (url_.GetOrigin() != match_url.GetOrigin())
45 return false; 52 return false;
46 53
47 if (name_.empty() && match_name.empty()) 54 if (name_.empty() && match_name.empty())
48 return url_ == match_url; 55 return url_ == match_url;
49 56
50 return name_ == match_name; 57 return name_ == match_name;
51 } 58 }
52 59
60 bool SharedWorkerInstance::Matches(const SharedWorkerInstance& other) const {
61 return Matches(
62 other.url(), other.name(), other.partition(), other.resource_context());
63 }
64
53 } // namespace content 65 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/shared_worker/shared_worker_instance.h ('k') | content/browser/shared_worker/shared_worker_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698