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

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

Issue 7237034: sql::MetaTable.next_download_id, DownloadManager::GetNextId() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge AGAIN Created 9 years, 4 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/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 29 matching lines...) Expand all
40 } 40 }
41 41
42 ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() { 42 ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
43 } 43 }
44 44
45 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { 45 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
46 download_manager_ = dm; 46 download_manager_ = dm;
47 download_history_.reset(new DownloadHistory(profile_)); 47 download_history_.reset(new DownloadHistory(profile_));
48 download_history_->Load( 48 download_history_->Load(
49 NewCallback(dm, &DownloadManager::OnPersistentStoreQueryComplete)); 49 NewCallback(dm, &DownloadManager::OnPersistentStoreQueryComplete));
50 download_history_->GetNextId(
51 NewCallback(dm, &DownloadManager::OnPersistentStoreGetNextId));
50 } 52 }
51 53
52 void ChromeDownloadManagerDelegate::Shutdown() { 54 void ChromeDownloadManagerDelegate::Shutdown() {
53 download_history_.reset(); 55 download_history_.reset();
54 download_prefs_.reset(); 56 download_prefs_.reset();
55 } 57 }
56 58
57 bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { 59 bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) {
58 // We create a download item and store it in our download map, and inform the 60 // We create a download item and store it in our download map, and inform the
59 // history system of a new download. Since this method can be called while the 61 // history system of a new download. Since this method can be called while the
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 int32 download_id, int64 db_handle) { 429 int32 download_id, int64 db_handle) {
428 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 430 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
429 // call this function with an invalid |db_handle|. For instance, this can 431 // call this function with an invalid |db_handle|. For instance, this can
430 // happen when the history database is offline. We cannot have multiple 432 // happen when the history database is offline. We cannot have multiple
431 // DownloadItems with the same invalid db_handle, so we need to assign a 433 // DownloadItems with the same invalid db_handle, so we need to assign a
432 // unique |db_handle| here. 434 // unique |db_handle| here.
433 if (db_handle == DownloadItem::kUninitializedHandle) 435 if (db_handle == DownloadItem::kUninitializedHandle)
434 db_handle = download_history_->GetNextFakeDbHandle(); 436 db_handle = download_history_->GetNextFakeDbHandle();
435 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 437 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
436 } 438 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_history.h » ('j') | content/browser/renderer_host/buffered_resource_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698