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

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

Issue 6773006: Add enableReferrers and enableHyperlinkAuditing to contentSettings.misc API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 8 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 #include "chrome/browser/download/download_manager.h" 5 #include "chrome/browser/download/download_manager.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/download/download_status_updater.h" 26 #include "chrome/browser/download/download_status_updater.h"
27 #include "chrome/browser/download/download_util.h" 27 #include "chrome/browser/download/download_util.h"
28 #include "chrome/browser/extensions/extension_service.h" 28 #include "chrome/browser/extensions/extension_service.h"
29 #include "chrome/browser/history/download_create_info.h" 29 #include "chrome/browser/history/download_create_info.h"
30 #include "chrome/browser/net/chrome_url_request_context.h" 30 #include "chrome/browser/net/chrome_url_request_context.h"
31 #include "chrome/browser/platform_util.h" 31 #include "chrome/browser/platform_util.h"
32 #include "chrome/browser/profiles/profile.h" 32 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/browser/tab_contents/tab_util.h" 33 #include "chrome/browser/tab_contents/tab_util.h"
34 #include "chrome/browser/ui/browser.h" 34 #include "chrome/browser/ui/browser.h"
35 #include "chrome/common/chrome_paths.h" 35 #include "chrome/common/chrome_paths.h"
36 #include "chrome/common/pref_names.h"
36 #include "content/browser/browser_thread.h" 37 #include "content/browser/browser_thread.h"
37 #include "content/browser/renderer_host/render_process_host.h" 38 #include "content/browser/renderer_host/render_process_host.h"
38 #include "content/browser/renderer_host/render_view_host.h" 39 #include "content/browser/renderer_host/render_view_host.h"
39 #include "content/browser/renderer_host/resource_dispatcher_host.h" 40 #include "content/browser/renderer_host/resource_dispatcher_host.h"
40 #include "content/browser/tab_contents/tab_contents.h" 41 #include "content/browser/tab_contents/tab_contents.h"
41 #include "content/common/notification_type.h" 42 #include "content/common/notification_type.h"
42 #include "googleurl/src/gurl.h" 43 #include "googleurl/src/gurl.h"
43 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
44 #include "grit/theme_resources.h" 45 #include "grit/theme_resources.h"
45 #include "net/base/mime_util.h" 46 #include "net/base/mime_util.h"
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 // ResourceDispatcherHost, and let it send us responses like a regular 840 // ResourceDispatcherHost, and let it send us responses like a regular
840 // download. 841 // download.
841 void DownloadManager::DownloadUrl(const GURL& url, 842 void DownloadManager::DownloadUrl(const GURL& url,
842 const GURL& referrer, 843 const GURL& referrer,
843 const std::string& referrer_charset, 844 const std::string& referrer_charset,
844 TabContents* tab_contents) { 845 TabContents* tab_contents) {
845 DownloadUrlToFile(url, referrer, referrer_charset, DownloadSaveInfo(), 846 DownloadUrlToFile(url, referrer, referrer_charset, DownloadSaveInfo(),
846 tab_contents); 847 tab_contents);
847 } 848 }
848 849
849 void DownloadManager::DownloadUrlToFile(const GURL& url, 850 void DownloadManager::DownloadUrlToFile(
850 const GURL& referrer, 851 const GURL& url,
851 const std::string& referrer_charset, 852 const GURL& passed_referrer,
852 const DownloadSaveInfo& save_info, 853 const std::string& passed_referrer_charset,
853 TabContents* tab_contents) { 854 const DownloadSaveInfo& save_info,
855 TabContents* tab_contents) {
854 DCHECK(tab_contents); 856 DCHECK(tab_contents);
857 GURL referrer;
858 std::string referrer_charset;
859 if (profile_->GetPrefs()->GetBoolean(prefs::kEnableReferrers)) {
860 referrer = passed_referrer;
861 referrer_charset = passed_referrer_charset;
862 }
855 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 863 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
856 NewRunnableFunction(&download_util::DownloadUrl, 864 NewRunnableFunction(&download_util::DownloadUrl,
857 url, 865 url,
858 referrer, 866 referrer,
859 referrer_charset, 867 referrer_charset,
860 save_info, 868 save_info,
861 g_browser_process->resource_dispatcher_host(), 869 g_browser_process->resource_dispatcher_host(),
862 tab_contents->GetRenderProcessHost()->id(), 870 tab_contents->GetRenderProcessHost()->id(),
863 tab_contents->render_view_host()->routing_id(), 871 tab_contents->render_view_host()->routing_id(),
864 request_context_getter_)); 872 request_context_getter_));
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 observed_download_manager_->RemoveObserver(this); 1132 observed_download_manager_->RemoveObserver(this);
1125 } 1133 }
1126 1134
1127 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { 1135 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() {
1128 observing_download_manager_->NotifyModelChanged(); 1136 observing_download_manager_->NotifyModelChanged();
1129 } 1137 }
1130 1138
1131 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { 1139 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() {
1132 observed_download_manager_ = NULL; 1140 observed_download_manager_ = NULL;
1133 } 1141 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/save_package.cc » ('j') | chrome/browser/renderer_host/browser_render_process_host.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698