summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/download/download_service.cc4
-rw-r--r--chrome/browser/resources/net_internals/source_entry.js2
-rw-r--r--content/browser/download/download_create_info.cc6
-rw-r--r--content/browser/download/download_create_info.h8
-rw-r--r--content/browser/download/download_file_impl.cc5
-rw-r--r--content/browser/download/download_file_impl.h6
-rw-r--r--content/browser/download/download_file_manager.cc21
-rw-r--r--content/browser/download/download_file_manager.h10
-rw-r--r--content/browser/download/download_file_manager_unittest.cc9
-rw-r--r--content/browser/download/download_file_unittest.cc3
-rw-r--r--content/browser/download/download_item_impl.cc13
-rw-r--r--content/browser/download/download_manager_impl.cc27
-rw-r--r--content/browser/download/download_manager_impl.h7
-rw-r--r--content/browser/download/download_manager_impl_unittest.cc24
-rw-r--r--content/browser/download/download_resource_handler.cc3
-rw-r--r--content/browser/download/drag_download_util.cc4
-rw-r--r--content/browser/download/drag_download_util.h6
-rw-r--r--content/browser/tab_contents/web_drag_source_gtk.cc5
-rw-r--r--content/browser/tab_contents/web_drag_source_mac.mm4
-rw-r--r--content/public/browser/download_manager.h7
-rw-r--r--content/shell/shell_browser_context.cc3
-rw-r--r--content/test/mock_download_manager.h2
22 files changed, 126 insertions, 53 deletions
diff --git a/chrome/browser/download/download_service.cc b/chrome/browser/download/download_service.cc
index b58e0c2..1fd1908 100644
--- a/chrome/browser/download/download_service.cc
+++ b/chrome/browser/download/download_service.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/download/download_status_updater.h"
+#include "chrome/browser/net/chrome_net_log.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "content/public/browser/download_manager.h"
@@ -37,7 +38,8 @@ DownloadManager* DownloadService::GetDownloadManager() {
// SetDownloadManagerDelegateForTesting.
if (!manager_delegate_.get())
manager_delegate_ = new ChromeDownloadManagerDelegate(profile_);
- manager_ = DownloadManager::Create(manager_delegate_.get());
+ manager_ = DownloadManager::Create(manager_delegate_.get(),
+ g_browser_process->net_log());
manager_->Init(profile_);
manager_delegate_->SetDownloadManager(manager_);
diff --git a/chrome/browser/resources/net_internals/source_entry.js b/chrome/browser/resources/net_internals/source_entry.js
index f881d0e..dcab8d0 100644
--- a/chrome/browser/resources/net_internals/source_entry.js
+++ b/chrome/browser/resources/net_internals/source_entry.js
@@ -222,7 +222,7 @@ var SourceEntry = (function() {
findLastLogEntryStartByType_: function(type) {
for (var i = this.entries_.length - 1; i >= 0; --i) {
if (this.entries_[i].type == type) {
- if (this.entries_[i].phase == LogEventPhase.PHASE_BEGIN)
+ if (this.entries_[i].phase != LogEventPhase.PHASE_END)
return this.entries_[i];
}
}
diff --git a/content/browser/download/download_create_info.cc b/content/browser/download/download_create_info.cc
index 08999f7..c3b745f 100644
--- a/content/browser/download/download_create_info.cc
+++ b/content/browser/download/download_create_info.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,6 +18,7 @@ DownloadCreateInfo::DownloadCreateInfo(
int64 received_bytes,
int64 total_bytes,
int32 state,
+ const net::BoundNetLog& bound_net_log,
bool has_user_gesture,
content::PageTransition transition_type)
: path(path),
@@ -30,7 +31,8 @@ DownloadCreateInfo::DownloadCreateInfo(
has_user_gesture(has_user_gesture),
transition_type(transition_type),
db_handle(0),
- prompt_user_for_save_location(false) {
+ prompt_user_for_save_location(false),
+ request_bound_net_log(bound_net_log) {
}
DownloadCreateInfo::DownloadCreateInfo()
diff --git a/content/browser/download/download_create_info.h b/content/browser/download/download_create_info.h
index 9aad9a5..79a3dbd6 100644
--- a/content/browser/download/download_create_info.h
+++ b/content/browser/download/download_create_info.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,6 +18,7 @@
#include "content/public/browser/download_id.h"
#include "content/public/common/page_transition_types.h"
#include "googleurl/src/gurl.h"
+#include "net/base/net_log.h"
// Used for informing the download manager of a new download, since we don't
// want to pass |DownloadItem|s between threads.
@@ -28,6 +29,7 @@ struct CONTENT_EXPORT DownloadCreateInfo {
int64 received_bytes,
int64 total_bytes,
int32 state,
+ const net::BoundNetLog& bound_net_log,
bool has_user_gesture,
content::PageTransition transition_type);
DownloadCreateInfo();
@@ -110,6 +112,10 @@ struct CONTENT_EXPORT DownloadCreateInfo {
// The remote IP address where the download was fetched from. Copied from
// UrlRequest::GetSocketAddress().
std::string remote_address;
+
+ // The request's |BoundNetLog|, for "source_dependency" linking with the
+ // download item's.
+ const net::BoundNetLog request_bound_net_log;
};
#endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_CREATE_INFO_H_
diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc
index 40ba759..5fb7ffc 100644
--- a/content/browser/download/download_file_impl.cc
+++ b/content/browser/download/download_file_impl.cc
@@ -19,7 +19,8 @@ DownloadFileImpl::DownloadFileImpl(
const DownloadCreateInfo* info,
DownloadRequestHandleInterface* request_handle,
DownloadManager* download_manager,
- bool calculate_hash)
+ bool calculate_hash,
+ const net::BoundNetLog& bound_net_log)
: file_(info->save_info.file_path,
info->url(),
info->referrer_url,
@@ -27,7 +28,7 @@ DownloadFileImpl::DownloadFileImpl(
calculate_hash,
info->save_info.hash_state,
info->save_info.file_stream,
- net::BoundNetLog()),
+ bound_net_log),
id_(info->download_id),
request_handle_(request_handle),
download_manager_(download_manager) {
diff --git a/content/browser/download/download_file_impl.h b/content/browser/download/download_file_impl.h
index 67eb057..b66174e 100644
--- a/content/browser/download/download_file_impl.h
+++ b/content/browser/download/download_file_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,10 +21,12 @@ class DownloadManager;
class CONTENT_EXPORT DownloadFileImpl : virtual public content::DownloadFile {
public:
// Takes ownership of the object pointed to by |request_handle|.
+ // |bound_net_log| will be used for logging the download file's events.
DownloadFileImpl(const DownloadCreateInfo* info,
DownloadRequestHandleInterface* request_handle,
content::DownloadManager* download_manager,
- bool calculate_hash);
+ bool calculate_hash,
+ const net::BoundNetLog& bound_net_log);
virtual ~DownloadFileImpl();
// DownloadFile functions.
diff --git a/content/browser/download/download_file_manager.cc b/content/browser/download/download_file_manager.cc
index 1b360af..a0a6c46 100644
--- a/content/browser/download/download_file_manager.cc
+++ b/content/browser/download/download_file_manager.cc
@@ -46,17 +46,20 @@ class DownloadFileFactoryImpl
DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle,
DownloadManager* download_manager,
- bool calculate_hash) OVERRIDE;
+ bool calculate_hash,
+ const net::BoundNetLog& bound_net_log) OVERRIDE;
};
DownloadFile* DownloadFileFactoryImpl::CreateFile(
DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle,
DownloadManager* download_manager,
- bool calculate_hash) {
+ bool calculate_hash,
+ const net::BoundNetLog& bound_net_log) {
return new DownloadFileImpl(info,
new DownloadRequestHandle(request_handle),
- download_manager, calculate_hash);
+ download_manager, calculate_hash,
+ bound_net_log);
}
} // namespace
@@ -87,7 +90,8 @@ void DownloadFileManager::OnShutdown() {
void DownloadFileManager::CreateDownloadFile(
DownloadCreateInfo* info, const DownloadRequestHandle& request_handle,
- DownloadManager* download_manager, bool get_hash) {
+ DownloadManager* download_manager, bool get_hash,
+ const net::BoundNetLog& bound_net_log) {
DCHECK(info);
VLOG(20) << __FUNCTION__ << "()" << " info = " << info->DebugString();
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
@@ -96,7 +100,7 @@ void DownloadFileManager::CreateDownloadFile(
scoped_ptr<DownloadCreateInfo> infop(info);
scoped_ptr<DownloadFile> download_file(download_file_factory_->CreateFile(
- info, request_handle, download_manager, get_hash));
+ info, request_handle, download_manager, get_hash, bound_net_log));
if (net::OK != download_file->Initialize()) {
request_handle.CancelRequest();
return;
@@ -167,13 +171,16 @@ void DownloadFileManager::StartDownload(
return;
}
- manager->CreateDownloadItem(info, request_handle);
+ // |bound_net_log| will be used for logging the both the download item's and
+ // the download file's events.
+ net::BoundNetLog bound_net_log =
+ manager->CreateDownloadItem(info, request_handle);
bool hash_needed = manager->GenerateFileHash();
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
base::Bind(&DownloadFileManager::CreateDownloadFile, this,
info, request_handle, make_scoped_refptr(manager),
- hash_needed));
+ hash_needed, bound_net_log));
}
// We don't forward an update to the UI thread here, since we want to throttle
diff --git a/content/browser/download/download_file_manager.h b/content/browser/download/download_file_manager.h
index 1a3054ef..b5f1654 100644
--- a/content/browser/download/download_file_manager.h
+++ b/content/browser/download/download_file_manager.h
@@ -66,6 +66,10 @@ class DownloadFile;
class DownloadManager;
}
+namespace net {
+class BoundNetLog;
+}
+
// Manages all in progress downloads.
class CONTENT_EXPORT DownloadFileManager
: public base::RefCountedThreadSafe<DownloadFileManager> {
@@ -78,7 +82,8 @@ class CONTENT_EXPORT DownloadFileManager
DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle,
content::DownloadManager* download_manager,
- bool calculate_hash) = 0;
+ bool calculate_hash,
+ const net::BoundNetLog& bound_net_log) = 0;
};
// Takes ownership of the factory.
@@ -160,7 +165,8 @@ class CONTENT_EXPORT DownloadFileManager
void CreateDownloadFile(DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle,
content::DownloadManager* download_manager,
- bool hash_needed);
+ bool hash_needed,
+ const net::BoundNetLog& bound_net_log);
// Called only on the download thread.
content::DownloadFile* GetDownloadFile(content::DownloadId global_id);
diff --git a/content/browser/download/download_file_manager_unittest.cc b/content/browser/download/download_file_manager_unittest.cc
index bdbad04..f14c038 100644
--- a/content/browser/download/download_file_manager_unittest.cc
+++ b/content/browser/download/download_file_manager_unittest.cc
@@ -44,7 +44,8 @@ class MockDownloadFileFactory :
DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle,
content::DownloadManager* download_manager,
- bool calculate_hash) OVERRIDE;
+ bool calculate_hash,
+ const net::BoundNetLog& bound_net_log) OVERRIDE;
MockDownloadFile* GetExistingFile(const DownloadId& id);
@@ -56,7 +57,8 @@ content::DownloadFile* MockDownloadFileFactory::CreateFile(
DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle,
content::DownloadManager* download_manager,
- bool calculate_hash) {
+ bool calculate_hash,
+ const net::BoundNetLog& bound_net_log) {
DCHECK(files_.end() == files_.find(info->download_id));
MockDownloadFile* created_file = new MockDownloadFile();
files_[info->download_id] = created_file;
@@ -167,7 +169,8 @@ class DownloadFileManagerTest : public testing::Test {
// Set expectations and return values.
EXPECT_CALL(*download_manager_, CreateDownloadItem(info, _))
- .Times(1);
+ .Times(1)
+ .WillOnce(Return(net::BoundNetLog()));
EXPECT_CALL(*download_manager_, GenerateFileHash())
.Times(AtLeast(1))
.WillRepeatedly(Return(false));
diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc
index 2418857..aa6e8e7 100644
--- a/content/browser/download/download_file_unittest.cc
+++ b/content/browser/download/download_file_unittest.cc
@@ -69,7 +69,8 @@ class DownloadFileTest : public testing::Test {
info.save_info.file_stream = file_stream_;
file->reset(
new DownloadFileImpl(&info, new DownloadRequestHandle(),
- download_manager_, calculate_hash));
+ download_manager_, calculate_hash,
+ net::BoundNetLog()));
}
virtual void DestroyDownloadFile(scoped_ptr<DownloadFile>* file, int offset) {
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index cdcd10e..03b1a0e 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -242,6 +242,19 @@ DownloadItemImpl::DownloadItemImpl(
delegate_->Attach();
Init(true /* actively downloading */,
download_net_logs::SRC_NEW_DOWNLOAD);
+
+ // Link the event sources.
+ bound_net_log_.AddEvent(
+ net::NetLog::TYPE_DOWNLOAD_URL_REQUEST,
+ make_scoped_refptr(new net::NetLogSourceParameter(
+ "source_dependency",
+ info.request_bound_net_log.source())));
+
+ info.request_bound_net_log.AddEvent(
+ net::NetLog::TYPE_DOWNLOAD_STARTED,
+ make_scoped_refptr(new net::NetLogSourceParameter(
+ "source_dependency",
+ bound_net_log_.source())));
}
// Constructing for the "Save Page As..." feature:
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index 7049785..dfbb367 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -127,19 +127,22 @@ namespace content {
// static
DownloadManager* DownloadManager::Create(
- content::DownloadManagerDelegate* delegate) {
- return new DownloadManagerImpl(delegate);
+ content::DownloadManagerDelegate* delegate,
+ net::NetLog* net_log) {
+ return new DownloadManagerImpl(delegate, net_log);
}
} // namespace content
DownloadManagerImpl::DownloadManagerImpl(
- content::DownloadManagerDelegate* delegate)
+ content::DownloadManagerDelegate* delegate,
+ net::NetLog* net_log)
: shutdown_needed_(false),
browser_context_(NULL),
file_manager_(NULL),
delegate_(delegate),
- largest_db_handle_in_history_(DownloadItem::kUninitializedHandle) {
+ largest_db_handle_in_history_(DownloadItem::kUninitializedHandle),
+ net_log_(net_log) {
}
DownloadManagerImpl::~DownloadManagerImpl() {
@@ -389,19 +392,23 @@ FilePath DownloadManagerImpl::LastDownloadPath() {
return last_download_path_;
}
-void DownloadManagerImpl::CreateDownloadItem(
+net::BoundNetLog DownloadManagerImpl::CreateDownloadItem(
DownloadCreateInfo* info, const DownloadRequestHandle& request_handle) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ net::BoundNetLog bound_net_log =
+ net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD);
DownloadItem* download = new DownloadItemImpl(
this, *info, new DownloadRequestHandle(request_handle),
- browser_context_->IsOffTheRecord(), net::BoundNetLog());
+ browser_context_->IsOffTheRecord(), bound_net_log);
int32 download_id = info->download_id.local();
DCHECK(!ContainsKey(in_progress_, download_id));
CHECK_96627(!ContainsKey(active_downloads_, download_id));
downloads_.insert(download);
active_downloads_[download_id] = download;
+
+ return bound_net_log;
}
DownloadItem* DownloadManagerImpl::CreateSavePackageDownloadItem(
@@ -409,8 +416,10 @@ DownloadItem* DownloadManagerImpl::CreateSavePackageDownloadItem(
const GURL& page_url,
bool is_otr,
DownloadItem::Observer* observer) {
+ net::BoundNetLog bound_net_log =
+ net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD);
DownloadItem* download = new DownloadItemImpl(
- this, main_file_path, page_url, is_otr, GetNextId(), net::BoundNetLog());
+ this, main_file_path, page_url, is_otr, GetNextId(), bound_net_log);
download->AddObserver(observer);
@@ -906,8 +915,10 @@ void DownloadManagerImpl::OnPersistentStoreQueryComplete(
largest_db_handle_in_history_ = 0;
for (size_t i = 0; i < entries->size(); ++i) {
+ net::BoundNetLog bound_net_log =
+ net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD);
DownloadItem* download = new DownloadItemImpl(
- this, GetNextId(), entries->at(i), net::BoundNetLog());
+ this, GetNextId(), entries->at(i), bound_net_log);
CHECK_96627(!ContainsKey(history_downloads_, download->GetDbHandle()));
downloads_.insert(download);
history_downloads_[download->GetDbHandle()] = download;
diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h
index 7eeb06f..e05bce9 100644
--- a/content/browser/download/download_manager_impl.h
+++ b/content/browser/download/download_manager_impl.h
@@ -25,7 +25,8 @@ class CONTENT_EXPORT DownloadManagerImpl
: public content::DownloadManager,
public DownloadItemImpl::Delegate {
public:
- DownloadManagerImpl(content::DownloadManagerDelegate* delegate);
+ DownloadManagerImpl(content::DownloadManagerDelegate* delegate,
+ net::NetLog* net_log);
// content::DownloadManager functions.
virtual void Shutdown() OVERRIDE;
@@ -71,7 +72,7 @@ class CONTENT_EXPORT DownloadManagerImpl
virtual int InProgressCount() const OVERRIDE;
virtual content::BrowserContext* GetBrowserContext() const OVERRIDE;
virtual FilePath LastDownloadPath() OVERRIDE;
- virtual void CreateDownloadItem(
+ virtual net::BoundNetLog CreateDownloadItem(
DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle) OVERRIDE;
virtual content::DownloadItem* CreateSavePackageDownloadItem(
@@ -247,6 +248,8 @@ class CONTENT_EXPORT DownloadManagerImpl
// For debugging only.
int64 largest_db_handle_in_history_;
+ net::NetLog* net_log_;
+
DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl);
};
diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc
index 323e267..635f4fb 100644
--- a/content/browser/download/download_manager_impl_unittest.cc
+++ b/content/browser/download/download_manager_impl_unittest.cc
@@ -74,17 +74,20 @@ class MockDownloadFileFactory
public:
MockDownloadFileFactory() {}
- virtual DownloadFile* CreateFile(DownloadCreateInfo* info,
- const DownloadRequestHandle& request_handle,
- DownloadManager* download_manager,
- bool calculate_hash) OVERRIDE;
+ virtual DownloadFile* CreateFile(
+ DownloadCreateInfo* info,
+ const DownloadRequestHandle& request_handle,
+ DownloadManager* download_manager,
+ bool calculate_hash,
+ const net::BoundNetLog& bound_net_log) OVERRIDE;
};
DownloadFile* MockDownloadFileFactory::CreateFile(
DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle,
DownloadManager* download_manager,
- bool calculate_hash) {
+ bool calculate_hash,
+ const net::BoundNetLog& bound_net_log) {
NOTREACHED();
return NULL;
}
@@ -211,7 +214,7 @@ class DownloadManagerTest : public testing::Test {
: browser_context(new TestBrowserContext()),
download_manager_delegate_(new TestDownloadManagerDelegate()),
download_manager_(DownloadManager::Create(
- download_manager_delegate_.get())),
+ download_manager_delegate_.get(), NULL)),
ui_thread_(BrowserThread::UI, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_),
download_buffer_(new content::DownloadBuffer) {
@@ -345,7 +348,8 @@ DownloadFileWithErrors::DownloadFileWithErrors(DownloadCreateInfo* info,
: DownloadFileImpl(info,
new DownloadRequestHandle(),
manager,
- calculate_hash),
+ calculate_hash,
+ net::BoundNetLog()),
forced_error_(net::OK) {
}
@@ -535,7 +539,7 @@ TEST_F(DownloadManagerTest, MAYBE_StartDownload) {
DownloadFile* download_file(
new DownloadFileImpl(info.get(), new DownloadRequestHandle(),
- download_manager_, false));
+ download_manager_, false, net::BoundNetLog()));
AddDownloadToFileManager(info->download_id.local(), download_file);
download_file->Initialize();
download_manager_->StartDownload(info->download_id.local());
@@ -1186,7 +1190,7 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadOverwriteTest) {
// properly.
DownloadFile* download_file(
new DownloadFileImpl(info.get(), new DownloadRequestHandle(),
- download_manager_, false));
+ download_manager_, false, net::BoundNetLog()));
download_file->Rename(cr_path);
// This creates the .temp version of the file.
download_file->Initialize();
@@ -1260,7 +1264,7 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadRemoveTest) {
// properly.
DownloadFile* download_file(
new DownloadFileImpl(info.get(), new DownloadRequestHandle(),
- download_manager_, false));
+ download_manager_, false, net::BoundNetLog()));
download_file->Rename(cr_path);
// This creates the .temp version of the file.
download_file->Initialize();
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc
index cb9f289..400478c 100644
--- a/content/browser/download/download_resource_handler.cc
+++ b/content/browser/download/download_resource_handler.cc
@@ -98,7 +98,8 @@ bool DownloadResourceHandler::OnResponseStarted(
// Deleted in DownloadManager.
scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo(FilePath(), GURL(),
base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS,
- request_info->has_user_gesture(), request_info->transition_type()));
+ request_->net_log(), request_info->has_user_gesture(),
+ request_info->transition_type()));
info->url_chain = request_->url_chain();
info->referrer_url = GURL(request_->referrer());
info->start_time = base::Time::Now();
diff --git a/content/browser/download/drag_download_util.cc b/content/browser/download/drag_download_util.cc
index ed781bb..b43cc57 100644
--- a/content/browser/download/drag_download_util.cc
+++ b/content/browser/download/drag_download_util.cc
@@ -56,10 +56,10 @@ bool ParseDownloadMetadata(const string16& metadata,
return true;
}
-FileStream* CreateFileStreamForDrop(FilePath* file_path) {
+FileStream* CreateFileStreamForDrop(FilePath* file_path, net::NetLog* net_log) {
DCHECK(file_path && !file_path->empty());
- scoped_ptr<FileStream> file_stream(new FileStream(NULL));
+ scoped_ptr<FileStream> file_stream(new FileStream(net_log));
const int kMaxSeq = 99;
for (int seq = 0; seq <= kMaxSeq; seq++) {
FilePath new_file_path;
diff --git a/content/browser/download/drag_download_util.h b/content/browser/download/drag_download_util.h
index 95a5521..7cb7ada 100644
--- a/content/browser/download/drag_download_util.h
+++ b/content/browser/download/drag_download_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -38,7 +38,9 @@ CONTENT_EXPORT bool ParseDownloadMetadata(const string16& metadata,
// Create a new file at the specified path. If the file already exists, try to
// insert the sequential unifier to produce a new file, like foo-01.txt.
// Return a FileStream if successful.
-CONTENT_EXPORT net::FileStream* CreateFileStreamForDrop(FilePath* file_path);
+// |net_log| is a NetLog for the stream.
+CONTENT_EXPORT net::FileStream* CreateFileStreamForDrop(
+ FilePath* file_path, net::NetLog* net_log);
// Implementation of DownloadFileObserver to finalize the download process.
class CONTENT_EXPORT PromiseFileFinalizer : public ui::DownloadFileObserver {
diff --git a/content/browser/tab_contents/web_drag_source_gtk.cc b/content/browser/tab_contents/web_drag_source_gtk.cc
index da09af2..6be0dc6 100644
--- a/content/browser/tab_contents/web_drag_source_gtk.cc
+++ b/content/browser/tab_contents/web_drag_source_gtk.cc
@@ -18,6 +18,7 @@
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_view_host_delegate.h"
#include "content/public/browser/web_contents_view.h"
+#include "content/public/common/content_client.h"
#include "net/base/file_stream.h"
#include "net/base/net_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -243,7 +244,9 @@ void WebDragSourceGtk::OnDragDataGet(GtkWidget* sender,
if (net::FileURLToFilePath(file_url, &file_path)) {
// Open the file as a stream.
net::FileStream* file_stream =
- drag_download_util::CreateFileStreamForDrop(&file_path);
+ drag_download_util::CreateFileStreamForDrop(
+ &file_path,
+ content::GetContentClient()->browser()->GetNetLog());
if (file_stream) {
// Start downloading the file to the stream.
scoped_refptr<DragDownloadFile> drag_file_downloader =
diff --git a/content/browser/tab_contents/web_drag_source_mac.mm b/content/browser/tab_contents/web_drag_source_mac.mm
index ba84e6d..02f8293 100644
--- a/content/browser/tab_contents/web_drag_source_mac.mm
+++ b/content/browser/tab_contents/web_drag_source_mac.mm
@@ -20,6 +20,7 @@
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/content_browser_client.h"
+#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
#include "net/base/file_stream.h"
#include "net/base/net_util.h"
@@ -323,7 +324,8 @@ void PromiseWriterHelper(const WebDropData& drop_data,
// UI thread on OSX, it should be reasonable to let it happen.
base::ThreadRestrictions::ScopedAllowIO allowIO;
FileStream* fileStream =
- drag_download_util::CreateFileStreamForDrop(&filePath);
+ drag_download_util::CreateFileStreamForDrop(
+ &filePath, content::GetContentClient()->browser()->GetNetLog());
if (!fileStream)
return nil;
diff --git a/content/public/browser/download_manager.h b/content/public/browser/download_manager.h
index 52a5437..12d6fb0 100644
--- a/content/public/browser/download_manager.h
+++ b/content/public/browser/download_manager.h
@@ -40,6 +40,7 @@
#include "content/public/browser/download_id.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/browser_thread.h"
+#include "net/base/net_log.h"
#include "net/base/net_errors.h"
class DownloadFileManager;
@@ -64,7 +65,8 @@ class CONTENT_EXPORT DownloadManager
virtual ~DownloadManager() {}
static DownloadManager* Create(
- DownloadManagerDelegate* delegate);
+ DownloadManagerDelegate* delegate,
+ net::NetLog* net_log);
// Shutdown the download manager. Must be called before destruction.
virtual void Shutdown() = 0;
@@ -206,7 +208,8 @@ class CONTENT_EXPORT DownloadManager
virtual FilePath LastDownloadPath() = 0;
// Creates the download item. Must be called on the UI thread.
- virtual void CreateDownloadItem(
+ // Returns the |BoundNetLog| used by the |DownloadItem|.
+ virtual net::BoundNetLog CreateDownloadItem(
DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle) = 0;
diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc
index 079687e..6078b38 100644
--- a/content/shell/shell_browser_context.cc
+++ b/content/shell/shell_browser_context.cc
@@ -138,7 +138,8 @@ SSLHostState* ShellBrowserContext::GetSSLHostState() {
DownloadManager* ShellBrowserContext::GetDownloadManager() {
if (!download_manager_.get()) {
download_manager_delegate_ = new ShellDownloadManagerDelegate();
- download_manager_ = new DownloadManagerImpl(download_manager_delegate_);
+ download_manager_ = new DownloadManagerImpl(download_manager_delegate_,
+ NULL);
download_manager_delegate_->SetDownloadManager(download_manager_.get());
download_manager_->Init(this);
}
diff --git a/content/test/mock_download_manager.h b/content/test/mock_download_manager.h
index be946b5..d5ca6d0 100644
--- a/content/test/mock_download_manager.h
+++ b/content/test/mock_download_manager.h
@@ -67,7 +67,7 @@ class MockDownloadManager : public content::DownloadManager {
MOCK_CONST_METHOD0(InProgressCount, int());
MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*());
MOCK_METHOD0(LastDownloadPath, FilePath());
- MOCK_METHOD2(CreateDownloadItem, void(
+ MOCK_METHOD2(CreateDownloadItem, net::BoundNetLog(
DownloadCreateInfo* info,
const DownloadRequestHandle& request_handle));
MOCK_METHOD4(CreateSavePackageDownloadItem, content::DownloadItem*(