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

Side by Side Diff: chrome/browser/download/download_util.cc

Issue 6995013: More progress towards removing content settings code from the content layer. We can't use Cookie... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix net_unittests Created 9 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
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 // Download utility implementation 5 // Download utility implementation
6 6
7 #include "chrome/browser/download/download_util.h" 7 #include "chrome/browser/download/download_util.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <shobjidl.h> 10 #include <shobjidl.h>
(...skipping 17 matching lines...) Expand all
28 #include "base/win/windows_version.h" 28 #include "base/win/windows_version.h"
29 #include "chrome/browser/download/download_extensions.h" 29 #include "chrome/browser/download/download_extensions.h"
30 #include "chrome/browser/download/download_item.h" 30 #include "chrome/browser/download/download_item.h"
31 #include "chrome/browser/download/download_item_model.h" 31 #include "chrome/browser/download/download_item_model.h"
32 #include "chrome/browser/download/download_manager.h" 32 #include "chrome/browser/download/download_manager.h"
33 #include "chrome/browser/download/download_types.h" 33 #include "chrome/browser/download/download_types.h"
34 #include "chrome/browser/extensions/crx_installer.h" 34 #include "chrome/browser/extensions/crx_installer.h"
35 #include "chrome/browser/extensions/extension_install_ui.h" 35 #include "chrome/browser/extensions/extension_install_ui.h"
36 #include "chrome/browser/extensions/extension_service.h" 36 #include "chrome/browser/extensions/extension_service.h"
37 #include "chrome/browser/history/download_create_info.h" 37 #include "chrome/browser/history/download_create_info.h"
38 #include "chrome/browser/net/chrome_url_request_context.h"
39 #include "chrome/browser/profiles/profile.h" 38 #include "chrome/browser/profiles/profile.h"
40 #include "chrome/browser/ui/browser.h" 39 #include "chrome/browser/ui/browser.h"
41 #include "chrome/common/chrome_paths.h" 40 #include "chrome/common/chrome_paths.h"
42 #include "chrome/common/time_format.h" 41 #include "chrome/common/time_format.h"
43 #include "content/browser/browser_thread.h" 42 #include "content/browser/browser_thread.h"
44 #include "content/browser/renderer_host/render_view_host.h" 43 #include "content/browser/renderer_host/render_view_host.h"
45 #include "content/browser/renderer_host/resource_dispatcher_host.h" 44 #include "content/browser/renderer_host/resource_dispatcher_host.h"
46 #include "content/browser/tab_contents/tab_contents.h" 45 #include "content/browser/tab_contents/tab_contents.h"
47 #include "content/common/notification_service.h" 46 #include "content/common/notification_service.h"
48 #include "grit/generated_resources.h" 47 #include "grit/generated_resources.h"
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 } 789 }
791 790
792 void DownloadUrl( 791 void DownloadUrl(
793 const GURL& url, 792 const GURL& url,
794 const GURL& referrer, 793 const GURL& referrer,
795 const std::string& referrer_charset, 794 const std::string& referrer_charset,
796 const DownloadSaveInfo& save_info, 795 const DownloadSaveInfo& save_info,
797 ResourceDispatcherHost* rdh, 796 ResourceDispatcherHost* rdh,
798 int render_process_host_id, 797 int render_process_host_id,
799 int render_view_id, 798 int render_view_id,
800 net::URLRequestContextGetter* request_context_getter) { 799 const content::ResourceContext* context) {
801 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 800 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
802 801
803 net::URLRequestContext* context =
804 request_context_getter->GetURLRequestContext();
805 context->set_referrer_charset(referrer_charset);
806
807 rdh->BeginDownload(url, 802 rdh->BeginDownload(url,
808 referrer, 803 referrer,
809 save_info, 804 save_info,
810 true, // Show "Save as" UI. 805 true, // Show "Save as" UI.
811 render_process_host_id, 806 render_process_host_id,
812 render_view_id, 807 render_view_id,
813 context); 808 *context);
814 } 809 }
815 810
816 void CancelDownloadRequest(ResourceDispatcherHost* rdh, 811 void CancelDownloadRequest(ResourceDispatcherHost* rdh,
817 int render_process_id, 812 int render_process_id,
818 int request_id) { 813 int request_id) {
819 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 814 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
820 // |rdh| may be NULL in unit tests. 815 // |rdh| may be NULL in unit tests.
821 if (rdh) 816 if (rdh)
822 rdh->CancelRequest(render_process_id, request_id, false); 817 rdh->CancelRequest(render_process_id, request_id, false);
823 } 818 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 // Extensions that are not from the gallery are considered dangerous. 889 // Extensions that are not from the gallery are considered dangerous.
895 ExtensionService* service = profile->GetExtensionService(); 890 ExtensionService* service = profile->GetExtensionService();
896 if (!service || 891 if (!service ||
897 !service->IsDownloadFromGallery(info->url(), info->referrer_url)) 892 !service->IsDownloadFromGallery(info->url(), info->referrer_url))
898 return true; 893 return true;
899 } 894 }
900 return false; 895 return false;
901 } 896 }
902 897
903 } // namespace download_util 898 } // namespace download_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698