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

Side by Side Diff: content/child/site_isolation_policy.cc

Issue 293353007: Move resource_response_info from webkit/ to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/child/site_isolation_policy.h ('k') | content/child/sync_load_response.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/child/site_isolation_policy.h" 5 #include "content/child/site_isolation_policy.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "content/public/common/resource_response_info.h"
14 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 15 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
15 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
16 #include "webkit/common/resource_response_info.h"
17 17
18 using base::StringPiece; 18 using base::StringPiece;
19 19
20 namespace content { 20 namespace content {
21 21
22 namespace { 22 namespace {
23 23
24 // The cross-site document blocking/UMA data collection is deactivated by 24 // The cross-site document blocking/UMA data collection is deactivated by
25 // default, and only activated in renderer processes. 25 // default, and only activated in renderer processes.
26 static bool g_policy_enabled = false; 26 static bool g_policy_enabled = false;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 } // namespace 134 } // namespace
135 135
136 SiteIsolationResponseMetaData::SiteIsolationResponseMetaData() {} 136 SiteIsolationResponseMetaData::SiteIsolationResponseMetaData() {}
137 137
138 void SiteIsolationPolicy::SetPolicyEnabled(bool enabled) { 138 void SiteIsolationPolicy::SetPolicyEnabled(bool enabled) {
139 g_policy_enabled = enabled; 139 g_policy_enabled = enabled;
140 } 140 }
141 141
142 linked_ptr<SiteIsolationResponseMetaData> 142 linked_ptr<SiteIsolationResponseMetaData>
143 SiteIsolationPolicy::OnReceivedResponse( 143 SiteIsolationPolicy::OnReceivedResponse(const GURL& frame_origin,
144 const GURL& frame_origin, 144 const GURL& response_url,
145 const GURL& response_url, 145 ResourceType::Type resource_type,
146 ResourceType::Type resource_type, 146 int origin_pid,
147 int origin_pid, 147 const ResourceResponseInfo& info) {
148 const webkit_glue::ResourceResponseInfo& info) {
149 if (!g_policy_enabled) 148 if (!g_policy_enabled)
150 return linked_ptr<SiteIsolationResponseMetaData>(); 149 return linked_ptr<SiteIsolationResponseMetaData>();
151 150
152 // if |origin_pid| is non-zero, it means that this response is for a plugin 151 // if |origin_pid| is non-zero, it means that this response is for a plugin
153 // spawned from this renderer process. We exclude responses for plugins for 152 // spawned from this renderer process. We exclude responses for plugins for
154 // now, but eventually, we're going to make plugin processes directly talk to 153 // now, but eventually, we're going to make plugin processes directly talk to
155 // the browser process so that we don't apply cross-site document blocking to 154 // the browser process so that we don't apply cross-site document blocking to
156 // them. 155 // them.
157 if (origin_pid) 156 if (origin_pid)
158 return linked_ptr<SiteIsolationResponseMetaData>(); 157 return linked_ptr<SiteIsolationResponseMetaData>();
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 // TODO(dsjang): This is a real hack. The only purpose of this function is to 504 // TODO(dsjang): This is a real hack. The only purpose of this function is to
506 // try to see if there's any possibility that this data can be JavaScript 505 // try to see if there's any possibility that this data can be JavaScript
507 // (superset of JS). This function will be removed once UMA stats are 506 // (superset of JS). This function will be removed once UMA stats are
508 // gathered. 507 // gathered.
509 508
510 // Search for "var " for JS detection. 509 // Search for "var " for JS detection.
511 return data.find("var ") != base::StringPiece::npos; 510 return data.find("var ") != base::StringPiece::npos;
512 } 511 }
513 512
514 } // namespace content 513 } // namespace content
OLDNEW
« no previous file with comments | « content/child/site_isolation_policy.h ('k') | content/child/sync_load_response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698