diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 07:58:34 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 07:58:34 +0000 |
commit | 57c6a6579cf274fe37d6196931a3034d90da7113 (patch) | |
tree | ec42313580156ccc039b5fee714ee12259cb08ee /chrome/browser/download | |
parent | b23c9e1f05d474adc327c85d87eacc77554976e0 (diff) | |
download | chromium_src-57c6a6579cf274fe37d6196931a3034d90da7113.zip chromium_src-57c6a6579cf274fe37d6196931a3034d90da7113.tar.gz chromium_src-57c6a6579cf274fe37d6196931a3034d90da7113.tar.bz2 |
Replace all occurrances of WebContents with TabContents.
Review URL: http://codereview.chromium.org/99177
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r-- | chrome/browser/download/download_file.cc | 6 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.cc | 16 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.h | 4 | ||||
-rw-r--r-- | chrome/browser/download/download_request_manager.cc | 6 | ||||
-rw-r--r-- | chrome/browser/download/save_file_manager.cc | 3 | ||||
-rw-r--r-- | chrome/browser/download/save_file_manager.h | 2 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 50 | ||||
-rw-r--r-- | chrome/browser/download/save_package.h | 10 |
8 files changed, 48 insertions, 49 deletions
diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc index 89b468c..a44e5fe 100644 --- a/chrome/browser/download/download_file.cc +++ b/chrome/browser/download/download_file.cc @@ -14,7 +14,7 @@ #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/platform_util.h" #include "chrome/common/stl_util-inl.h" @@ -363,7 +363,7 @@ void DownloadFileManager::UpdateInProgressDownloads() { // Notifications sent from the download thread and run on the UI thread. -// Lookup the DownloadManager for this WebContents' profile and inform it of +// Lookup the DownloadManager for this TabContents' profile and inform it of // a new download. // TODO(paulg): When implementing download restart via the Downloads tab, // there will be no 'render_process_id' or 'render_view_id'. @@ -471,7 +471,7 @@ void DownloadFileManager::RemoveDownload(int id, DownloadManager* manager) { // static DownloadManager* DownloadFileManager::DownloadManagerFromRenderIds( int render_process_id, int render_view_id) { - WebContents* contents = tab_util::GetWebContentsByID(render_process_id, + TabContents* contents = tab_util::GetTabContentsByID(render_process_id, render_view_id); if (contents) { Profile* profile = contents->profile(); diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 14c1348..5e87d0e 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -25,7 +25,7 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -638,7 +638,7 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) { if (!select_file_dialog_.get()) select_file_dialog_ = SelectFileDialog::Create(this); - WebContents* contents = tab_util::GetWebContentsByID( + TabContents* contents = tab_util::GetTabContentsByID( info->render_process_id, info->render_view_id); SelectFileDialog::FileTypeInfo file_type_info; file_type_info.extensions.resize(1); @@ -1088,13 +1088,13 @@ int DownloadManager::RemoveAllDownloads() { void DownloadManager::DownloadUrl(const GURL& url, const GURL& referrer, const std::string& referrer_charset, - WebContents* web_contents) { - DCHECK(web_contents); + TabContents* tab_contents) { + DCHECK(tab_contents); request_context_->set_referrer_charset(referrer_charset); file_manager_->DownloadUrl(url, referrer, - web_contents->process()->pid(), - web_contents->render_view_host()->routing_id(), + tab_contents->process()->pid(), + tab_contents->render_view_host()->routing_id(), request_context_.get()); } @@ -1463,10 +1463,10 @@ void DownloadManager::OnCreateDownloadEntryComplete(DownloadCreateInfo info, downloads_[download->db_handle()] = download; // The 'contents' may no longer exist if the user closed the tab before we get - // this start completion event. If it does, tell the origin WebContents to + // this start completion event. If it does, tell the origin TabContents to // display its download shelf. TabContents* contents = - tab_util::GetWebContentsByID(info.render_process_id, info.render_view_id); + tab_util::GetTabContentsByID(info.render_process_id, info.render_view_id); // If the contents no longer exists, we start the download in the last active // browser. This is not ideal but better than fully hiding the download from diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 50f4fa3..0fb1675 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -63,7 +63,7 @@ class PrefService; class Profile; class ResourceDispatcherHost; class URLRequestContext; -class WebContents; +class TabContents; namespace base { class Thread; @@ -357,7 +357,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, void DownloadUrl(const GURL& url, const GURL& referrer, const std::string& referrer_encoding, - WebContents* web_contents); + TabContents* tab_contents); // Allow objects to observe the download creation process. void AddObserver(Observer* observer); diff --git a/chrome/browser/download/download_request_manager.cc b/chrome/browser/download/download_request_manager.cc index 6078fce..4cd4319 100644 --- a/chrome/browser/download/download_request_manager.cc +++ b/chrome/browser/download/download_request_manager.cc @@ -11,7 +11,7 @@ #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" // TabDownloadState ------------------------------------------------------------ @@ -228,8 +228,8 @@ void DownloadRequestManager::CanDownload(int render_process_host_id, Callback* callback) { DCHECK(!ui_loop_ || MessageLoop::current() == ui_loop_); - WebContents* originating_tab = - tab_util::GetWebContentsByID(render_process_host_id, render_view_id); + TabContents* originating_tab = + tab_util::GetTabContentsByID(render_process_host_id, render_view_id); if (!originating_tab) { // The tab was closed, don't allow the download. ScheduleNotification(callback, false); diff --git a/chrome/browser/download/save_file_manager.cc b/chrome/browser/download/save_file_manager.cc index 4d1b2ad..133cdbe 100644 --- a/chrome/browser/download/save_file_manager.cc +++ b/chrome/browser/download/save_file_manager.cc @@ -16,7 +16,6 @@ #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/platform_util.h" #include "chrome/common/stl_util-inl.h" @@ -213,7 +212,7 @@ void SaveFileManager::RemoveSaveFile(int save_id, const GURL& save_url, // only on the UI thread. SavePackage* SaveFileManager::GetSavePackageFromRenderIds( int render_process_id, int render_view_id) { - WebContents* contents = tab_util::GetWebContentsByID(render_process_id, + TabContents* contents = tab_util::GetTabContentsByID(render_process_id, render_view_id); if (contents) return contents->save_package(); diff --git a/chrome/browser/download/save_file_manager.h b/chrome/browser/download/save_file_manager.h index 89672fc..ac6c1c8 100644 --- a/chrome/browser/download/save_file_manager.h +++ b/chrome/browser/download/save_file_manager.h @@ -181,7 +181,7 @@ class SaveFileManager // Notifications sent from the file thread and run on the UI thread. - // Lookup the SaveManager for this WebContents' saving profile and inform it + // Lookup the SaveManager for this TabContents' saving profile and inform it // the saving job has been started. void OnStartSave(const SaveFileCreateInfo* info); // Update the SavePackage with the current state of a started saving job. diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 19d7df6..57ed679 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -22,8 +22,8 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/render_view_host_delegate.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_util.h" -#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/l10n_util.h" #include "chrome/common/platform_util.h" @@ -112,12 +112,12 @@ FilePath::StringType StripOrdinalNumber( } // namespace -SavePackage::SavePackage(WebContents* web_content, +SavePackage::SavePackage(TabContents* web_content, SavePackageType save_type, const FilePath& file_full_path, const FilePath& directory_full_path) : file_manager_(NULL), - web_contents_(web_content), + tab_contents_(web_content), download_(NULL), saved_main_file_path_(file_full_path), saved_main_directory_path_(directory_full_path), @@ -129,7 +129,7 @@ SavePackage::SavePackage(WebContents* web_content, wait_state_(INITIALIZE), tab_id_(web_content->process()->pid()) { DCHECK(web_content); - const GURL& current_page_url = web_contents_->GetURL(); + const GURL& current_page_url = tab_contents_->GetURL(); DCHECK(current_page_url.is_valid()); page_url_ = current_page_url; DCHECK(save_type_ == SAVE_AS_ONLY_HTML || @@ -140,17 +140,17 @@ SavePackage::SavePackage(WebContents* web_content, saved_main_directory_path_.value().length() < kMaxFilePathLength); } -SavePackage::SavePackage(WebContents* web_contents) +SavePackage::SavePackage(TabContents* tab_contents) : file_manager_(NULL), - web_contents_(web_contents), + tab_contents_(tab_contents), download_(NULL), finished_(false), user_canceled_(false), disk_error_occurred_(false), all_save_items_count_(0), wait_state_(INITIALIZE), - tab_id_(web_contents->process()->pid()) { - const GURL& current_page_url = web_contents_->GetURL(); + tab_id_(tab_contents->process()->pid()) { + const GURL& current_page_url = tab_contents_->GetURL(); DCHECK(current_page_url.is_valid()); page_url_ = current_page_url; } @@ -232,7 +232,7 @@ bool SavePackage::Init() { wait_state_ = START_PROCESS; // Initialize the request context and resource dispatcher. - Profile* profile = web_contents_->profile(); + Profile* profile = tab_contents_->profile(); if (!profile) { NOTREACHED(); return false; @@ -255,11 +255,11 @@ bool SavePackage::Init() { // Create the fake DownloadItem and display the view. download_ = new DownloadItem(1, saved_main_file_path_, 0, page_url_, FilePath(), Time::Now(), 0, -1, -1, false); - download_->set_manager(web_contents_->profile()->GetDownloadManager()); + download_->set_manager(tab_contents_->profile()->GetDownloadManager()); #if !defined(OS_MACOSX) - DownloadShelf* shelf = web_contents_->GetDownloadShelf(); + DownloadShelf* shelf = tab_contents_->GetDownloadShelf(); shelf->AddDownload(new SavePageModel(this, download_)); - web_contents_->SetDownloadShelfVisible(true); + tab_contents_->SetDownloadShelfVisible(true); #else // TODO(port): Create a download shelf for mac. NOTIMPLEMENTED(); @@ -577,8 +577,8 @@ void SavePackage::CheckFinish() { &SaveFileManager::RenameAllFiles, final_names, dir, - web_contents_->process()->pid(), - web_contents_->render_view_host()->routing_id())); + tab_contents_->process()->pid(), + tab_contents_->render_view_host()->routing_id())); } // Successfully finished all items of this SavePackage. @@ -699,7 +699,7 @@ void SavePackage::SaveCanceled(SaveItem* save_item) { // the save source. Parameter process_all_remaining_items indicates whether // we need to save all remaining items. void SavePackage::SaveNextFile(bool process_all_remaining_items) { - DCHECK(web_contents_); + DCHECK(tab_contents_); DCHECK(waiting_item_queue_.size()); do { @@ -715,8 +715,8 @@ void SavePackage::SaveNextFile(bool process_all_remaining_items) { save_item->Start(); file_manager_->SaveURL(save_item->url(), save_item->referrer(), - web_contents_->process()->pid(), - web_contents_->render_view_host()->routing_id(), + tab_contents_->process()->pid(), + tab_contents_->render_view_host()->routing_id(), save_item->save_source(), save_item->full_path(), request_context_.get(), @@ -827,7 +827,7 @@ void SavePackage::GetSerializedHtmlDataForCurrentPageWithLocalLinks() { // Get the relative directory name. FilePath relative_dir_name = saved_main_directory_path_.BaseName(); - web_contents_->render_view_host()-> + tab_contents_->render_view_host()-> GetSerializedHtmlDataForCurrentPageWithLocalLinks( saved_links, saved_file_paths, relative_dir_name); } @@ -902,7 +902,7 @@ void SavePackage::GetAllSavableResourceLinksForCurrentPage() { wait_state_ = RESOURCES_LIST; GURL main_page_url(page_url_); - web_contents_->render_view_host()-> + tab_contents_->render_view_host()-> GetAllSavableResourceLinksForCurrentPage(main_page_url); } @@ -1001,12 +1001,12 @@ void SavePackage::GetSaveInfo() { SelectFileDialog::FileTypeInfo file_type_info; FilePath::StringType default_extension; FilePath title = - FilePath::FromWStringHack(UTF16ToWideHack(web_contents_->GetTitle())); + FilePath::FromWStringHack(UTF16ToWideHack(tab_contents_->GetTitle())); FilePath suggested_path = - GetSuggestNameForSaveAs(web_contents_->profile()->GetPrefs(), title); + GetSuggestNameForSaveAs(tab_contents_->profile()->GetPrefs(), title); SavePackageParam* save_params = - new SavePackageParam(web_contents_->contents_mime_type()); + new SavePackageParam(tab_contents_->contents_mime_type()); // If the contents can not be saved as complete-HTML, do not show the // file filters. @@ -1039,7 +1039,7 @@ void SavePackage::GetSaveInfo() { file_type_index, default_extension, platform_util::GetTopLevel( - web_contents_->GetNativeView()), + tab_contents_->GetNativeView()), save_params); } else { // Just use 'suggested_path' instead of opening the dialog prompt. @@ -1054,7 +1054,7 @@ void SavePackage::ContinueSave(SavePackageParam* param, int index) { // Ensure the filename is safe. param->saved_main_file_path = final_name; - DownloadManager* dlm = web_contents_->profile()->GetDownloadManager(); + DownloadManager* dlm = tab_contents_->profile()->GetDownloadManager(); DCHECK(dlm); dlm->GenerateSafeFilename(param->current_tab_mime_type, ¶m->saved_main_file_path); @@ -1063,7 +1063,7 @@ void SavePackage::ContinueSave(SavePackageParam* param, DCHECK(index > 0 && index < 3); param->dir = param->saved_main_file_path.DirName(); - PrefService* prefs = web_contents_->profile()->GetPrefs(); + PrefService* prefs = tab_contents_->profile()->GetPrefs(); StringPrefMember save_file_path; save_file_path.Init(prefs::kSaveFileDefaultDirectory, prefs, NULL); // If user change the default saving directory, we will remember it just diff --git a/chrome/browser/download/save_package.h b/chrome/browser/download/save_package.h index 8feabd3..698fa60 100644 --- a/chrome/browser/download/save_package.h +++ b/chrome/browser/download/save_package.h @@ -29,9 +29,9 @@ class GURL; class MessageLoop; class PrefService; class Profile; -class WebContents; +class TabContents; class URLRequestContext; -class WebContents; +class TabContents; namespace base { class Thread; @@ -83,12 +83,12 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage>, // Constructor for user initiated page saving. This constructor results in a // SavePackage that will generate and sanitize a suggested name for the user // in the "Save As" dialog box. - SavePackage(WebContents* web_content); + SavePackage(TabContents* web_content); // This contructor is used only for testing. We can bypass the file and // directory name generation / sanitization by providing well known paths // better suited for tests. - SavePackage(WebContents* web_content, + SavePackage(TabContents* web_content, SavePackageType save_type, const FilePath& file_full_path, const FilePath& directory_full_path); @@ -259,7 +259,7 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage>, // Non-owning pointer for handling file writing on the file thread. SaveFileManager* file_manager_; - WebContents* web_contents_; + TabContents* tab_contents_; // We use a fake DownloadItem here in order to reuse the DownloadItemView. // This class owns the pointer. |