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

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

Issue 7793003: Revert 98656 - Make a new integer field in sql::MetaTable (a per-profile db) containing a counter... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/download/download_history.h » ('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/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
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));
65 } 63 }
66 64
67 void ChromeDownloadManagerDelegate::Shutdown() { 65 void ChromeDownloadManagerDelegate::Shutdown() {
68 download_history_.reset(); 66 download_history_.reset();
69 download_prefs_.reset(); 67 download_prefs_.reset();
70 } 68 }
71 69
72 bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { 70 bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) {
73 // We create a download item and store it in our download map, and inform the 71 // We create a download item and store it in our download map, and inform the
74 // history system of a new download. Since this method can be called while the 72 // history system of a new download. Since this method can be called while the
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 int32 download_id, int64 db_handle) { 499 int32 download_id, int64 db_handle) {
502 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 500 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
503 // call this function with an invalid |db_handle|. For instance, this can 501 // call this function with an invalid |db_handle|. For instance, this can
504 // happen when the history database is offline. We cannot have multiple 502 // happen when the history database is offline. We cannot have multiple
505 // DownloadItems with the same invalid db_handle, so we need to assign a 503 // DownloadItems with the same invalid db_handle, so we need to assign a
506 // unique |db_handle| here. 504 // unique |db_handle| here.
507 if (db_handle == DownloadItem::kUninitializedHandle) 505 if (db_handle == DownloadItem::kUninitializedHandle)
508 db_handle = download_history_->GetNextFakeDbHandle(); 506 db_handle = download_history_->GetNextFakeDbHandle();
509 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 507 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
510 } 508 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698