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

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

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Correct typo 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 #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/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 &DownloadManager::CheckIfSuggestedPathExists, 333 &DownloadManager::CheckIfSuggestedPathExists,
334 info, 334 info,
335 download_prefs()->download_path())); 335 download_prefs()->download_path()));
336 } 336 }
337 337
338 void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info, 338 void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info,
339 const FilePath& default_path) { 339 const FilePath& default_path) {
340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 340 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
341 DCHECK(info); 341 DCHECK(info);
342 342
343 // Make sure the default download directory exists.
344 // TODO(phajdan.jr): only create the directory when we're sure the user
Paweł Hajdan Jr. 2011/05/13 09:16:22 By this comment I meant that in DownloadManager::C
Randy Smith (Not in Mondays) 2011/05/16 21:31:05 Pawel: I'm trying to think about how I'd ideally f
haraken1 2011/05/17 04:29:05 I would like to wait Pawel's reply.
Paweł Hajdan Jr. 2011/05/17 16:33:33 Yeah, generally the TODO is about removing this co
haraken1 2011/05/30 13:40:52 Finally, I removed these codes.
345 // is going to save there and not to another directory of his choice.
346 file_util::CreateDirectory(default_path);
347
348 // Check writability of the suggested path. If we can't write to it, default 343 // Check writability of the suggested path. If we can't write to it, default
349 // to the user's "My Documents" directory. We'll prompt them in this case. 344 // to the user's "My Documents" directory. We'll prompt them in this case.
350 FilePath dir = info->suggested_path.DirName(); 345 FilePath dir = info->suggested_path.DirName();
351 FilePath filename = info->suggested_path.BaseName(); 346 FilePath filename = info->suggested_path.BaseName();
352 if (!file_util::PathIsWritable(dir)) { 347 if (!file_util::PathIsWritable(dir)) {
353 VLOG(1) << "Unable to write to directory \"" << dir.value() << "\""; 348 VLOG(1) << "Unable to write to directory \"" << dir.value() << "\"";
354 info->prompt_user_for_save_location = true; 349 info->prompt_user_for_save_location = true;
355 PathService::Get(chrome::DIR_USER_DOCUMENTS, &info->suggested_path); 350 PathService::Get(chrome::DIR_USER_DOCUMENTS, &info->suggested_path);
356 info->suggested_path = info->suggested_path.Append(filename); 351 info->suggested_path = info->suggested_path.Append(filename);
357 } 352 }
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 observed_download_manager_->RemoveObserver(this); 1170 observed_download_manager_->RemoveObserver(this);
1176 } 1171 }
1177 1172
1178 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { 1173 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() {
1179 observing_download_manager_->NotifyModelChanged(); 1174 observing_download_manager_->NotifyModelChanged();
1180 } 1175 }
1181 1176
1182 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { 1177 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() {
1183 observed_download_manager_ = NULL; 1178 observed_download_manager_ = NULL;
1184 } 1179 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/save_package.cc » ('j') | chrome/browser/download/save_package.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698