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

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

Issue 7134017: Make safe browsing work in a multi-profile environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: addressed sky's nit Created 9 years, 5 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_file_manager.h" 5 #include "chrome/browser/download/download_file_manager.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/task.h" 10 #include "base/task.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/download/download_create_info.h" 14 #include "chrome/browser/download/download_create_info.h"
15 #include "chrome/browser/download/download_manager.h" 15 #include "chrome/browser/download/download_manager.h"
16 #include "chrome/browser/download/download_request_handle.h" 16 #include "chrome/browser/download/download_request_handle.h"
17 #include "chrome/browser/download/download_util.h" 17 #include "chrome/browser/download/download_util.h"
18 #include "chrome/browser/net/chrome_url_request_context.h" 18 #include "chrome/browser/net/chrome_url_request_context.h"
19 #include "chrome/browser/platform_util.h" 19 #include "chrome/browser/platform_util.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 21 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
22 #include "chrome/browser/tab_contents/tab_util.h" 22 #include "chrome/browser/tab_contents/tab_util.h"
23 #include "chrome/common/pref_names.h"
23 #include "content/browser/browser_thread.h" 24 #include "content/browser/browser_thread.h"
24 #include "content/browser/renderer_host/resource_dispatcher_host.h" 25 #include "content/browser/renderer_host/resource_dispatcher_host.h"
25 #include "content/browser/tab_contents/tab_contents.h" 26 #include "content/browser/tab_contents/tab_contents.h"
26 #include "googleurl/src/gurl.h" 27 #include "googleurl/src/gurl.h"
27 #include "net/base/io_buffer.h" 28 #include "net/base/io_buffer.h"
28 29
29 namespace { 30 namespace {
30 31
31 // Throttle updates to the UI thread so that a fast moving download doesn't 32 // Throttle updates to the UI thread so that a fast moving download doesn't
32 // cause it to become unresponsive (in milliseconds). 33 // cause it to become unresponsive (in milliseconds).
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 delete info; 139 delete info;
139 return; 140 return;
140 } 141 }
141 142
142 // TODO(phajdan.jr): fix the duplication of path info below. 143 // TODO(phajdan.jr): fix the duplication of path info below.
143 info->path = info->save_info.file_path; 144 info->path = info->save_info.file_path;
144 145
145 manager->CreateDownloadItem(info); 146 manager->CreateDownloadItem(info);
146 147
147 #if defined(ENABLE_SAFE_BROWSING) 148 #if defined(ENABLE_SAFE_BROWSING)
148 bool hash_needed = g_browser_process->safe_browsing_service()-> 149 bool hash_needed = manager->profile()->GetPrefs()->GetBoolean(
149 DownloadBinHashNeeded(); 150 prefs::kSafeBrowsingEnabled) &&
151 g_browser_process->safe_browsing_service()->DownloadBinHashNeeded();
150 #else 152 #else
151 bool hash_needed = false; 153 bool hash_needed = false;
152 #endif 154 #endif
153 155
154 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 156 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
155 NewRunnableMethod(this, &DownloadFileManager::CreateDownloadFile, 157 NewRunnableMethod(this, &DownloadFileManager::CreateDownloadFile,
156 info, make_scoped_refptr(manager), hash_needed)); 158 info, make_scoped_refptr(manager), hash_needed));
157 } 159 }
158 160
159 // We don't forward an update to the UI thread here, since we want to throttle 161 // We don't forward an update to the UI thread here, since we want to throttle
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 << " id = " << id 398 << " id = " << id
397 << " download_file = " << download_file->DebugString(); 399 << " download_file = " << download_file->DebugString();
398 400
399 downloads_.erase(id); 401 downloads_.erase(id);
400 402
401 delete download_file; 403 delete download_file;
402 404
403 if (downloads_.empty()) 405 if (downloads_.empty())
404 StopUpdateTimer(); 406 StopUpdateTimer();
405 } 407 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698