diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-08 22:14:33 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-08 22:14:33 +0000 |
commit | d12f1471a7d9a5d82de92990cf82e21957fdc3ff (patch) | |
tree | 65fc519ee8871a4b3c06371576bb9c142ba83b68 | |
parent | 7b054893fdead91168156d7462482f3a16241c65 (diff) | |
download | chromium_src-d12f1471a7d9a5d82de92990cf82e21957fdc3ff.zip chromium_src-d12f1471a7d9a5d82de92990cf82e21957fdc3ff.tar.gz chromium_src-d12f1471a7d9a5d82de92990cf82e21957fdc3ff.tar.bz2 |
Back out r121050 from the trunk due to a compile failure.
http://build.chromium.org/p/chromium/builders/Win%20Aura/builds/5477/steps/compile/logs/stdio
Hooked up NetLog to DownloadItem, DownloadFile, and FileStream.
The ChromeNetLog object is owned by the browser process, which has a longer lifetime than the profile and therefore than the download system. For each download, there will be one BoundNetLog (or a copy thereof) used by DownloadItem and DownloadFile, and one separate one used by FileStream.
For most downloads, the path to get a NetLog pointer to the download objects (DownloadItem, DownloadFile and FileStream) is through the URL request. A BoundNetLog is created and passed in to the DownloadResourceHandler constructor, which adds it to a DownloadCreateInfo that it makes. This gets it to DownloadItem, DownloadFile/BaseFile, and FileStream.
For downloads created from the history database, the path is via the DownloadService and the DownloadManager constructor. Likewise for downloads created as part of a 'Save Page As' operation, although that may change in the future with further refactoring of the 'Save Page As' code.
For downloads initiated by drag & drop on Linux and Mac (but not on Windows), the FileStream needs to get a NetLog pointer from another source. In this case, it is via the ContentClient (effectively a global) and ContentBrowserClient classes.
Note that FileStream has a different NetLog source than the other classes.
This is the final of 4 CLs that will enable net logging for downloads.
BUG=None
TEST=Go to a web page with downloadable content.
Open a new tab with about:net-internals.
Download a file.
Check the EVENTS tab of about:net-internals: there should be DOWNLOAD and FILESTREAM events.
Review URL: http://codereview.chromium.org/9296012
TBR=ahendrickson@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9361048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121073 0039d316-1c4b-4281-b951-d872f2087c98
22 files changed, 53 insertions, 126 deletions
diff --git a/chrome/browser/download/download_service.cc b/chrome/browser/download/download_service.cc index 1fd1908..b58e0c2 100644 --- a/chrome/browser/download/download_service.cc +++ b/chrome/browser/download/download_service.cc @@ -9,7 +9,6 @@ #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" @@ -38,8 +37,7 @@ DownloadManager* DownloadService::GetDownloadManager() { // SetDownloadManagerDelegateForTesting. if (!manager_delegate_.get()) manager_delegate_ = new ChromeDownloadManagerDelegate(profile_); - manager_ = DownloadManager::Create(manager_delegate_.get(), - g_browser_process->net_log()); + manager_ = DownloadManager::Create(manager_delegate_.get()); 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 dcab8d0..f881d0e 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_END) + if (this.entries_[i].phase == LogEventPhase.PHASE_BEGIN) return this.entries_[i]; } } diff --git a/content/browser/download/download_create_info.cc b/content/browser/download/download_create_info.cc index c3b745f..08999f7 100644 --- a/content/browser/download/download_create_info.cc +++ b/content/browser/download/download_create_info.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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,7 +18,6 @@ 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), @@ -31,8 +30,7 @@ DownloadCreateInfo::DownloadCreateInfo( has_user_gesture(has_user_gesture), transition_type(transition_type), db_handle(0), - prompt_user_for_save_location(false), - request_bound_net_log(bound_net_log) { + prompt_user_for_save_location(false) { } DownloadCreateInfo::DownloadCreateInfo() diff --git a/content/browser/download/download_create_info.h b/content/browser/download/download_create_info.h index 79a3dbd6..9aad9a5 100644 --- a/content/browser/download/download_create_info.h +++ b/content/browser/download/download_create_info.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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,7 +18,6 @@ #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. @@ -29,7 +28,6 @@ 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(); @@ -112,10 +110,6 @@ 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 5fb7ffc..40ba759 100644 --- a/content/browser/download/download_file_impl.cc +++ b/content/browser/download/download_file_impl.cc @@ -19,8 +19,7 @@ DownloadFileImpl::DownloadFileImpl( const DownloadCreateInfo* info, DownloadRequestHandleInterface* request_handle, DownloadManager* download_manager, - bool calculate_hash, - const net::BoundNetLog& bound_net_log) + bool calculate_hash) : file_(info->save_info.file_path, info->url(), info->referrer_url, @@ -28,7 +27,7 @@ DownloadFileImpl::DownloadFileImpl( calculate_hash, info->save_info.hash_state, info->save_info.file_stream, - bound_net_log), + net::BoundNetLog()), 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 b66174e..67eb057 100644 --- a/content/browser/download/download_file_impl.h +++ b/content/browser/download/download_file_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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,12 +21,10 @@ 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, - const net::BoundNetLog& bound_net_log); + bool calculate_hash); virtual ~DownloadFileImpl(); // DownloadFile functions. diff --git a/content/browser/download/download_file_manager.cc b/content/browser/download/download_file_manager.cc index a0a6c46..1b360af 100644 --- a/content/browser/download/download_file_manager.cc +++ b/content/browser/download/download_file_manager.cc @@ -46,20 +46,17 @@ class DownloadFileFactoryImpl DownloadCreateInfo* info, const DownloadRequestHandle& request_handle, DownloadManager* download_manager, - bool calculate_hash, - const net::BoundNetLog& bound_net_log) OVERRIDE; + bool calculate_hash) OVERRIDE; }; DownloadFile* DownloadFileFactoryImpl::CreateFile( DownloadCreateInfo* info, const DownloadRequestHandle& request_handle, DownloadManager* download_manager, - bool calculate_hash, - const net::BoundNetLog& bound_net_log) { + bool calculate_hash) { return new DownloadFileImpl(info, new DownloadRequestHandle(request_handle), - download_manager, calculate_hash, - bound_net_log); + download_manager, calculate_hash); } } // namespace @@ -90,8 +87,7 @@ void DownloadFileManager::OnShutdown() { void DownloadFileManager::CreateDownloadFile( DownloadCreateInfo* info, const DownloadRequestHandle& request_handle, - DownloadManager* download_manager, bool get_hash, - const net::BoundNetLog& bound_net_log) { + DownloadManager* download_manager, bool get_hash) { DCHECK(info); VLOG(20) << __FUNCTION__ << "()" << " info = " << info->DebugString(); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); @@ -100,7 +96,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, bound_net_log)); + info, request_handle, download_manager, get_hash)); if (net::OK != download_file->Initialize()) { request_handle.CancelRequest(); return; @@ -171,16 +167,13 @@ void DownloadFileManager::StartDownload( return; } - // |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); + 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, bound_net_log)); + hash_needed)); } // 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 b5f1654..1a3054ef 100644 --- a/content/browser/download/download_file_manager.h +++ b/content/browser/download/download_file_manager.h @@ -66,10 +66,6 @@ class DownloadFile; class DownloadManager; } -namespace net { -class BoundNetLog; -} - // Manages all in progress downloads. class CONTENT_EXPORT DownloadFileManager : public base::RefCountedThreadSafe<DownloadFileManager> { @@ -82,8 +78,7 @@ class CONTENT_EXPORT DownloadFileManager DownloadCreateInfo* info, const DownloadRequestHandle& request_handle, content::DownloadManager* download_manager, - bool calculate_hash, - const net::BoundNetLog& bound_net_log) = 0; + bool calculate_hash) = 0; }; // Takes ownership of the factory. @@ -165,8 +160,7 @@ class CONTENT_EXPORT DownloadFileManager void CreateDownloadFile(DownloadCreateInfo* info, const DownloadRequestHandle& request_handle, content::DownloadManager* download_manager, - bool hash_needed, - const net::BoundNetLog& bound_net_log); + bool hash_needed); // 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 f14c038..bdbad04 100644 --- a/content/browser/download/download_file_manager_unittest.cc +++ b/content/browser/download/download_file_manager_unittest.cc @@ -44,8 +44,7 @@ class MockDownloadFileFactory : DownloadCreateInfo* info, const DownloadRequestHandle& request_handle, content::DownloadManager* download_manager, - bool calculate_hash, - const net::BoundNetLog& bound_net_log) OVERRIDE; + bool calculate_hash) OVERRIDE; MockDownloadFile* GetExistingFile(const DownloadId& id); @@ -57,8 +56,7 @@ content::DownloadFile* MockDownloadFileFactory::CreateFile( DownloadCreateInfo* info, const DownloadRequestHandle& request_handle, content::DownloadManager* download_manager, - bool calculate_hash, - const net::BoundNetLog& bound_net_log) { + bool calculate_hash) { DCHECK(files_.end() == files_.find(info->download_id)); MockDownloadFile* created_file = new MockDownloadFile(); files_[info->download_id] = created_file; @@ -169,8 +167,7 @@ class DownloadFileManagerTest : public testing::Test { // Set expectations and return values. EXPECT_CALL(*download_manager_, CreateDownloadItem(info, _)) - .Times(1) - .WillOnce(Return(net::BoundNetLog())); + .Times(1); 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 aa6e8e7..2418857 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -69,8 +69,7 @@ class DownloadFileTest : public testing::Test { info.save_info.file_stream = file_stream_; file->reset( new DownloadFileImpl(&info, new DownloadRequestHandle(), - download_manager_, calculate_hash, - net::BoundNetLog())); + download_manager_, calculate_hash)); } 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 03b1a0e..cdcd10e 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc @@ -242,19 +242,6 @@ 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 7a54c3c..617494f 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -127,22 +127,19 @@ namespace content { // static DownloadManager* DownloadManager::Create( - content::DownloadManagerDelegate* delegate, - net::NetLog* net_log) { - return new DownloadManagerImpl(delegate, net_log); + content::DownloadManagerDelegate* delegate) { + return new DownloadManagerImpl(delegate); } } // namespace content DownloadManagerImpl::DownloadManagerImpl( - content::DownloadManagerDelegate* delegate, - net::NetLog* net_log) + content::DownloadManagerDelegate* delegate) : shutdown_needed_(false), browser_context_(NULL), file_manager_(NULL), delegate_(delegate), - largest_db_handle_in_history_(DownloadItem::kUninitializedHandle), - net_log_(net_log) { + largest_db_handle_in_history_(DownloadItem::kUninitializedHandle) { } DownloadManagerImpl::~DownloadManagerImpl() { @@ -392,23 +389,19 @@ FilePath DownloadManagerImpl::LastDownloadPath() { return last_download_path_; } -net::BoundNetLog DownloadManagerImpl::CreateDownloadItem( +void 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(), bound_net_log); + browser_context_->IsOffTheRecord(), net::BoundNetLog()); 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( @@ -416,10 +409,8 @@ 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(), bound_net_log); + this, main_file_path, page_url, is_otr, GetNextId(), net::BoundNetLog()); download->AddObserver(observer); @@ -923,10 +914,8 @@ 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), bound_net_log); + this, GetNextId(), entries->at(i), net::BoundNetLog()); 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 0e6cd009..ce28cc8 100644 --- a/content/browser/download/download_manager_impl.h +++ b/content/browser/download/download_manager_impl.h @@ -25,8 +25,7 @@ class CONTENT_EXPORT DownloadManagerImpl : public content::DownloadManager, public DownloadItemImpl::Delegate { public: - DownloadManagerImpl(content::DownloadManagerDelegate* delegate, - net::NetLog* net_log); + DownloadManagerImpl(content::DownloadManagerDelegate* delegate); // content::DownloadManager functions. virtual void Shutdown() OVERRIDE; @@ -72,7 +71,7 @@ class CONTENT_EXPORT DownloadManagerImpl virtual int InProgressCount() const OVERRIDE; virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; virtual FilePath LastDownloadPath() OVERRIDE; - virtual net::BoundNetLog CreateDownloadItem( + virtual void CreateDownloadItem( DownloadCreateInfo* info, const DownloadRequestHandle& request_handle) OVERRIDE; virtual content::DownloadItem* CreateSavePackageDownloadItem( @@ -251,8 +250,6 @@ 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 3d894f8..a86e9e1 100644 --- a/content/browser/download/download_manager_impl_unittest.cc +++ b/content/browser/download/download_manager_impl_unittest.cc @@ -74,20 +74,17 @@ class MockDownloadFileFactory public: MockDownloadFileFactory() {} - virtual DownloadFile* CreateFile( - DownloadCreateInfo* info, - const DownloadRequestHandle& request_handle, - DownloadManager* download_manager, - bool calculate_hash, - const net::BoundNetLog& bound_net_log) OVERRIDE; + virtual DownloadFile* CreateFile(DownloadCreateInfo* info, + const DownloadRequestHandle& request_handle, + DownloadManager* download_manager, + bool calculate_hash) OVERRIDE; }; DownloadFile* MockDownloadFileFactory::CreateFile( DownloadCreateInfo* info, const DownloadRequestHandle& request_handle, DownloadManager* download_manager, - bool calculate_hash, - const net::BoundNetLog& bound_net_log) { + bool calculate_hash) { NOTREACHED(); return NULL; } @@ -214,7 +211,7 @@ class DownloadManagerTest : public testing::Test { : browser_context(new TestBrowserContext()), download_manager_delegate_(new TestDownloadManagerDelegate()), download_manager_(DownloadManager::Create( - download_manager_delegate_.get(), NULL)), + download_manager_delegate_.get())), ui_thread_(BrowserThread::UI, &message_loop_), file_thread_(BrowserThread::FILE, &message_loop_), download_buffer_(new content::DownloadBuffer) { @@ -348,8 +345,7 @@ DownloadFileWithErrors::DownloadFileWithErrors(DownloadCreateInfo* info, : DownloadFileImpl(info, new DownloadRequestHandle(), manager, - calculate_hash, - net::BoundNetLog()), + calculate_hash), forced_error_(net::OK) { } @@ -539,7 +535,7 @@ TEST_F(DownloadManagerTest, MAYBE_StartDownload) { DownloadFile* download_file( new DownloadFileImpl(info.get(), new DownloadRequestHandle(), - download_manager_, false, net::BoundNetLog())); + download_manager_, false)); AddDownloadToFileManager(info->download_id.local(), download_file); download_file->Initialize(); download_manager_->StartDownload(info->download_id.local()); @@ -1190,7 +1186,7 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadOverwriteTest) { // properly. DownloadFile* download_file( new DownloadFileImpl(info.get(), new DownloadRequestHandle(), - download_manager_, false, net::BoundNetLog())); + download_manager_, false)); download_file->Rename(cr_path); // This creates the .temp version of the file. download_file->Initialize(); @@ -1264,7 +1260,7 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadRemoveTest) { // properly. DownloadFile* download_file( new DownloadFileImpl(info.get(), new DownloadRequestHandle(), - download_manager_, false, net::BoundNetLog())); + download_manager_, false)); 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 400478c..cb9f289 100644 --- a/content/browser/download/download_resource_handler.cc +++ b/content/browser/download/download_resource_handler.cc @@ -98,8 +98,7 @@ bool DownloadResourceHandler::OnResponseStarted( // Deleted in DownloadManager. scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo(FilePath(), GURL(), base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, - request_->net_log(), request_info->has_user_gesture(), - request_info->transition_type())); + 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 aefaed296..5f3f194 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, net::NetLog* net_log) { +FileStream* CreateFileStreamForDrop(FilePath* file_path) { DCHECK(file_path && !file_path->empty()); - scoped_ptr<FileStream> file_stream(new FileStream(net_log)); + scoped_ptr<FileStream> file_stream(new FileStream(NULL)); 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 7cb7ada..95a5521 100644 --- a/content/browser/download/drag_download_util.h +++ b/content/browser/download/drag_download_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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,9 +38,7 @@ 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. -// |net_log| is a NetLog for the stream. -CONTENT_EXPORT net::FileStream* CreateFileStreamForDrop( - FilePath* file_path, net::NetLog* net_log); +CONTENT_EXPORT net::FileStream* CreateFileStreamForDrop(FilePath* file_path); // 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 6be0dc6..da09af2 100644 --- a/content/browser/tab_contents/web_drag_source_gtk.cc +++ b/content/browser/tab_contents/web_drag_source_gtk.cc @@ -18,7 +18,6 @@ #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" @@ -244,9 +243,7 @@ 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, - content::GetContentClient()->browser()->GetNetLog()); + drag_download_util::CreateFileStreamForDrop(&file_path); 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 624225c..1ffd221 100644 --- a/content/browser/tab_contents/web_drag_source_mac.mm +++ b/content/browser/tab_contents/web_drag_source_mac.mm @@ -20,7 +20,6 @@ #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" @@ -324,8 +323,7 @@ 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, content::GetContentClient()->browser()->GetNetLog()); + drag_download_util::CreateFileStreamForDrop(&filePath); if (!fileStream) return nil; diff --git a/content/public/browser/download_manager.h b/content/public/browser/download_manager.h index 12d6fb0..52a5437 100644 --- a/content/public/browser/download_manager.h +++ b/content/public/browser/download_manager.h @@ -40,7 +40,6 @@ #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; @@ -65,8 +64,7 @@ class CONTENT_EXPORT DownloadManager virtual ~DownloadManager() {} static DownloadManager* Create( - DownloadManagerDelegate* delegate, - net::NetLog* net_log); + DownloadManagerDelegate* delegate); // Shutdown the download manager. Must be called before destruction. virtual void Shutdown() = 0; @@ -208,8 +206,7 @@ class CONTENT_EXPORT DownloadManager virtual FilePath LastDownloadPath() = 0; // Creates the download item. Must be called on the UI thread. - // Returns the |BoundNetLog| used by the |DownloadItem|. - virtual net::BoundNetLog CreateDownloadItem( + virtual void 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 6078b38..079687e 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -138,8 +138,7 @@ SSLHostState* ShellBrowserContext::GetSSLHostState() { DownloadManager* ShellBrowserContext::GetDownloadManager() { if (!download_manager_.get()) { download_manager_delegate_ = new ShellDownloadManagerDelegate(); - download_manager_ = new DownloadManagerImpl(download_manager_delegate_, - NULL); + download_manager_ = new DownloadManagerImpl(download_manager_delegate_); 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 d5ca6d0..be946b5 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, net::BoundNetLog( + MOCK_METHOD2(CreateDownloadItem, void( DownloadCreateInfo* info, const DownloadRequestHandle& request_handle)); MOCK_METHOD4(CreateSavePackageDownloadItem, content::DownloadItem*( |