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

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: uma 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
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
114 hs->UpdateDownload(download_item->received_bytes(), 114 hs->UpdateDownload(download_item->received_bytes(),
115 download_item->state(), 115 download_item->state(),
116 download_item->end_time(),
116 download_item->db_handle()); 117 download_item->db_handle());
117 } 118 }
118 119
119 void DownloadHistory::UpdateDownloadPath(DownloadItem* download_item, 120 void DownloadHistory::UpdateDownloadPath(DownloadItem* download_item,
120 const FilePath& new_path) { 121 const FilePath& new_path) {
121 // No update necessary if the download was initiated while in incognito mode. 122 // No update necessary if the download was initiated while in incognito mode.
122 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle) 123 if (download_item->db_handle() <= DownloadItem::kUninitializedHandle)
123 return; 124 return;
124 125
125 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 126 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
(...skipping 29 matching lines...) Expand all
155 VisitedBeforeRequestsMap::iterator request = 156 VisitedBeforeRequestsMap::iterator request =
156 visited_before_requests_.find(handle); 157 visited_before_requests_.find(handle);
157 DCHECK(request != visited_before_requests_.end()); 158 DCHECK(request != visited_before_requests_.end());
158 int32 download_id = request->second.first; 159 int32 download_id = request->second.first;
159 VisitedBeforeDoneCallback* callback = request->second.second; 160 VisitedBeforeDoneCallback* callback = request->second.second;
160 visited_before_requests_.erase(request); 161 visited_before_requests_.erase(request);
161 callback->Run(download_id, found_visits && count && 162 callback->Run(download_id, found_visits && count &&
162 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight())); 163 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight()));
163 delete callback; 164 delete callback;
164 } 165 }
166
167 void DownloadHistory::MarkDownloadOpened(int64 db_handle) {
168 // No update necessary if the download was initiated while in incognito mode.
169 if (db_handle <= DownloadItem::kUninitializedHandle)
170 return;
171
172 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
173 if (hs)
174 hs->MarkDownloadOpened(db_handle);
175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698