OLD | NEW |
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/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.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/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 return (item->mime_type() == Extension::kMimeType) || | 54 return (item->mime_type() == Extension::kMimeType) || |
55 UserScript::IsURLUserScript(item->GetURL(), item->mime_type()); | 55 UserScript::IsURLUserScript(item->GetURL(), item->mime_type()); |
56 } | 56 } |
57 | 57 |
58 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { | 58 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { |
59 download_manager_ = dm; | 59 download_manager_ = dm; |
60 download_history_.reset(new DownloadHistory(profile_)); | 60 download_history_.reset(new DownloadHistory(profile_)); |
61 download_history_->Load( | 61 download_history_->Load( |
62 NewCallback(dm, &DownloadManager::OnPersistentStoreQueryComplete)); | 62 NewCallback(dm, &DownloadManager::OnPersistentStoreQueryComplete)); |
| 63 download_history_->GetNextId( |
| 64 NewCallback(dm, &DownloadManager::OnPersistentStoreGetNextId)); |
63 } | 65 } |
64 | 66 |
65 void ChromeDownloadManagerDelegate::Shutdown() { | 67 void ChromeDownloadManagerDelegate::Shutdown() { |
66 download_history_.reset(); | 68 download_history_.reset(); |
67 download_prefs_.reset(); | 69 download_prefs_.reset(); |
68 } | 70 } |
69 | 71 |
70 bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { | 72 bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { |
71 // We create a download item and store it in our download map, and inform the | 73 // We create a download item and store it in our download map, and inform the |
72 // history system of a new download. Since this method can be called while the | 74 // history system of a new download. Since this method can be called while the |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 // TODO(noelutz): This function currently works as a callback place holder. | 539 // TODO(noelutz): This function currently works as a callback place holder. |
538 // Once we decide the hash check is reliable, we could move the | 540 // Once we decide the hash check is reliable, we could move the |
539 // MaybeCompleteDownload in OnAllDataSaved to this function. | 541 // MaybeCompleteDownload in OnAllDataSaved to this function. |
540 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( | 542 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( |
541 int32 download_id, | 543 int32 download_id, |
542 bool is_dangerous_hash) { | 544 bool is_dangerous_hash) { |
543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 545 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
544 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id | 546 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id |
545 << " is dangerous_hash: " << is_dangerous_hash; | 547 << " is dangerous_hash: " << is_dangerous_hash; |
546 } | 548 } |
OLD | NEW |