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

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: merge 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
« no previous file with comments | « no previous file | chrome/browser/history/download_database.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/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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 void DownloadHistory::UpdateEntry(DownloadItem* download_item) { 88 void DownloadHistory::UpdateEntry(DownloadItem* download_item) {
89 // Don't store info in the database if the download was initiated while in 89 // Don't store info in the database if the download was initiated while in
90 // incognito mode or if it hasn't been initialized in our database table. 90 // incognito mode or if it hasn't been initialized in our database table.
91 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle) 91 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle)
92 return; 92 return;
93 93
94 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 94 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
95 if (!hs) 95 if (!hs)
96 return; 96 return;
97 97 hs->UpdateDownload(download_item->GetPersistentStoreInfo());
98 hs->UpdateDownload(download_item->received_bytes(),
99 download_item->state(),
100 download_item->db_handle());
101 } 98 }
102 99
103 void DownloadHistory::UpdateDownloadPath(DownloadItem* download_item, 100 void DownloadHistory::UpdateDownloadPath(DownloadItem* download_item,
104 const FilePath& new_path) { 101 const FilePath& new_path) {
105 // No update necessary if the download was initiated while in incognito mode. 102 // No update necessary if the download was initiated while in incognito mode.
106 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle) 103 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle)
107 return; 104 return;
108 105
109 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 106 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
110 if (hs) 107 if (hs)
(...skipping 27 matching lines...) Expand all
138 base::Time first_visit) { 135 base::Time first_visit) {
139 VisitedBeforeRequestsMap::iterator request = 136 VisitedBeforeRequestsMap::iterator request =
140 visited_before_requests_.find(handle); 137 visited_before_requests_.find(handle);
141 DCHECK(request != visited_before_requests_.end()); 138 DCHECK(request != visited_before_requests_.end());
142 int32 download_id = request->second.first; 139 int32 download_id = request->second.first;
143 VisitedBeforeDoneCallback callback = request->second.second; 140 VisitedBeforeDoneCallback callback = request->second.second;
144 visited_before_requests_.erase(request); 141 visited_before_requests_.erase(request);
145 callback.Run(download_id, found_visits && count && 142 callback.Run(download_id, found_visits && count &&
146 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight())); 143 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight()));
147 } 144 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/download_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698