From 37757c6de5d1eb7e2240e4701793a632a6ff9f5d Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Tue, 20 Dec 2011 20:07:12 +0000 Subject: Rename DownloadItem::BrowserContext to GetBrowserContext, to match other getters in interfaces. This also comes up because without the Get, we have a redundant "content::" in the interface. Review URL: http://codereview.chromium.org/9006013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115169 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/automation/testing_automation_provider.cc | 2 +- chrome/browser/download/download_browsertest.cc | 2 +- chrome/browser/download/download_item_unittest.cc | 2 +- chrome/browser/download/download_shelf_context_menu.cc | 2 +- chrome/browser/ui/webui/downloads_dom_handler.cc | 8 ++++---- content/browser/download/download_item_impl.cc | 6 +++--- content/browser/download/download_item_impl.h | 15 ++------------- content/browser/download/download_manager_impl.cc | 2 +- content/browser/download/download_manager_impl.h | 4 ++-- content/browser/download/mock_download_item.h | 2 +- content/browser/download/mock_download_manager.cc | 2 +- content/browser/download/mock_download_manager.h | 2 +- content/public/browser/download_item.h | 2 +- content/public/browser/download_manager.h | 2 +- content/shell/shell_download_manager_delegate.cc | 2 +- 15 files changed, 22 insertions(+), 33 deletions(-) diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 8d7ef7a..17b004e 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -3180,7 +3180,7 @@ void TestingAutomationProvider::PerformActionOnDownload( selected_item->OpenDownload(); } else if (action == "toggle_open_files_like_this") { DownloadPrefs* prefs = - DownloadPrefs::FromBrowserContext(selected_item->BrowserContext()); + DownloadPrefs::FromBrowserContext(selected_item->GetBrowserContext()); FilePath path = selected_item->GetUserVerifiedFilePath(); if (!selected_item->ShouldOpenFileBasedOnExtension()) prefs->EnableAutoOpenBasedOnExtension(path); diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 911ad92..edd6ac6 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -169,7 +169,7 @@ class DownloadsHistoryDataCollector { : result_valid_(false), download_db_handle_(download_db_handle) { HistoryService* hs = - Profile::FromBrowserContext(manager->BrowserContext())-> + Profile::FromBrowserContext(manager->GetBrowserContext())-> GetHistoryService(Profile::EXPLICIT_ACCESS); DCHECK(hs); hs->QueryDownloads( diff --git a/chrome/browser/download/download_item_unittest.cc b/chrome/browser/download/download_item_unittest.cc index 896faba..c4d7a31 100644 --- a/chrome/browser/download/download_item_unittest.cc +++ b/chrome/browser/download/download_item_unittest.cc @@ -31,7 +31,7 @@ class MockDelegate : public DownloadItemImpl::Delegate { MOCK_METHOD1(ShouldOpenDownload, bool(DownloadItem* download)); MOCK_METHOD1(CheckForFileRemoval, void(DownloadItem* download)); MOCK_METHOD1(MaybeCompleteDownload, void(DownloadItem* download)); - MOCK_CONST_METHOD0(BrowserContext, content::BrowserContext*()); + MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*()); MOCK_METHOD1(DownloadCancelled, void(DownloadItem* download)); MOCK_METHOD1(DownloadCompleted, void(DownloadItem* download)); MOCK_METHOD1(DownloadOpened, void(DownloadItem* download)); diff --git a/chrome/browser/download/download_shelf_context_menu.cc b/chrome/browser/download/download_shelf_context_menu.cc index 57d5150..9dd2167 100644 --- a/chrome/browser/download/download_shelf_context_menu.cc +++ b/chrome/browser/download/download_shelf_context_menu.cc @@ -84,7 +84,7 @@ void DownloadShelfContextMenu::ExecuteCommand(int command_id) { break; case ALWAYS_OPEN_TYPE: { DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext( - download_item_->BrowserContext()); + download_item_->GetBrowserContext()); FilePath path = download_item_->GetUserVerifiedFilePath(); if (!IsCommandIdChecked(ALWAYS_OPEN_TYPE)) prefs->EnableAutoOpenBasedOnExtension(path); diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc index 3916e65..d12984a 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler.cc @@ -127,7 +127,7 @@ DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm) download_manager_(dlm), callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { // Create our fileicon data source. - Profile::FromBrowserContext(dlm->BrowserContext())-> + Profile::FromBrowserContext(dlm->GetBrowserContext())-> GetChromeURLDataManager()->AddDataSource( #if defined(OS_CHROMEOS) new FileIconSourceCros()); @@ -147,7 +147,7 @@ void DownloadsDOMHandler::Init() { download_manager_->AddObserver(this); Profile* profile = - Profile::FromBrowserContext(download_manager_->BrowserContext()); + Profile::FromBrowserContext(download_manager_->GetBrowserContext()); Profile* original_profile = profile->GetOriginalProfile(); if (original_profile != profile) { original_download_manager_observer_.reset( @@ -228,7 +228,7 @@ void DownloadsDOMHandler::ModelChanged() { &download_items_); // If we have a parent profile, let it add its downloads to the results. Profile* profile = - Profile::FromBrowserContext(download_manager_->BrowserContext()); + Profile::FromBrowserContext(download_manager_->GetBrowserContext()); if (profile->GetOriginalProfile() != profile) { DownloadServiceFactory::GetForProfile( profile->GetOriginalProfile())->GetDownloadManager()->SearchDownloads( @@ -349,7 +349,7 @@ void DownloadsDOMHandler::HandleClearAll(const ListValue* args) { download_manager_->RemoveAllDownloads(); Profile* profile = - Profile::FromBrowserContext(download_manager_->BrowserContext()); + Profile::FromBrowserContext(download_manager_->GetBrowserContext()); // If this is an incognito downloader, clear All should clear main download // manager as well. if (profile->GetOriginalProfile() != profile) diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc index e5a08e8..437209f 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc @@ -685,7 +685,7 @@ bool DownloadItemImpl::MatchesQuery(const string16& query) const { // "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD" std::string languages; languages = content::GetContentClient()->browser()->GetAcceptLangs( - BrowserContext()); + GetBrowserContext()); string16 url_formatted(net::FormatUrl(GetURL(), languages)); if (base::i18n::StringSearchIgnoringCaseAndAccents(query, url_formatted)) return true; @@ -757,8 +757,8 @@ TabContents* DownloadItemImpl::GetTabContents() const { return NULL; } -content::BrowserContext* DownloadItemImpl::BrowserContext() const { - return delegate_->BrowserContext(); +content::BrowserContext* DownloadItemImpl::GetBrowserContext() const { + return delegate_->GetBrowserContext(); } FilePath DownloadItemImpl::GetTargetFilePath() const { diff --git a/content/browser/download/download_item_impl.h b/content/browser/download/download_item_impl.h index 2f81bf7..a84faa1 100644 --- a/content/browser/download/download_item_impl.h +++ b/content/browser/download/download_item_impl.h @@ -16,22 +16,11 @@ #include "base/timer.h" #include "content/browser/download/download_id.h" #include "content/browser/download/download_request_handle.h" -#include "content/browser/download/download_state_info.h" -#include "content/browser/download/interrupt_reasons.h" #include "content/common/content_export.h" #include "content/public/browser/download_item.h" #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" -class DownloadFileManager; -class TabContents; - -struct DownloadCreateInfo; -struct DownloadPersistentStoreInfo; - -namespace content { -class BrowserContext; -} // See download_item.h for usage. class CONTENT_EXPORT DownloadItemImpl : public content::DownloadItem { @@ -70,7 +59,7 @@ class CONTENT_EXPORT DownloadItemImpl : public content::DownloadItem { virtual void MaybeCompleteDownload(DownloadItem* download) = 0; // For contextual issues like language and prefs. - virtual content::BrowserContext* BrowserContext() const = 0; + virtual content::BrowserContext* GetBrowserContext() const = 0; // Handle any delegate portions of a state change operation on the // DownloadItem. @@ -193,7 +182,7 @@ class CONTENT_EXPORT DownloadItemImpl : public content::DownloadItem { virtual InterruptReason GetLastReason() const OVERRIDE; virtual DownloadPersistentStoreInfo GetPersistentStoreInfo() const OVERRIDE; virtual DownloadStateInfo GetStateInfo() const OVERRIDE; - virtual content::BrowserContext* BrowserContext() const OVERRIDE; + virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; virtual TabContents* GetTabContents() const OVERRIDE; virtual FilePath GetTargetFilePath() const OVERRIDE; virtual FilePath GetFileNameToReportUser() const OVERRIDE; diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index ab0253f..773eb59 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -333,7 +333,7 @@ void DownloadManagerImpl::RestartDownload( } } -content::BrowserContext* DownloadManagerImpl::BrowserContext() const { +content::BrowserContext* DownloadManagerImpl::GetBrowserContext() const { return browser_context_; } diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h index a419e8d..9f8a7b5 100644 --- a/content/browser/download/download_manager_impl.h +++ b/content/browser/download/download_manager_impl.h @@ -74,7 +74,7 @@ class CONTENT_EXPORT DownloadManagerImpl virtual void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle) OVERRIDE; virtual int InProgressCount() const OVERRIDE; - virtual content::BrowserContext* BrowserContext() const OVERRIDE; + virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; virtual FilePath LastDownloadPath() OVERRIDE; virtual void CreateDownloadItem( DownloadCreateInfo* info, @@ -98,7 +98,7 @@ class CONTENT_EXPORT DownloadManagerImpl content::DownloadManagerDelegate* delegate) OVERRIDE; // Overridden from DownloadItemImpl::Delegate - // (Note that |BrowserContext| are present in both interfaces.) + // (Note that |GetBrowserContext| are present in both interfaces.) virtual bool ShouldOpenDownload(content::DownloadItem* item) OVERRIDE; virtual bool ShouldOpenFileBasedOnExtension( const FilePath& path) OVERRIDE; diff --git a/content/browser/download/mock_download_item.h b/content/browser/download/mock_download_item.h index 905ce8e..a46b7eb 100644 --- a/content/browser/download/mock_download_item.h +++ b/content/browser/download/mock_download_item.h @@ -98,7 +98,7 @@ class MockDownloadItem : public content::DownloadItem { MOCK_CONST_METHOD0(GetLastReason, InterruptReason()); MOCK_CONST_METHOD0(GetPersistentStoreInfo, DownloadPersistentStoreInfo()); MOCK_CONST_METHOD0(GetStateInfo, DownloadStateInfo()); - MOCK_CONST_METHOD0(BrowserContext, content::BrowserContext*()); + MOCK_CONST_METHOD0(GetBrowserContext, content::BrowserContext*()); MOCK_CONST_METHOD0(GetTabContents, TabContents*()); MOCK_CONST_METHOD0(GetTargetFilePath, FilePath()); MOCK_CONST_METHOD0(GetFileNameToReportUser, FilePath()); diff --git a/content/browser/download/mock_download_manager.cc b/content/browser/download/mock_download_manager.cc index 21892ee..58113b7 100644 --- a/content/browser/download/mock_download_manager.cc +++ b/content/browser/download/mock_download_manager.cc @@ -118,7 +118,7 @@ int MockDownloadManager::InProgressCount() const { return 1; } -content::BrowserContext* MockDownloadManager::BrowserContext() const { +content::BrowserContext* MockDownloadManager::GetBrowserContext() const { return NULL; } diff --git a/content/browser/download/mock_download_manager.h b/content/browser/download/mock_download_manager.h index a6415df..ed4f6af 100644 --- a/content/browser/download/mock_download_manager.h +++ b/content/browser/download/mock_download_manager.h @@ -60,7 +60,7 @@ class MockDownloadManager : public content::DownloadManager { virtual void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle) OVERRIDE; virtual int InProgressCount() const OVERRIDE; - virtual content::BrowserContext* BrowserContext() const OVERRIDE; + virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; virtual FilePath LastDownloadPath() OVERRIDE; virtual void CreateDownloadItem( DownloadCreateInfo* info, diff --git a/content/public/browser/download_item.h b/content/public/browser/download_item.h index ed597c3..ea6d87b 100644 --- a/content/public/browser/download_item.h +++ b/content/public/browser/download_item.h @@ -291,7 +291,7 @@ class CONTENT_EXPORT DownloadItem { virtual InterruptReason GetLastReason() const = 0; virtual DownloadPersistentStoreInfo GetPersistentStoreInfo() const = 0; virtual DownloadStateInfo GetStateInfo() const = 0; - virtual content::BrowserContext* BrowserContext() const = 0; + virtual BrowserContext* GetBrowserContext() const = 0; virtual TabContents* GetTabContents() const = 0; // Returns the final target file path for the download. diff --git a/content/public/browser/download_manager.h b/content/public/browser/download_manager.h index e8c69f4..a5e31fc 100644 --- a/content/public/browser/download_manager.h +++ b/content/public/browser/download_manager.h @@ -182,7 +182,7 @@ class CONTENT_EXPORT DownloadManager // The number of in progress (including paused) downloads. virtual int InProgressCount() const = 0; - virtual content::BrowserContext* BrowserContext() const = 0; + virtual content::BrowserContext* GetBrowserContext() const = 0; virtual FilePath LastDownloadPath() = 0; diff --git a/content/shell/shell_download_manager_delegate.cc b/content/shell/shell_download_manager_delegate.cc index cb762c3..6388c74 100644 --- a/content/shell/shell_download_manager_delegate.cc +++ b/content/shell/shell_download_manager_delegate.cc @@ -72,7 +72,7 @@ void ShellDownloadManagerDelegate::GenerateFilename( DownloadStateInfo state, const FilePath& generated_name) { if (state.suggested_path.empty()) { - state.suggested_path = download_manager_->BrowserContext()->GetPath(). + state.suggested_path = download_manager_->GetBrowserContext()->GetPath(). Append(FILE_PATH_LITERAL("Downloads")); if (!file_util::PathExists(state.suggested_path)) file_util::CreateDirectory(state.suggested_path); -- cgit v1.1