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

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

Issue 8008021: Add new UMA stats to get a handle on Downloads UI Usage (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: comments Created 9 years, 2 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/download_history.h" 5 #include "chrome/browser/download/download_history.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/download/chrome_download_manager_delegate.h" 8 #include "chrome/browser/download/chrome_download_manager_delegate.h"
9 #include "chrome/browser/history/history_marshaling.h" 9 #include "chrome/browser/history/history_marshaling.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 void DownloadHistory::UpdateEntry(DownloadItem* download_item) { 104 void DownloadHistory::UpdateEntry(DownloadItem* download_item) {
105 // Don't store info in the database if the download was initiated while in 105 // Don't store info in the database if the download was initiated while in
106 // incognito mode or if it hasn't been initialized in our database table. 106 // incognito mode or if it hasn't been initialized in our database table.
107 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle) 107 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle)
108 return; 108 return;
109 109
110 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 110 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
111 if (!hs) 111 if (!hs)
112 return; 112 return;
113 113 hs->UpdateDownload(download_item->GetPersistentStoreInfo());
114 hs->UpdateDownload(download_item->received_bytes(),
115 download_item->state(),
116 download_item->db_handle());
117 } 114 }
118 115
119 void DownloadHistory::UpdateDownloadPath(DownloadItem* download_item, 116 void DownloadHistory::UpdateDownloadPath(DownloadItem* download_item,
120 const FilePath& new_path) { 117 const FilePath& new_path) {
121 // No update necessary if the download was initiated while in incognito mode. 118 // No update necessary if the download was initiated while in incognito mode.
122 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle) 119 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle)
123 return; 120 return;
124 121
125 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 122 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
126 if (hs) 123 if (hs)
(...skipping 28 matching lines...) Expand all
155 VisitedBeforeRequestsMap::iterator request = 152 VisitedBeforeRequestsMap::iterator request =
156 visited_before_requests_.find(handle); 153 visited_before_requests_.find(handle);
157 DCHECK(request != visited_before_requests_.end()); 154 DCHECK(request != visited_before_requests_.end());
158 int32 download_id = request->second.first; 155 int32 download_id = request->second.first;
159 VisitedBeforeDoneCallback* callback = request->second.second; 156 VisitedBeforeDoneCallback* callback = request->second.second;
160 visited_before_requests_.erase(request); 157 visited_before_requests_.erase(request);
161 callback->Run(download_id, found_visits && count && 158 callback->Run(download_id, found_visits && count &&
162 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight())); 159 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight()));
163 delete callback; 160 delete callback;
164 } 161 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/download_database.h » ('j') | chrome/browser/history/download_database.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698