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

Side by Side Diff: content/browser/child_process_security_policy_impl.cc

Issue 23830007: Support byte range requests when routing resource requests directly through the browser process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 3 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 #include "content/browser/child_process_security_policy_impl.h" 5 #include "content/browser/child_process_security_policy_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/platform_file.h" 11 #include "base/platform_file.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "content/browser/plugin_process_host.h"
14 #include "content/browser/site_instance_impl.h" 15 #include "content/browser/site_instance_impl.h"
16 #include "content/public/browser/child_process_data.h"
15 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
16 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
17 #include "content/public/common/bindings_policy.h" 19 #include "content/public/common/bindings_policy.h"
18 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
19 #include "content/public/common/url_constants.h" 21 #include "content/public/common/url_constants.h"
20 #include "net/base/net_util.h" 22 #include "net/base/net_util.h"
21 #include "net/url_request/url_request.h" 23 #include "net/url_request/url_request.h"
22 #include "url/gurl.h" 24 #include "url/gurl.h"
23 #include "webkit/browser/fileapi/file_permission_policy.h" 25 #include "webkit/browser/fileapi/file_permission_policy.h"
24 #include "webkit/browser/fileapi/file_system_url.h" 26 #include "webkit/browser/fileapi/file_system_url.h"
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 int child_id, const GURL& gurl) { 797 int child_id, const GURL& gurl) {
796 base::AutoLock lock(lock_); 798 base::AutoLock lock(lock_);
797 SecurityStateMap::iterator state = security_state_.find(child_id); 799 SecurityStateMap::iterator state = security_state_.find(child_id);
798 if (state == security_state_.end()) 800 if (state == security_state_.end())
799 return false; 801 return false;
800 return state->second->CanAccessCookiesForOrigin(gurl); 802 return state->second->CanAccessCookiesForOrigin(gurl);
801 } 803 }
802 804
803 bool ChildProcessSecurityPolicyImpl::CanSendCookiesForOrigin(int child_id, 805 bool ChildProcessSecurityPolicyImpl::CanSendCookiesForOrigin(int child_id,
804 const GURL& gurl) { 806 const GURL& gurl) {
807 for (PluginProcessHostIterator iter; !iter.Done(); ++iter) {
808 if (iter.GetData().process_type == child_id) {
809 if (iter.GetData().process_type == PROCESS_TYPE_PLUGIN) {
810 // NPAPI plugin processes are unsandboxed and so are trusted. Plugins
811 // can make request to any origin.
812 return true;
813 }
814 break;
815 }
816 }
817
805 base::AutoLock lock(lock_); 818 base::AutoLock lock(lock_);
806 SecurityStateMap::iterator state = security_state_.find(child_id); 819 SecurityStateMap::iterator state = security_state_.find(child_id);
807 if (state == security_state_.end()) 820 if (state == security_state_.end())
808 return false; 821 return false;
809 return state->second->CanSendCookiesForOrigin(gurl); 822 return state->second->CanSendCookiesForOrigin(gurl);
810 } 823 }
811 824
812 void ChildProcessSecurityPolicyImpl::LockToOrigin(int child_id, 825 void ChildProcessSecurityPolicyImpl::LockToOrigin(int child_id,
813 const GURL& gurl) { 826 const GURL& gurl) {
814 // "gurl" can be currently empty in some cases, such as file://blah. 827 // "gurl" can be currently empty in some cases, such as file://blah.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 base::AutoLock lock(lock_); 867 base::AutoLock lock(lock_);
855 868
856 SecurityStateMap::iterator state = security_state_.find(child_id); 869 SecurityStateMap::iterator state = security_state_.find(child_id);
857 if (state == security_state_.end()) 870 if (state == security_state_.end())
858 return false; 871 return false;
859 872
860 return state->second->can_send_midi_sysex(); 873 return state->second->can_send_midi_sysex();
861 } 874 }
862 875
863 } // namespace content 876 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | content/child/npapi/plugin_url_fetcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698