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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 12662019: Split the ProcessType enum into process types that content knows about (which will remain in src\co… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 GURL MaybeStripReferrer(const GURL& possible_referrer) { 153 GURL MaybeStripReferrer(const GURL& possible_referrer) {
154 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoReferrers)) 154 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoReferrers))
155 return GURL(); 155 return GURL();
156 return possible_referrer; 156 return possible_referrer;
157 } 157 }
158 158
159 // Consults the RendererSecurity policy to determine whether the 159 // Consults the RendererSecurity policy to determine whether the
160 // ResourceDispatcherHostImpl should service this request. A request might be 160 // ResourceDispatcherHostImpl should service this request. A request might be
161 // disallowed if the renderer is not authorized to retrieve the request URL or 161 // disallowed if the renderer is not authorized to retrieve the request URL or
162 // if the renderer is attempting to upload an unauthorized file. 162 // if the renderer is attempting to upload an unauthorized file.
163 bool ShouldServiceRequest(ProcessType process_type, 163 bool ShouldServiceRequest(int process_type,
164 int child_id, 164 int child_id,
165 const ResourceHostMsg_Request& request_data) { 165 const ResourceHostMsg_Request& request_data) {
166 if (process_type == PROCESS_TYPE_PLUGIN) 166 if (process_type == PROCESS_TYPE_PLUGIN)
167 return true; 167 return true;
168 168
169 ChildProcessSecurityPolicyImpl* policy = 169 ChildProcessSecurityPolicyImpl* policy =
170 ChildProcessSecurityPolicyImpl::GetInstance(); 170 ChildProcessSecurityPolicyImpl::GetInstance();
171 171
172 // Check if the renderer is permitted to request the requested URL. 172 // Check if the renderer is permitted to request the requested URL.
173 if (!policy->CanRequestURL(child_id, request_data.url)) { 173 if (!policy->CanRequestURL(child_id, request_data.url)) {
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 IPC::Message* sync_result) { 870 IPC::Message* sync_result) {
871 BeginRequest(request_id, request_data, sync_result, 871 BeginRequest(request_id, request_data, sync_result,
872 sync_result->routing_id()); 872 sync_result->routing_id());
873 } 873 }
874 874
875 void ResourceDispatcherHostImpl::BeginRequest( 875 void ResourceDispatcherHostImpl::BeginRequest(
876 int request_id, 876 int request_id,
877 const ResourceHostMsg_Request& request_data, 877 const ResourceHostMsg_Request& request_data,
878 IPC::Message* sync_result, // only valid for sync 878 IPC::Message* sync_result, // only valid for sync
879 int route_id) { 879 int route_id) {
880 ProcessType process_type = filter_->process_type(); 880 int process_type = filter_->process_type();
881 int child_id = filter_->child_id(); 881 int child_id = filter_->child_id();
882 882
883 // If we crash here, figure out what URL the renderer was requesting. 883 // If we crash here, figure out what URL the renderer was requesting.
884 // http://crbug.com/91398 884 // http://crbug.com/91398
885 char url_buf[128]; 885 char url_buf[128];
886 base::strlcpy(url_buf, request_data.url.spec().c_str(), arraysize(url_buf)); 886 base::strlcpy(url_buf, request_data.url.spec().c_str(), arraysize(url_buf));
887 base::debug::Alias(url_buf); 887 base::debug::Alias(url_buf);
888 888
889 // If the request that's coming in is being transferred from another process, 889 // If the request that's coming in is being transferred from another process,
890 // we want to reuse and resume the old loader rather than start a new one. 890 // we want to reuse and resume the old loader rather than start a new one.
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 DelegateMap::iterator it = delegate_map_.find(id); 1753 DelegateMap::iterator it = delegate_map_.find(id);
1754 DCHECK(it->second->HasObserver(delegate)); 1754 DCHECK(it->second->HasObserver(delegate));
1755 it->second->RemoveObserver(delegate); 1755 it->second->RemoveObserver(delegate);
1756 if (it->second->size() == 0) { 1756 if (it->second->size() == 0) {
1757 delete it->second; 1757 delete it->second;
1758 delegate_map_.erase(it); 1758 delegate_map_.erase(it);
1759 } 1759 }
1760 } 1760 }
1761 1761
1762 } // namespace content 1762 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698