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

Side by Side Diff: content/browser/download/save_file.cc

Issue 10905284: Use the user's preferred downloads directory for creating the initial download file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/download/save_file.h" 5 #include "content/browser/download/save_file.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/content_browser_client.h"
9 #include "net/base/file_stream.h" 10 #include "net/base/file_stream.h"
10 11
11 using content::BrowserThread; 12 using content::BrowserThread;
12 13
14 // TODO(asanka): SaveFile should use the target directory of the save package as
15 // the default download directory when initializing |file_|.
16 // Unfortunately, as it is, constructors of SaveFile doesn't
17 // always have access to the SavePackage at this point.
13 SaveFile::SaveFile(const SaveFileCreateInfo* info, bool calculate_hash) 18 SaveFile::SaveFile(const SaveFileCreateInfo* info, bool calculate_hash)
14 : file_(FilePath(), 19 : file_(content::GetContentClient()->browser()->
20 GetDefaultDownloadDirectory(),
Randy Smith (Not in Mondays) 2012/09/14 16:38:16 Is this safe to access on the file thread?
asanka 2012/09/14 19:11:45 It's documented as "can be called on any thread."
21 FilePath(),
15 info->url, 22 info->url,
16 GURL(), 23 GURL(),
17 0, 24 0,
18 calculate_hash, 25 calculate_hash,
19 "", 26 "",
20 linked_ptr<net::FileStream>(), 27 linked_ptr<net::FileStream>(),
21 net::BoundNetLog()), 28 net::BoundNetLog()),
22 info_(info) { 29 info_(info) {
23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
24 31
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return file_.bytes_so_far(); 77 return file_.bytes_so_far();
71 } 78 }
72 79
73 bool SaveFile::GetHash(std::string* hash) { 80 bool SaveFile::GetHash(std::string* hash) {
74 return file_.GetHash(hash); 81 return file_.GetHash(hash);
75 } 82 }
76 83
77 std::string SaveFile::DebugString() const { 84 std::string SaveFile::DebugString() const {
78 return file_.DebugString(); 85 return file_.DebugString();
79 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698