summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-26 22:47:11 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-26 22:47:11 +0000
commit828cabe21191c14e43fc3dda06918f7ec8c91988 (patch)
tree5d6872acf00deee9aa71392a427d60e25e09cbeb /chrome
parent178102d66e9dc222613e36bfac6933d3e5de59a9 (diff)
downloadchromium_src-828cabe21191c14e43fc3dda06918f7ec8c91988.zip
chromium_src-828cabe21191c14e43fc3dda06918f7ec8c91988.tar.gz
chromium_src-828cabe21191c14e43fc3dda06918f7ec8c91988.tar.bz2
Update the TabContents::SavePage parameter to take FilePath instead of wstring to avoid conversions "To and From wstring".
BUG=None TEST=run unit_tests.exe Review URL: http://codereview.chromium.org/217008 Patch from tfarina. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_provider.cc4
-rw-r--r--chrome/browser/automation/automation_provider.h4
-rw-r--r--chrome/browser/browser_encoding_uitest.cc6
-rw-r--r--chrome/browser/download/save_page_browsertest.cc9
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc7
-rw-r--r--chrome/browser/tab_contents/tab_contents.h3
-rw-r--r--chrome/test/automation/automation_messages_internal.h4
-rw-r--r--chrome/test/automation/tab_proxy.cc4
-rw-r--r--chrome/test/automation/tab_proxy.h3
9 files changed, 17 insertions, 27 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 7f0998e..b4fc56d 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -1512,8 +1512,8 @@ void AutomationProvider::PrintNow(int tab_handle,
}
void AutomationProvider::SavePage(int tab_handle,
- const std::wstring& file_name,
- const std::wstring& dir_path,
+ const FilePath& file_name,
+ const FilePath& dir_path,
int type,
bool* success) {
if (!tab_tracker_->ContainsHandle(tab_handle)) {
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 7728e4e..a376610 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -360,8 +360,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
// Save the current web page.
void SavePage(int tab_handle,
- const std::wstring& file_name,
- const std::wstring& dir_path,
+ const FilePath& file_name,
+ const FilePath& dir_path,
int type,
bool* success);
diff --git a/chrome/browser/browser_encoding_uitest.cc b/chrome/browser/browser_encoding_uitest.cc
index d048efd..7dec5b8 100644
--- a/chrome/browser/browser_encoding_uitest.cc
+++ b/chrome/browser/browser_encoding_uitest.cc
@@ -150,8 +150,7 @@ TEST_F(BrowserEncodingTest, DISABLED_TestOverrideEncoding) {
// We save the page as way of complete HTML file, which requires a directory
// name to save sub resources in it. Although this test file does not have
// sub resources, but the directory name is still required.
- EXPECT_TRUE(tab_proxy->SavePage(full_file_name.ToWStringHack(),
- temp_sub_resource_dir_.ToWStringHack(),
+ EXPECT_TRUE(tab_proxy->SavePage(full_file_name, temp_sub_resource_dir_,
SavePackage::SAVE_AS_COMPLETE_HTML));
scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
@@ -290,8 +289,7 @@ TEST_F(BrowserEncodingTest, TestEncodingAutoDetect) {
kExpectedResultDir);
expected_result_file_name = expected_result_file_name.AppendASCII(
kTestDatas[i].expected_result);
- EXPECT_TRUE(tab->SavePage(full_saved_file_name.ToWStringHack(),
- temp_sub_resource_dir_.ToWStringHack(),
+ EXPECT_TRUE(tab->SavePage(full_saved_file_name, temp_sub_resource_dir_,
SavePackage::SAVE_AS_COMPLETE_HTML));
EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get()));
CheckFile(full_saved_file_name, expected_result_file_name, true);
diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc
index 1f44720..dbe7807 100644
--- a/chrome/browser/download/save_page_browsertest.cc
+++ b/chrome/browser/download/save_page_browsertest.cc
@@ -88,8 +88,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnly) {
FilePath full_file_name = save_dir_.path().Append(file_name);
FilePath dir = save_dir_.path().AppendASCII("a_files");
- ASSERT_TRUE(current_tab->SavePage(full_file_name.ToWStringHack(),
- dir.ToWStringHack(),
+ ASSERT_TRUE(current_tab->SavePage(full_file_name, dir,
SavePackage::SAVE_AS_ONLY_HTML));
SavePageFinishedObserver observer;
@@ -114,8 +113,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveCompleteHTML) {
FilePath full_file_name = save_dir_.path().Append(file_name);
FilePath dir = save_dir_.path().AppendASCII("b_files");
- ASSERT_TRUE(current_tab->SavePage(full_file_name.ToWStringHack(),
- dir.ToWStringHack(),
+ ASSERT_TRUE(current_tab->SavePage(full_file_name, dir,
SavePackage::SAVE_AS_COMPLETE_HTML));
SavePageFinishedObserver observer;
@@ -159,8 +157,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, FileNameFromPageTitle) {
TabContents* current_tab = browser()->GetSelectedTabContents();
ASSERT_TRUE(current_tab);
- ASSERT_TRUE(current_tab->SavePage(full_file_name.ToWStringHack(),
- dir.ToWStringHack(),
+ ASSERT_TRUE(current_tab->SavePage(full_file_name, dir,
SavePackage::SAVE_AS_COMPLETE_HTML));
SavePageFinishedObserver observer;
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 24fd51a..d36d53f 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -1127,15 +1127,12 @@ void TabContents::OnSavePage() {
// Used in automated testing to bypass prompting the user for file names.
// Instead, the names and paths are hard coded rather than running them through
// file name sanitation and extension / mime checking.
-bool TabContents::SavePage(const std::wstring& main_file,
- const std::wstring& dir_path,
+bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path,
SavePackage::SavePackageType save_type) {
// Stop the page from navigating.
Stop();
- save_package_ = new SavePackage(this, save_type,
- FilePath::FromWStringHack(main_file),
- FilePath::FromWStringHack(dir_path));
+ save_package_ = new SavePackage(this, save_type, main_file, dir_path);
return save_package_->Init();
}
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 5749e60..74669b3 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -558,8 +558,7 @@ class TabContents : public PageNavigator,
// Save page with the main HTML file path, the directory for saving resources,
// and the save type: HTML only or complete web page. Returns true if the
// saving process has been initiated successfully.
- bool SavePage(const std::wstring& main_file,
- const std::wstring& dir_path,
+ bool SavePage(const FilePath& main_file, const FilePath& dir_path,
SavePackage::SavePackageType save_type);
// Displays asynchronously a print preview (generated by the renderer) if not
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 1e87cfa..e7016cf 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -658,8 +658,8 @@ IPC_BEGIN_MESSAGES(Automation)
// for saving resources. The fourth parameter is the saving type: 0 for HTML
// only; 1 for complete web page.
// The return value contains a bool which is true on success.
- IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_SavePage, int, std::wstring,
- std::wstring, int, bool)
+ IPC_SYNC_MESSAGE_ROUTED4_1(AutomationMsg_SavePage, int, FilePath, FilePath,
+ int, bool)
// This message requests the text currently being displayed in the
// AutocompleteEdit. The parameter is the handle to the AutocompleteEdit.
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index 6ab222a..eb00d74 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -576,8 +576,8 @@ bool TabProxy::PrintAsync() {
return sender_->Send(new AutomationMsg_PrintAsync(0, handle_));
}
-bool TabProxy::SavePage(const std::wstring& file_name,
- const std::wstring& dir_path,
+bool TabProxy::SavePage(const FilePath& file_name,
+ const FilePath& dir_path,
SavePackage::SavePackageType type) {
if (!is_valid())
return false;
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index 7f56932..94bf717 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -272,8 +272,7 @@ class TabProxy : public AutomationResourceProxy {
// Save the current web page. |file_name| is the HTML file name, and
// |dir_path| is the directory for saving resource files. |type| indicates
// which type we're saving as: HTML only or the complete web page.
- bool SavePage(const std::wstring& file_name,
- const std::wstring& dir_path,
+ bool SavePage(const FilePath& file_name, const FilePath& dir_path,
SavePackage::SavePackageType type);
// Posts a message to the external tab.