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

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

Issue 7237034: sql::MetaTable.next_download_id, DownloadManager::GetNextId() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: " Created 9 years, 4 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 "content/browser/renderer_host/resource_dispatcher_host.h" 7 #include "content/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 719
720 BrowserThread::PostTask( 720 BrowserThread::PostTask(
721 BrowserThread::UI, FROM_HERE, 721 BrowserThread::UI, FROM_HERE,
722 NewRunnableFunction(&download_util::NotifyDownloadInitiated, 722 NewRunnableFunction(&download_util::NotifyDownloadInitiated,
723 child_id, route_id)); 723 child_id, route_id));
724 724
725 net::URLRequest* request = new net::URLRequest(url, this); 725 net::URLRequest* request = new net::URLRequest(url, this);
726 726
727 request_id_--; 727 request_id_--;
728 728
729 // TODO(benjhayden) next_download_id_thunk can be a field in ResourceContext
730 // when DownloadManager is moved to content.
731 DownloadManager::GetNextIdThunkType* next_download_id_thunk =
732 reinterpret_cast<DownloadManager::GetNextIdThunkType*>(context
733 .GetUserData(reinterpret_cast<void*>(BASE_HASH_NAMESPACE::
734 #if defined(COMPILER_GCC)
735 hash<std::string>()
736 #elif defined(COMPILER_MSVC)
737 hash_value
738 #endif
739 ("next_download_id_thunk"))));
740 CHECK(next_download_id_thunk);
741 CHECK(!next_download_id_thunk->is_null());
742 DownloadId dl_id = next_download_id_thunk->Run();
743
729 scoped_refptr<ResourceHandler> handler( 744 scoped_refptr<ResourceHandler> handler(
730 new DownloadResourceHandler(this, 745 new DownloadResourceHandler(this,
731 child_id, 746 child_id,
732 route_id, 747 route_id,
733 request_id_, 748 request_id_,
734 url, 749 url,
750 dl_id,
735 download_file_manager_.get(), 751 download_file_manager_.get(),
736 request, 752 request,
737 prompt_for_save_location, 753 prompt_for_save_location,
738 save_info)); 754 save_info));
739 755
740 if (delegate_) { 756 if (delegate_) {
741 handler = delegate_->DownloadStarting(handler, context, child_id, 757 handler = delegate_->DownloadStarting(handler, context, child_id,
742 route_id); 758 route_id);
743 } 759 }
744 760
745 const net::URLRequestContext* request_context = context.request_context(); 761 const net::URLRequestContext* request_context = context.request_context();
746 762
747 if (!request_context->job_factory()->IsHandledURL(url)) { 763 if (!request_context->job_factory()->IsHandledURL(url)) {
748 VLOG(1) << "Download request for unsupported protocol: " 764 VLOG(1) << "Download request for unsupported protocol: "
749 << url.possibly_invalid_spec(); 765 << url.possibly_invalid_spec();
750 return; 766 return;
751 } 767 }
752 768
753 request->set_method("GET"); 769 request->set_method("GET");
754 request->set_referrer(MaybeStripReferrer(referrer).spec()); 770 request->set_referrer(MaybeStripReferrer(referrer).spec());
755 request->set_context(context.request_context()); 771 request->set_context(request_context);
756 request->set_load_flags(request->load_flags() | 772 request->set_load_flags(request->load_flags() |
757 net::LOAD_IS_DOWNLOAD); 773 net::LOAD_IS_DOWNLOAD);
758 774
759 ResourceDispatcherHostRequestInfo* extra_info = 775 ResourceDispatcherHostRequestInfo* extra_info =
760 CreateRequestInfoForBrowserRequest( 776 CreateRequestInfoForBrowserRequest(
761 handler, child_id, route_id, true, context); 777 handler, child_id, route_id, true, context);
762 SetRequestInfo(request, extra_info); // Request takes ownership. 778 SetRequestInfo(request, extra_info); // Request takes ownership.
763 779
764 BeginRequestInternal(request); 780 BeginRequestInternal(request);
765 } 781 }
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS; 2122 return HTTP_AUTH_RESOURCE_BLOCKED_CROSS;
2107 } 2123 }
2108 2124
2109 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { 2125 bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() {
2110 return allow_cross_origin_auth_prompt_; 2126 return allow_cross_origin_auth_prompt_;
2111 } 2127 }
2112 2128
2113 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { 2129 void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) {
2114 allow_cross_origin_auth_prompt_ = value; 2130 allow_cross_origin_auth_prompt_ = value;
2115 } 2131 }
OLDNEW
« chrome/browser/profiles/profile_io_data.cc ('K') | « chrome/chrome_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698