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

Side by Side Diff: chrome/browser/renderer_host/resource_dispatcher_host.cc

Issue 6459005: Cancel prerender when we discover a download starting from a page we are prer... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/resource_dispatcher_host.h" 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/scoped_ptr.h" 16 #include "base/scoped_ptr.h"
17 #include "base/shared_memory.h" 17 #include "base/shared_memory.h"
18 #include "base/stl_util-inl.h" 18 #include "base/stl_util-inl.h"
19 #include "base/time.h" 19 #include "base/time.h"
20 #include "chrome/browser/cert_store.h" 20 #include "chrome/browser/cert_store.h"
21 #include "chrome/browser/child_process_security_policy.h" 21 #include "chrome/browser/child_process_security_policy.h"
22 #include "chrome/browser/chrome_blob_storage_context.h" 22 #include "chrome/browser/chrome_blob_storage_context.h"
23 #include "chrome/browser/cross_site_request_manager.h" 23 #include "chrome/browser/cross_site_request_manager.h"
24 #include "chrome/browser/download/download_file_manager.h" 24 #include "chrome/browser/download/download_file_manager.h"
25 #include "chrome/browser/download/download_manager.h" 25 #include "chrome/browser/download/download_manager.h"
26 #include "chrome/browser/download/download_request_limiter.h" 26 #include "chrome/browser/download/download_request_limiter.h"
27 #include "chrome/browser/download/download_util.h"
27 #include "chrome/browser/download/save_file_manager.h" 28 #include "chrome/browser/download/save_file_manager.h"
28 #include "chrome/browser/extensions/user_script_listener.h" 29 #include "chrome/browser/extensions/user_script_listener.h"
29 #include "chrome/browser/external_protocol_handler.h" 30 #include "chrome/browser/external_protocol_handler.h"
30 #include "chrome/browser/in_process_webkit/webkit_thread.h" 31 #include "chrome/browser/in_process_webkit/webkit_thread.h"
31 #include "chrome/browser/net/chrome_url_request_context.h" 32 #include "chrome/browser/net/chrome_url_request_context.h"
32 #include "chrome/browser/net/url_request_tracking.h" 33 #include "chrome/browser/net/url_request_tracking.h"
33 #include "chrome/browser/plugin_service.h" 34 #include "chrome/browser/plugin_service.h"
34 #include "chrome/browser/prerender/prerender_manager.h" 35 #include "chrome/browser/prerender/prerender_manager.h"
35 #include "chrome/browser/prerender/prerender_resource_handler.h" 36 #include "chrome/browser/prerender/prerender_resource_handler.h"
36 #include "chrome/browser/profiles/profile.h" 37 #include "chrome/browser/profiles/profile.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 return; 689 return;
689 690
690 // Check if the renderer is permitted to request the requested URL. 691 // Check if the renderer is permitted to request the requested URL.
691 if (!ChildProcessSecurityPolicy::GetInstance()-> 692 if (!ChildProcessSecurityPolicy::GetInstance()->
692 CanRequestURL(child_id, url)) { 693 CanRequestURL(child_id, url)) {
693 VLOG(1) << "Denied unauthorized download request for " 694 VLOG(1) << "Denied unauthorized download request for "
694 << url.possibly_invalid_spec(); 695 << url.possibly_invalid_spec();
695 return; 696 return;
696 } 697 }
697 698
699 BrowserThread::PostTask(
700 BrowserThread::UI, FROM_HERE,
701 NewRunnableFunction(&download_util::NotifyDownloadInitiated,
702 child_id, route_id));
703
698 // Ensure the Chrome plugins are loaded, as they may intercept network 704 // Ensure the Chrome plugins are loaded, as they may intercept network
699 // requests. Does nothing if they are already loaded. 705 // requests. Does nothing if they are already loaded.
700 PluginService::GetInstance()->LoadChromePlugins(this); 706 PluginService::GetInstance()->LoadChromePlugins(this);
701 net::URLRequest* request = new net::URLRequest(url, this); 707 net::URLRequest* request = new net::URLRequest(url, this);
702 708
703 request_id_--; 709 request_id_--;
704 710
705 scoped_refptr<ResourceHandler> handler( 711 scoped_refptr<ResourceHandler> handler(
706 new DownloadResourceHandler(this, 712 new DownloadResourceHandler(this,
707 child_id, 713 child_id,
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 return is_prefetch_enabled_; 1942 return is_prefetch_enabled_;
1937 } 1943 }
1938 1944
1939 // static 1945 // static
1940 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { 1946 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) {
1941 is_prefetch_enabled_ = value; 1947 is_prefetch_enabled_ = value;
1942 } 1948 }
1943 1949
1944 // static 1950 // static
1945 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; 1951 bool ResourceDispatcherHost::is_prefetch_enabled_ = false;
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/download_throttling_resource_handler.cc ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698