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

Side by Side Diff: content/browser/download/drag_download_file.cc

Issue 9316116: Isolate initiation counts for downloads to their own histograms and improve (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restored curlies to original. Created 8 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/download/drag_download_file.h" 5 #include "content/browser/download/drag_download_file.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "content/browser/download/download_stats.h" 10 #include "content/browser/download/download_stats.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 #endif 126 #endif
127 127
128 download_manager_ = web_contents_->GetBrowserContext()->GetDownloadManager(); 128 download_manager_ = web_contents_->GetBrowserContext()->GetDownloadManager();
129 download_manager_observer_added_ = true; 129 download_manager_observer_added_ = true;
130 download_manager_->AddObserver(this); 130 download_manager_->AddObserver(this);
131 131
132 DownloadSaveInfo save_info; 132 DownloadSaveInfo save_info;
133 save_info.file_path = file_path_; 133 save_info.file_path = file_path_;
134 save_info.file_stream = file_stream_; 134 save_info.file_stream = file_stream_;
135 135
136 download_stats::RecordDownloadSource(
137 download_stats::INITIATED_BY_DRAG_N_DROP);
136 download_manager_->DownloadUrl(url_, 138 download_manager_->DownloadUrl(url_,
137 referrer_, 139 referrer_,
138 referrer_encoding_, 140 referrer_encoding_,
139 false, 141 false,
140 -1, 142 -1,
141 save_info, 143 save_info,
142 web_contents_); 144 web_contents_);
143 download_stats::RecordDownloadCount(
144 download_stats::INITIATED_BY_DRAG_N_DROP_COUNT);
145 } 145 }
146 146
147 void DragDownloadFile::DownloadCompleted(bool is_successful) { 147 void DragDownloadFile::DownloadCompleted(bool is_successful) {
148 #if defined(OS_WIN) 148 #if defined(OS_WIN)
149 // If not in drag-and-drop thread, defer the running to it. 149 // If not in drag-and-drop thread, defer the running to it.
150 if (drag_message_loop_ != MessageLoop::current()) { 150 if (drag_message_loop_ != MessageLoop::current()) {
151 drag_message_loop_->PostTask( 151 drag_message_loop_->PostTask(
152 FROM_HERE, 152 FROM_HERE,
153 base::Bind(&DragDownloadFile::DownloadCompleted, this, is_successful)); 153 base::Bind(&DragDownloadFile::DownloadCompleted, this, is_successful));
154 return; 154 return;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 void DragDownloadFile::QuitNestedMessageLoop() { 233 void DragDownloadFile::QuitNestedMessageLoop() {
234 AssertCurrentlyOnDragThread(); 234 AssertCurrentlyOnDragThread();
235 235
236 if (is_running_nested_message_loop_) { 236 if (is_running_nested_message_loop_) {
237 is_running_nested_message_loop_ = false; 237 is_running_nested_message_loop_ = false;
238 MessageLoop::current()->Quit(); 238 MessageLoop::current()->Quit();
239 } 239 }
240 } 240 }
241 #endif 241 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698