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

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: fix ifndefs 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
« no previous file with comments | « no previous file | chrome/browser/download/download_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 // TODO(noelutz): This function currently works as a callback place holder. 562 // TODO(noelutz): This function currently works as a callback place holder.
566 // Once we decide the hash check is reliable, we could move the 563 // Once we decide the hash check is reliable, we could move the
567 // MaybeCompleteDownload in OnAllDataSaved to this function. 564 // MaybeCompleteDownload in OnAllDataSaved to this function.
568 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( 565 void ChromeDownloadManagerDelegate::CheckDownloadHashDone(
569 int32 download_id, 566 int32 download_id,
570 bool is_dangerous_hash) { 567 bool is_dangerous_hash) {
571 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 568 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
572 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id 569 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id
573 << " is dangerous_hash: " << is_dangerous_hash; 570 << " is dangerous_hash: " << is_dangerous_hash;
574 } 571 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698