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

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

Issue 8401001: Fix history importing by delaying DownloadManager creation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: alpha, bugfix Created 9 years, 1 month 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/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return (item->mime_type() == Extension::kMimeType) || 56 return (item->mime_type() == Extension::kMimeType) ||
57 UserScript::IsURLUserScript(item->GetURL(), item->mime_type()); 57 UserScript::IsURLUserScript(item->GetURL(), item->mime_type());
58 } 58 }
59 59
60 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { 60 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
61 download_manager_ = dm; 61 download_manager_ = dm;
62 download_history_.reset(new DownloadHistory(profile_)); 62 download_history_.reset(new DownloadHistory(profile_));
63 download_history_->Load( 63 download_history_->Load(
64 base::Bind(&DownloadManager::OnPersistentStoreQueryComplete, 64 base::Bind(&DownloadManager::OnPersistentStoreQueryComplete,
65 base::Unretained(dm))); 65 base::Unretained(dm)));
66 download_history_->GetNextId(
67 base::Bind(&DownloadManager::OnPersistentStoreGetNextId,
68 base::Unretained(dm)));
69 } 66 }
70 67
71 void ChromeDownloadManagerDelegate::Shutdown() { 68 void ChromeDownloadManagerDelegate::Shutdown() {
72 download_history_.reset(); 69 download_history_.reset();
73 download_prefs_.reset(); 70 download_prefs_.reset();
74 } 71 }
75 72
76 bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { 73 bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) {
77 // We create a download item and store it in our download map, and inform the 74 // We create a download item and store it in our download map, and inform the
78 // history system of a new download. Since this method can be called while the 75 // history system of a new download. Since this method can be called while the
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // TODO(noelutz): This function currently works as a callback place holder. 537 // TODO(noelutz): This function currently works as a callback place holder.
541 // Once we decide the hash check is reliable, we could move the 538 // Once we decide the hash check is reliable, we could move the
542 // MaybeCompleteDownload in OnAllDataSaved to this function. 539 // MaybeCompleteDownload in OnAllDataSaved to this function.
543 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( 540 void ChromeDownloadManagerDelegate::CheckDownloadHashDone(
544 int32 download_id, 541 int32 download_id,
545 bool is_dangerous_hash) { 542 bool is_dangerous_hash) {
546 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
547 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id 544 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id
548 << " is dangerous_hash: " << is_dangerous_hash; 545 << " is dangerous_hash: " << is_dangerous_hash;
549 } 546 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698