summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/hash_tables.h9
-rw-r--r--chrome/browser/browser.scons2
-rw-r--r--chrome/browser/browser_prefs.cc4
-rw-r--r--chrome/browser/browser_process_impl.cc2
-rw-r--r--chrome/browser/browsing_data_remover.cc12
-rw-r--r--chrome/browser/download/download_file.cc7
-rw-r--r--chrome/browser/download/download_file.h3
-rw-r--r--chrome/browser/download/download_manager.cc74
-rw-r--r--chrome/browser/download/download_manager.h10
-rw-r--r--chrome/browser/download/save_package.cc2
-rw-r--r--chrome/browser/history/download_types.h6
-rw-r--r--chrome/browser/profile.cc3
-rw-r--r--chrome/browser/renderer_host/download_resource_handler.cc6
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc6
-rw-r--r--chrome/browser/spellchecker.cc3
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu_controller.cc8
-rw-r--r--chrome/browser/tab_contents/web_contents.cc4
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj4
-rw-r--r--chrome/common/temp_scaffolding_stubs.h68
19 files changed, 103 insertions, 130 deletions
diff --git a/base/hash_tables.h b/base/hash_tables.h
index c2d3ddb..0ac2651 100644
--- a/base/hash_tables.h
+++ b/base/hash_tables.h
@@ -77,7 +77,14 @@ struct hash<const std::string> {
size_t operator()(const std::string& s) const {
return std::tr1::hash<std::string>()(s);
}
-};
+};
+
+template<>
+struct hash<long long> {
+ size_t operator()(long long i) const {
+ return std::tr1::hash<long>()((long) i);
+ }
+};
}
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons
index 09a977b..7d2a58c 100644
--- a/chrome/browser/browser.scons
+++ b/chrome/browser/browser.scons
@@ -682,9 +682,7 @@ if not env.Bit('windows'):
'dom_ui/html_dialog_contents.cc',
'dom_ui/new_tab_ui.cc',
'download/download_exe.cc',
- 'download/download_file.cc',
'download/download_item_model.cc',
- 'download/download_manager.cc',
'download/download_util.cc',
'download/download_request_manager.cc',
'download/save_page_model.cc',
diff --git a/chrome/browser/browser_prefs.cc b/chrome/browser/browser_prefs.cc
index 74aea18..3625995 100644
--- a/chrome/browser/browser_prefs.cc
+++ b/chrome/browser/browser_prefs.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/cache_manager_host.h"
+#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/password_manager/password_manager.h"
@@ -18,7 +19,6 @@
#include "chrome/browser/tab_contents/web_contents.h"
#if defined(OS_WIN) // TODO(port): whittle this down as we port
-#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/external_protocol_handler.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/spellchecker.h"
@@ -58,10 +58,10 @@ void RegisterAllPrefs(PrefService* user_prefs, PrefService* local_state) {
Browser::RegisterUserPrefs(user_prefs);
PasswordManager::RegisterUserPrefs(user_prefs);
chrome_browser_net::RegisterUserPrefs(user_prefs);
+ DownloadManager::RegisterUserPrefs(user_prefs);
#if defined(OS_WIN) // TODO(port): whittle this down as we port
BookmarkBarView::RegisterUserPrefs(user_prefs);
BookmarkTableView::RegisterUserPrefs(user_prefs);
- DownloadManager::RegisterUserPrefs(user_prefs);
SSLManager::RegisterUserPrefs(user_prefs);
#endif
AutofillManager::RegisterUserPrefs(user_prefs);
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 3f9749f..5a12b83 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/browser_trial.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/debugger/debugger_wrapper.h"
+#include "chrome/browser/download/download_file.h"
#include "chrome/browser/download/save_file_manager.h"
#include "chrome/browser/google_url_tracker.h"
#include "chrome/browser/metrics/metrics_service.h"
@@ -29,7 +30,6 @@
#if defined(OS_WIN)
#include "chrome/browser/automation/automation_provider_list.h"
-#include "chrome/browser/download/download_file.h"
#include "chrome/browser/icon_manager.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/common/clipboard_service.h"
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index 059c90f..507112f 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/metrics/user_metrics.h"
@@ -20,17 +21,6 @@
#include "net/url_request/url_request_context.h"
#include "webkit/glue/password_form.h"
-#if defined(OS_POSIX)
-// TODO(port): get rid of this include. It's used just to provide declarations
-// and stub definitions for classes we encouter during the porting effort.
-#include "chrome/common/temp_scaffolding_stubs.h"
-#endif
-
-// TODO(port): Get rid of this section and finish porting.
-#if defined(OS_WIN)
-#include "chrome/browser/download/download_manager.h"
-#endif
-
using base::Time;
// Done so that we can use invokeLater on BrowsingDataRemovers and not have
diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc
index 7d03acb..dbd632c 100644
--- a/chrome/browser/download/download_file.cc
+++ b/chrome/browser/download/download_file.cc
@@ -11,7 +11,6 @@
#include "base/task.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/tab_contents/tab_util.h"
@@ -90,6 +89,7 @@ void DownloadFile::Cancel() {
// The UI has provided us with our finalized name.
bool DownloadFile::Rename(const FilePath& new_path) {
+#if defined(OS_WIN)
Close();
// We cannot rename because rename will keep the same security descriptor
@@ -111,6 +111,11 @@ bool DownloadFile::Rename(const FilePath& new_path) {
if (!Open("a+b"))
return false;
return true;
+#elif defined(OS_POSIX)
+ // TODO(port): Port this function to posix (we need file_util::Rename()).
+ NOTIMPLEMENTED();
+ return false;
+#endif
}
void DownloadFile::Close() {
diff --git a/chrome/browser/download/download_file.h b/chrome/browser/download/download_file.h
index 9991c03..402be7c 100644
--- a/chrome/browser/download/download_file.h
+++ b/chrome/browser/download/download_file.h
@@ -51,6 +51,7 @@
#include "base/ref_counted.h"
#include "base/thread.h"
#include "base/timer.h"
+#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/history/download_types.h"
namespace net {
@@ -263,7 +264,7 @@ class DownloadFileManager
// RequestMap maps a DownloadManager to all in-progress download IDs.
// Called only on the UI thread.
typedef base::hash_set<int> DownloadRequests;
- typedef base::hash_map<DownloadManager*, DownloadRequests> RequestMap;
+ typedef std::map<DownloadManager*, DownloadRequests> RequestMap;
RequestMap requests_;
// Used for progress updates on the UI thread, mapping download->id() to bytes
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 965f2ed..86c61152 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -8,17 +8,14 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/path_service.h"
-#include "base/registry.h"
#include "base/string_util.h"
#include "base/task.h"
#include "base/thread.h"
#include "base/timer.h"
#include "base/rand_util.h"
-#include "base/win_util.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_file.h"
-#include "chrome/browser/download/download_util.h"
#include "chrome/browser/extensions/extension.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -33,12 +30,19 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/stl_util-inl.h"
-#include "chrome/common/win_util.h"
#include "googleurl/src/gurl.h"
#include "net/base/mime_util.h"
#include "net/base/net_util.h"
#include "net/url_request/url_request_context.h"
+#if defined(OS_WIN)
+// TODO(port): some of these need porting.
+#include "base/registry.h"
+#include "base/win_util.h"
+#include "chrome/browser/download/download_util.h"
+#include "chrome/common/win_util.h"
+#endif
+
#include "generated_resources.h"
// Periodically update our observers.
@@ -88,6 +92,7 @@ static int GetUniquePathNumber(const FilePath& path) {
return -1;
}
+#if defined(OS_WIN)
static bool DownloadPathIsDangerous(const FilePath& download_path) {
FilePath desktop_dir;
if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_dir)) {
@@ -96,6 +101,7 @@ static bool DownloadPathIsDangerous(const FilePath& download_path) {
}
return (download_path == desktop_dir);
}
+#endif
// DownloadItem implementation -------------------------------------------------
@@ -103,18 +109,18 @@ static bool DownloadPathIsDangerous(const FilePath& download_path) {
DownloadItem::DownloadItem(const DownloadCreateInfo& info)
: id_(-1),
full_path_(info.path),
- original_name_(info.original_name),
url_(info.url),
total_bytes_(info.total_bytes),
received_bytes_(info.received_bytes),
- start_tick_(0),
+ start_tick_(base::TimeTicks()),
state_(static_cast<DownloadState>(info.state)),
start_time_(info.start_time),
db_handle_(info.db_handle),
manager_(NULL),
- safety_state_(SAFE),
is_paused_(false),
open_when_complete_(false),
+ safety_state_(SAFE),
+ original_name_(info.original_name),
render_process_id_(-1),
request_id_(-1) {
if (state_ == IN_PROGRESS)
@@ -137,17 +143,17 @@ DownloadItem::DownloadItem(int32 download_id,
full_path_(path),
path_uniquifier_(path_uniquifier),
url_(url),
- original_name_(original_name),
total_bytes_(download_size),
received_bytes_(0),
- start_tick_(GetTickCount()),
+ start_tick_(base::TimeTicks::Now()),
state_(IN_PROGRESS),
start_time_(start_time),
db_handle_(kUninitializedHandle),
manager_(NULL),
- safety_state_(is_dangerous ? DANGEROUS : SAFE),
is_paused_(false),
open_when_complete_(false),
+ safety_state_(is_dangerous ? DANGEROUS : SAFE),
+ original_name_(original_name),
render_process_id_(render_process_id),
request_id_(request_id) {
Init(true /* start progress timer */);
@@ -248,8 +254,9 @@ bool DownloadItem::TimeRemaining(base::TimeDelta* remaining) const {
}
int64 DownloadItem::CurrentSpeed() const {
- uintptr_t diff = GetTickCount() - start_tick_;
- return diff == 0 ? 0 : received_bytes_ * 1000 / diff;
+ base::TimeDelta diff = base::TimeTicks::Now() - start_tick_;
+ int64 diff_ms = diff.InMilliseconds();
+ return diff_ms == 0 ? 0 : received_bytes_ * 1000 / diff_ms;
}
int DownloadItem::PercentComplete() const {
@@ -291,6 +298,8 @@ void DownloadManager::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterStringPref(prefs::kDownloadExtensionsToOpen, L"");
prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false);
+// TODO(port): port the necessary bits of chrome_paths.
+#if defined(OS_WIN)
// The default download path is userprofile\download.
FilePath default_download_path;
if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS,
@@ -313,6 +322,7 @@ void DownloadManager::RegisterUserPrefs(PrefService* prefs) {
}
prefs->SetBoolean(prefs::kDownloadDirUpgraded, true);
}
+#endif
}
DownloadManager::DownloadManager()
@@ -475,6 +485,8 @@ bool DownloadManager::Init(Profile* profile) {
DCHECK(prefs);
prompt_for_download_.Init(prefs::kPromptForDownload, prefs, NULL);
+// TODO(port): enable this after implementing chrome_paths for posix.
+#if defined(OS_WIN)
download_path_.Init(prefs::kDownloadDefaultDirectory, prefs, NULL);
// This variable is needed to resolve which CreateDirectory we want to point
@@ -489,14 +501,18 @@ bool DownloadManager::Init(Profile* profile) {
// We store any file extension that should be opened automatically at
// download completion in this pref.
download_util::InitializeExeTypes(&exe_types_);
+#elif defined(OS_POSIX)
+ NOTIMPLEMENTED();
+#endif
std::wstring extensions_to_open =
prefs->GetString(prefs::kDownloadExtensionsToOpen);
std::vector<std::wstring> extensions;
SplitString(extensions_to_open, L':', &extensions);
for (size_t i = 0; i < extensions.size(); ++i) {
- if (!extensions[i].empty() && !IsExecutable(extensions[i]))
- auto_open_.insert(extensions[i]);
+ if (!extensions[i].empty() && !IsExecutable(
+ FilePath::FromWStringHack(extensions[i]).value()))
+ auto_open_.insert(FilePath::FromWStringHack(extensions[i]).value());
}
return true;
@@ -609,6 +625,7 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) {
}
void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) {
+#if defined(OS_WIN)
DCHECK(MessageLoop::current() == ui_loop_);
DCHECK(info);
@@ -632,6 +649,10 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) {
// No prompting for download, just continue with the suggested name.
ContinueStartDownload(info, info->suggested_path);
}
+#elif defined(OS_POSIX)
+ // TODO(port): port this file -- need dialogs.
+ NOTIMPLEMENTED();
+#endif
}
void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info,
@@ -802,8 +823,7 @@ void DownloadManager::ContinueDownloadFinished(DownloadItem* download) {
download->UpdateObservers();
// Open the download if the user or user prefs indicate it should be.
- const std::wstring extension =
- file_util::GetFileExtensionFromPath(download->full_path());
+ const FilePath::StringType extension = download->full_path().Extension();
if (download->open_when_complete() || ShouldOpenFileExtension(extension))
OpenDownloadInShell(download, NULL);
}
@@ -940,7 +960,7 @@ void DownloadManager::OnPauseDownloadRequest(ResourceDispatcherHost* rdh,
bool DownloadManager::IsDangerous(const FilePath& file_name) {
// TODO(jcampan): Improve me.
- return IsExecutable(file_util::GetFileExtensionFromPath(file_name));
+ return IsExecutable(file_name.Extension());
}
void DownloadManager::RenameDownload(DownloadItem* download,
@@ -994,7 +1014,7 @@ int DownloadManager::RemoveDownloadsBetween(const base::Time remove_begin,
(state == DownloadItem::COMPLETE ||
state == DownloadItem::CANCELLED)) {
// Remove from the map and move to the next in the list.
- it = downloads_.erase(it);
+ downloads_.erase(it++);
// Also remove it from any completed dangerous downloads.
DownloadMap::iterator dit = dangerous_finished_.find(download->id());
@@ -1075,9 +1095,11 @@ void DownloadManager::GenerateExtension(
FilePath::StringType extension(
file_util::GetFileExtensionFromPath(file_name));
+#if defined(OS_WIN)
// Rename shell-integrated extensions.
if (win_util::IsShellIntegratedExtension(extension))
extension.assign(default_extension);
+#endif
std::string mime_type_from_extension;
net::GetMimeTypeFromFile(file_name,
@@ -1233,7 +1255,17 @@ void DownloadManager::SaveAutoOpens() {
}
if (!extensions.empty())
extensions.erase(extensions.size() - 1);
- prefs->SetString(prefs::kDownloadExtensionsToOpen, extensions);
+
+ std::wstring extensions_w;
+#if defined(OS_WIN)
+ extensions_w = extensions;
+#elif defined(OS_POSIX)
+ // TODO(port): this is not correct since FilePath::StringType is not
+ // necessarily UTF8.
+ extensions_w = UTF8ToWide(extensions);
+#endif
+
+ prefs->SetString(prefs::kDownloadExtensionsToOpen, extensions_w);
}
}
@@ -1288,6 +1320,7 @@ void DownloadManager::GenerateSafeFilename(const std::string& mime_type,
// Prepend "_" to the file name if it's a reserved name
FilePath::StringType leaf_name = file_name->BaseName().value();
DCHECK(!leaf_name.empty());
+#if defined(OS_WIN)
if (win_util::IsReservedName(leaf_name)) {
leaf_name = FilePath::StringType(FILE_PATH_LITERAL("_")) + leaf_name;
*file_name = file_name->DirName();
@@ -1297,6 +1330,9 @@ void DownloadManager::GenerateSafeFilename(const std::string& mime_type,
*file_name = file_name->Append(leaf_name);
}
}
+#elif defined(OS_POSIX)
+ NOTIMPLEMENTED();
+#endif
}
// Operations posted to us from the history service ----------------------------
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
index 942361b..75ab75b 100644
--- a/chrome/browser/download/download_manager.h
+++ b/chrome/browser/download/download_manager.h
@@ -51,9 +51,15 @@
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/history/download_types.h"
#include "chrome/browser/history/history.h"
-#include "chrome/browser/shell_dialogs.h"
#include "chrome/common/pref_member.h"
+#if defined(OS_WIN)
+// TODO(port): port this header.
+#include "chrome/browser/shell_dialogs.h"
+#elif defined(OS_POSIX)
+#include "chrome/common/temp_scaffolding_stubs.h"
+#endif
+
class DownloadFileManager;
class DownloadItemView;
class DownloadManager;
@@ -231,7 +237,7 @@ class DownloadItem {
int64 received_bytes_;
// Start time for calculating remaining time
- uintptr_t start_tick_;
+ base::TimeTicks start_tick_;
// The current state of this download
DownloadState state_;
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index 6f1fcf8..c40788c 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -12,6 +12,7 @@
#include "base/task.h"
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/save_file.h"
#include "chrome/browser/download/save_file_manager.h"
#include "chrome/browser/profile.h"
@@ -39,7 +40,6 @@
#if defined(OS_WIN)
// TODO(port): port these headers.
-#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/save_page_model.h"
#include "chrome/browser/views/download_shelf_view.h"
#elif defined(OS_POSIX)
diff --git a/chrome/browser/history/download_types.h b/chrome/browser/history/download_types.h
index de87d2e..308bf0d 100644
--- a/chrome/browser/history/download_types.h
+++ b/chrome/browser/history/download_types.h
@@ -4,8 +4,8 @@
//
// Download creation struct used for querying the history service.
-#ifndef CHROME_BROWSER_DOWNLOAD_TYPES_H__
-#define CHROME_BROWSER_DOWNLOAD_TYPES_H__
+#ifndef CHROME_BROWSER_DOWNLOAD_TYPES_H_
+#define CHROME_BROWSER_DOWNLOAD_TYPES_H_
#include <string>
#include <vector>
@@ -70,5 +70,5 @@ struct DownloadCreateInfo {
FilePath original_name;
};
-#endif // CHROME_BROWSER_DOWNLOAD_TYPES_H__
+#endif // CHROME_BROWSER_DOWNLOAD_TYPES_H_
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 4602c91..e3fe08f 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/history/history.h"
@@ -41,10 +42,8 @@
// TODO(port): Get rid of this section and finish porting.
#if defined(OS_WIN)
-#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/search_engines/template_url_fetcher.h"
#include "chrome/browser/spellchecker.h"
-#include "chrome/browser/tab_contents/navigation_controller.h"
#endif
using base::Time;
diff --git a/chrome/browser/renderer_host/download_resource_handler.cc b/chrome/browser/renderer_host/download_resource_handler.cc
index 9351f56..37e7e89 100644
--- a/chrome/browser/renderer_host/download_resource_handler.cc
+++ b/chrome/browser/renderer_host/download_resource_handler.cc
@@ -4,14 +4,8 @@
#include "chrome/browser/renderer_host/download_resource_handler.h"
-#if defined(OS_POSIX)
-// TODO(port): Remove the temporary scaffolding after porting the headers below.
-#include "chrome/common/temp_scaffolding_stubs.h"
-#elif defined(OS_WIN)
#include "chrome/browser/download/download_file.h"
#include "chrome/browser/download/download_manager.h"
-#endif
-
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "net/base/io_buffer.h"
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 2aa4522..80b2133 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -13,12 +13,15 @@
#include "base/time.h"
#include "chrome/browser/cert_store.h"
#include "chrome/browser/cross_site_request_manager.h"
+#include "chrome/browser/download/download_file.h"
+#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/save_file_manager.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/renderer_host/async_resource_handler.h"
#include "chrome/browser/renderer_host/buffered_resource_handler.h"
#include "chrome/browser/renderer_host/cross_site_resource_handler.h"
#include "chrome/browser/renderer_host/download_resource_handler.h"
+#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/renderer_security_policy.h"
#include "chrome/browser/renderer_host/resource_request_details.h"
#include "chrome/browser/renderer_host/safe_browsing_resource_handler.h"
@@ -40,12 +43,9 @@
#if defined(OS_POSIX)
#include "chrome/common/temp_scaffolding_stubs.h"
#elif defined(OS_WIN)
-#include "chrome/browser/download/download_file.h"
-#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_request_manager.h"
#include "chrome/browser/external_protocol_handler.h"
#include "chrome/browser/login_prompt.h"
-#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#endif
diff --git a/chrome/browser/spellchecker.cc b/chrome/browser/spellchecker.cc
index c79a1f1..cb6f874 100644
--- a/chrome/browser/spellchecker.cc
+++ b/chrome/browser/spellchecker.cc
@@ -13,10 +13,7 @@
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/net/url_fetcher.h"
-#if defined(OS_WIN)
-// TODO(port): remove scaffolding, use profile.h for both POSIX and WIN.
#include "chrome/browser/profile.h"
-#endif
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_counters.h"
#include "chrome/common/chrome_paths.h"
diff --git a/chrome/browser/tab_contents/render_view_context_menu_controller.cc b/chrome/browser/tab_contents/render_view_context_menu_controller.cc
index b6cb107..53cae10 100644
--- a/chrome/browser/tab_contents/render_view_context_menu_controller.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu_controller.cc
@@ -11,25 +11,25 @@
#include "base/scoped_clipboard_writer.h"
#include "base/string_util.h"
#include "chrome/app/chrome_dll_resource.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/save_package.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/web_contents.h"
+#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/pref_service.h"
#include "net/base/escape.h"
#include "net/base/net_util.h"
#include "net/url_request/url_request.h"
#if defined(OS_WIN)
// TODO(port): port these files.
-#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/spellchecker.h"
#include "chrome/browser/views/options/fonts_languages_window_view.h"
#include "chrome/browser/views/page_info_window.h"
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index e844ad9..b360d6f 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/dom_operation_notification_details.h"
+#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/gears_integration.h"
#include "chrome/browser/google_util.h"
#include "chrome/browser/js_before_unload_handler.h"
@@ -25,6 +26,7 @@
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/search_engines/template_url_model.h"
+#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/provisional_load_details.h"
#include "chrome/browser/tab_contents/web_contents_view.h"
#include "chrome/common/chrome_switches.h"
@@ -43,14 +45,12 @@
// TODO(port): fill these in as we flesh out the implementation of this class
#include "chrome/browser/cache_manager_host.h"
#include "chrome/browser/character_encoding.h"
-#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_request_manager.h"
#include "chrome/browser/modal_html_dialog_delegate.h"
#include "chrome/browser/plugin_installer.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/printing/print_job.h"
#include "chrome/browser/search_engines/template_url_fetcher.h"
-#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/views/hung_renderer_view.h" // TODO(brettw) delete me.
#include "chrome/common/resource_bundle.h"
#endif
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index a549408..9c7dc25 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -305,8 +305,10 @@
8CB218DCFAC761AC876C6531 /* ssl_blocking_page.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5D16ECB0F21451600861FAC /* ssl_blocking_page.cc */; };
8F51B73AAAF1772ECF9BD180 /* url_fetcher.cc in Sources */ = {isa = PBXBuildFile; fileRef = 778D7927798B7E3FAA498D3D /* url_fetcher.cc */; };
9084D27A4F8690E6FD31083B /* session_backend.cc in Sources */ = {isa = PBXBuildFile; fileRef = 35AC9D9A03545594C102C5C1 /* session_backend.cc */; };
+ 928300674E414B42615BA4F0 /* download_manager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF9CE0E9D48CE009A6919 /* download_manager.cc */; };
94542322A5E5A8F4FDDAB7F0 /* render_view_host_manager.cc in Sources */ = {isa = PBXBuildFile; fileRef = A76E42AD0F28EDB5009A7E88 /* render_view_host_manager.cc */; };
96DF109FEE9B09B11690F1FA /* infobar_delegate.cc in Sources */ = {isa = PBXBuildFile; fileRef = B6CCB9CF0F1EC32700106F0D /* infobar_delegate.cc */; };
+ 970EF19CD8A79CF3D0DF4B61 /* download_file.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF9CA0E9D48CE009A6919 /* download_file.cc */; };
97DD178B77011735FE4399E9 /* file_descriptor_set_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = D74DA6A9031CAE292790BD5E /* file_descriptor_set_unittest.cc */; };
9E85B39CA40439D93CE52E60 /* fav_icon_helper.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF8760E9D4839009A6919 /* fav_icon_helper.cc */; };
A0BC9272AD709E86D492DAEC /* bookmark_storage.cc in Sources */ = {isa = PBXBuildFile; fileRef = D941DBEFD8B8B537DE8A4DAE /* bookmark_storage.cc */; };
@@ -5454,6 +5456,8 @@
4D7BFA7C0E9D4994009A6919 /* dns_host_info.cc in Sources */,
28283DBE4B6DB2B0F9893676 /* dns_master.cc in Sources */,
E4F324550EE5CFB1002533CE /* download_database.cc in Sources */,
+ 970EF19CD8A79CF3D0DF4B61 /* download_file.cc in Sources */,
+ 928300674E414B42615BA4F0 /* download_manager.cc in Sources */,
E43A77170F16616E00ABD5D1 /* download_resource_handler.cc in Sources */,
E45075E30F150A6F003BE099 /* download_throttling_resource_handler.cc in Sources */,
E4F324470EE5CF1F002533CE /* expire_history_backend.cc in Sources */,
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 5d36a24..8e70e60 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -58,6 +58,7 @@ class CommandLine;
class ConstrainedWindow;
class CPCommandInterface;
class DOMUIHost;
+class DownloadItem;
class DownloadManager;
class HistoryService;
class LoginHandler;
@@ -235,48 +236,6 @@ class PrintJobManager {
} // namespace printing
-struct DownloadBuffer {
- Lock lock;
- typedef std::pair<net::IOBuffer*, int> Contents;
- std::vector<Contents> contents;
-};
-
-class DownloadItem {
-public:
- void Remove(bool delete_file) { NOTIMPLEMENTED(); }
- void Update(int64 bytes_so_far) { NOTIMPLEMENTED(); }
- void Cancel(bool update_history) { NOTIMPLEMENTED(); }
- void Finished(int64 size) { NOTIMPLEMENTED(); }
- void set_total_bytes(int64 total_bytes) { NOTIMPLEMENTED(); }
- enum DownloadState {
- IN_PROGRESS,
- COMPLETE,
- CANCELLED,
- REMOVING
- };
-};
-
-class DownloadFileManager
- : public base::RefCountedThreadSafe<DownloadFileManager> {
- public:
- DownloadFileManager(MessageLoop* ui_loop, ResourceDispatcherHost* rdh) {
- NOTIMPLEMENTED();
- }
- void Initialize() { NOTIMPLEMENTED(); }
- void Shutdown() { NOTIMPLEMENTED(); }
- MessageLoop* file_loop() const {
- NOTIMPLEMENTED();
- return NULL;
- }
- int GetNextId() {
- NOTIMPLEMENTED();
- return 0;
- }
- void StartDownload(DownloadCreateInfo* info) { NOTIMPLEMENTED(); }
- void UpdateDownload(int id, DownloadBuffer* buffer) { NOTIMPLEMENTED(); }
- void DownloadFinished(int id, DownloadBuffer* buffer) { NOTIMPLEMENTED(); }
-};
-
class DownloadRequestManager
: public base::RefCountedThreadSafe<DownloadRequestManager> {
public:
@@ -447,6 +406,7 @@ class TabContents : public PageNavigator, public NotificationObserver {
virtual gfx::NativeView GetNativeView() const { return NULL; }
static TabContentsFactory* RegisterFactory(TabContentsType type,
TabContentsFactory* factory);
+ void OnStartDownload(DownloadItem* download) { NOTIMPLEMENTED(); }
protected:
typedef std::vector<ConstrainedWindow*> ConstrainedWindowList;
ConstrainedWindowList child_windows_;
@@ -507,30 +467,6 @@ class WindowSizer {
//---------------------------------------------------------------------------
// These stubs are for Profile
-class DownloadManager : public base::RefCountedThreadSafe<DownloadManager> {
- public:
- bool Init(Profile* profile) {
- NOTIMPLEMENTED();
- return true;
- }
- void DownloadUrl(const GURL& url, const GURL& referrer,
- WebContents* web_contents) { NOTIMPLEMENTED(); }
- int RemoveDownloadsBetween(const base::Time remove_begin,
- const base::Time remove_end) {
- NOTIMPLEMENTED();
- return 0;
- }
- void ClearLastDownloadPath() { NOTIMPLEMENTED(); }
- int in_progress_count() {
- NOTIMPLEMENTED();
- return 0;
- }
- void GenerateSafeFilename(const std::string& mime_type,
- FilePath* file_name) {
- NOTIMPLEMENTED();
- }
-};
-
class TemplateURLFetcher {
public:
explicit TemplateURLFetcher(Profile* profile) { }