diff options
Diffstat (limited to 'chrome/browser')
19 files changed, 70 insertions, 62 deletions
diff --git a/chrome/browser/automation/url_request_mock_http_job.cc b/chrome/browser/automation/url_request_mock_http_job.cc index 26a5cc7..4bb191a 100644 --- a/chrome/browser/automation/url_request_mock_http_job.cc +++ b/chrome/browser/automation/url_request_mock_http_job.cc @@ -32,10 +32,9 @@ URLRequestJob* URLRequestMockHTTPJob::Factory(URLRequest* request, } // Convert the file:/// URL to a path on disk. - std::wstring file_path; + FilePath file_path; net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path); - return new URLRequestMockHTTPJob(request, - FilePath::FromWStringHack(file_path)); + return new URLRequestMockHTTPJob(request, file_path); } /* static */ diff --git a/chrome/browser/automation/url_request_mock_net_error_job.cc b/chrome/browser/automation/url_request_mock_net_error_job.cc index e6ab51f..0b9a20a 100644 --- a/chrome/browser/automation/url_request_mock_net_error_job.cc +++ b/chrome/browser/automation/url_request_mock_net_error_job.cc @@ -54,11 +54,11 @@ URLRequestJob* URLRequestMockNetErrorJob::Factory(URLRequest* request, file_url.append(mock_info.base); file_url.append(UTF8ToWide(url.path())); // Convert the file:/// URL to a path on disk. - std::wstring file_path; + FilePath file_path; net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path); return new URLRequestMockNetErrorJob(request, mock_info.errors, mock_info.ssl_cert, - FilePath::FromWStringHack(file_path)); + file_path); } URLRequestMockNetErrorJob::URLRequestMockNetErrorJob(URLRequest* request, diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 727d128..ab5037a 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1949,7 +1949,7 @@ void Browser::RenderWidgetShowing() { // Browser, SelectFileDialog::Listener implementation: void Browser::FileSelected(const FilePath& path, int index, void* params) { - GURL file_url = net::FilePathToFileURL(path.ToWStringHack()); + GURL file_url = net::FilePathToFileURL(path); if (!file_url.is_empty()) OpenURL(file_url, GURL(), CURRENT_TAB, PageTransition::TYPED); } diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index a30016a..3a05636 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -61,8 +61,8 @@ class VisibleBrowserTest : public UITest { // Launch the app on a page with no title, check that the app title was set // correctly. TEST_F(BrowserTest, NoTitle) { - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, L"title1.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("title1.html"); NavigateToURL(net::FilePathToFileURL(test_file)); Sleep(sleep_timeout_ms()); // The browser lazily updates the title. @@ -74,8 +74,8 @@ TEST_F(BrowserTest, NoTitle) { // Launch the app, navigate to a page with a title, check that the app title // was set correctly. TEST_F(BrowserTest, Title) { - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, L"title2.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("title2.html"); NavigateToURL(net::FilePathToFileURL(test_file)); Sleep(sleep_timeout_ms()); // The browser lazily updates the title. @@ -90,8 +90,8 @@ TEST_F(BrowserTest, Title) { // had a hard limit of 31 processes and this test is mainly directed at // verifying that we don't crash when we pass this limit. TEST_F(BrowserTest, ThirtyFourTabs) { - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, L"title2.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("title2.html"); GURL url(net::FilePathToFileURL(test_file)); scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); // There is one initial tab. @@ -116,8 +116,8 @@ TEST_F(BrowserTest, ThirtyFourTabs) { // The browser should quit quickly if it receives a WM_ENDSESSION message. TEST_F(BrowserTest, WindowsSessionEnd) { - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, L"title1.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("title1.html"); NavigateToURL(net::FilePathToFileURL(test_file)); Sleep(action_timeout_ms()); @@ -186,12 +186,12 @@ TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, NULL); ASSERT_TRUE(NULL != server.get()); - std::wstring test_file(test_data_directory_); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); scoped_ptr<TabProxy> tab(window->GetActiveTab()); // Start with a file:// url - file_util::AppendToPath(&test_file, L"title2.html"); + test_file = test_file.AppendASCII("title2.html"); tab->NavigateToURL(net::FilePathToFileURL(test_file)); int orig_tab_count = -1; ASSERT_TRUE(window->GetTabCount(&orig_tab_count)); @@ -226,12 +226,12 @@ TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, NULL); ASSERT_TRUE(NULL != server.get()); - std::wstring test_file(test_data_directory_); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); scoped_ptr<TabProxy> tab(window->GetActiveTab()); // Start with a file:// url - file_util::AppendToPath(&test_file, L"title2.html"); + test_file = test_file.AppendASCII("title2.html"); tab->NavigateToURL(net::FilePathToFileURL(test_file)); int orig_tab_count = -1; ASSERT_TRUE(window->GetTabCount(&orig_tab_count)); @@ -263,8 +263,8 @@ TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { } TEST_F(VisibleBrowserTest, WindowOpenClose) { - std::wstring test_file(test_data_directory_); - file_util::AppendToPath(&test_file, L"window.close.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("window.close.html"); NavigateToURL(net::FilePathToFileURL(test_file)); diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc index 373bee1..4548a48 100644 --- a/chrome/browser/chrome_plugin_host.cc +++ b/chrome/browser/chrome_plugin_host.cc @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/command_line.h" +#include "base/file_path.h" #include "base/file_util.h" #include "base/gfx/png_encoder.h" #include "base/histogram.h" @@ -637,8 +638,8 @@ CPError STDCALL CPR_AppendFileToUpload(CPRequest* request, const char* filepath, CHECK(handler); if (!length) length = kuint64max; - std::wstring wfilepath(UTF8ToWide(filepath)); - handler->request()->AppendFileRangeToUpload(wfilepath, offset, length); + FilePath path(FilePath::FromWStringHack(UTF8ToWide(filepath))); + handler->request()->AppendFileRangeToUpload(path, offset, length); return CPERR_SUCCESS; } diff --git a/chrome/browser/crash_recovery_uitest.cc b/chrome/browser/crash_recovery_uitest.cc index 2ee7a98..bbd577a 100644 --- a/chrome/browser/crash_recovery_uitest.cc +++ b/chrome/browser/crash_recovery_uitest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/file_path.h" #include "base/file_util.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" @@ -50,8 +51,8 @@ TEST_F(CrashRecoveryUITest, LoadInNewTab) { return; // The title of the active tab should change each time this URL is loaded. - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, L"title2.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("title2.html"); GURL url(net::FilePathToFileURL(test_file)); NavigateToURL(url); diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 37906d3..c013f0c 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -410,7 +410,6 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, bool HasAutoOpenFileTypesRegistered() const; // Overridden from SelectFileDialog::Listener: - // TODO(port): convert this to FilePath when SelectFileDialog gets converted. virtual void FileSelected(const FilePath& path, int index, void* params); virtual void FileSelectionCanceled(void* params); diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index b54f060..23bb704 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -1041,7 +1041,7 @@ void SavePackage::GetSaveInfo() { } else #endif // defined(OS_LINUX) || defined(OS_WIN) { - // Just use 'suggested_name' instead of opening the dialog prompt. + // Just use 'suggested_path' instead of opening the dialog prompt. ContinueSave(save_params, suggested_path, filter_index); delete save_params; } diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 03b54b9..723b1f3 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -155,7 +155,7 @@ void UserScriptMaster::ScriptReloader::LoadScriptsFromDirectory( UserScript& user_script = result->back(); // Push single js file in this UserScript. GURL url(std::string(chrome::kUserScriptScheme) + ":/" + - net::FilePathToFileURL(file.ToWStringHack()).ExtractFileName()); + net::FilePathToFileURL(file).ExtractFileName()); user_script.js_scripts().push_back(UserScript::File(file, url)); UserScript::File& script_file = user_script.js_scripts().back(); LoadScriptContent(&script_file); diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc index af80496..1d27804 100644 --- a/chrome/browser/history/redirect_uitest.cc +++ b/chrome/browser/history/redirect_uitest.cc @@ -7,6 +7,7 @@ // here might indicate that WebKit changed the calls our glue layer gets in // the case of redirects. It may also mean problems with the history system. +#include "base/file_path.h" #include "base/file_util.h" #include "base/platform_thread.h" #include "base/scoped_ptr.h" @@ -81,8 +82,8 @@ TEST_F(RedirectTest, ClientEmptyReferer) { ASSERT_TRUE(NULL != server.get()); GURL final_url = server->TestServerPageW(std::wstring()); - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, L"file_client_redirect.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("file_client_redirect.html"); GURL first_url = net::FilePathToFileURL(test_file); NavigateToURL(first_url); @@ -107,8 +108,8 @@ TEST_F(RedirectTest, ClientEmptyReferer) { // Tests to make sure a location change when a pending redirect exists isn't // flagged as a redirect. TEST_F(RedirectTest, ClientCancelled) { - std::wstring first_path = test_data_directory_; - file_util::AppendToPath(&first_path, L"cancelled_redirect_test.html"); + FilePath first_path(FilePath::FromWStringHack(test_data_directory_)); + first_path = first_path.AppendASCII("cancelled_redirect_test.html"); ASSERT_TRUE(file_util::AbsolutePath(&first_path)); GURL first_url = net::FilePathToFileURL(first_path); @@ -132,11 +133,12 @@ TEST_F(RedirectTest, ClientCancelled) { // containing an anchor using FilePathToFileURL will escape the anchor as // %23, but in current_url the anchor will be '#'. std::string final_ref = "myanchor"; - std::wstring current_path; + FilePath current_path; ASSERT_TRUE(net::FileURLToFilePath(current_url, ¤t_path)); ASSERT_TRUE(file_util::AbsolutePath(¤t_path)); // Path should remain unchanged. - EXPECT_EQ(StringToLowerASCII(first_path), StringToLowerASCII(current_path)); + EXPECT_EQ(StringToLowerASCII(first_path.value()), + StringToLowerASCII(current_path.value())); EXPECT_EQ(final_ref, current_url.ref()); } @@ -202,8 +204,8 @@ TEST_F(RedirectTest, NoHttpToFile) { scoped_refptr<HTTPTestServer> server = HTTPTestServer::CreateServer(kDocRoot, NULL); ASSERT_TRUE(NULL != server.get()); - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, L"http_to_file.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("http_to_file.html"); GURL file_url = net::FilePathToFileURL(test_file); GURL initial_url = server->TestServerPageW( @@ -226,8 +228,8 @@ TEST_F(RedirectTest, ClientFragments) { HTTPTestServer::CreateServer(kDocRoot, NULL); ASSERT_TRUE(NULL != server.get()); - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, L"ref_redirect.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("ref_redirect.html"); GURL first_url = net::FilePathToFileURL(test_file); std::vector<GURL> redirects; diff --git a/chrome/browser/iframe_uitest.cc b/chrome/browser/iframe_uitest.cc index 7e2e617..2f3a7f7 100644 --- a/chrome/browser/iframe_uitest.cc +++ b/chrome/browser/iframe_uitest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/basictypes.h" +#include "base/file_path.h" #include "base/file_util.h" #include "base/platform_thread.h" #include "chrome/test/ui/ui_test.h" @@ -10,9 +11,9 @@ class IFrameTest : public UITest { protected: - void NavigateAndVerifyTitle(const wchar_t* url, const wchar_t* page_title) { - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, url); + void NavigateAndVerifyTitle(const char* url, const wchar_t* page_title) { + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII(url); NavigateToURL(net::FilePathToFileURL(test_file)); // The browser lazily updates the title. @@ -27,9 +28,9 @@ class IFrameTest : public UITest { }; TEST_F(IFrameTest, Crash) { - NavigateAndVerifyTitle(L"iframe.html", L"iframe test"); + NavigateAndVerifyTitle("iframe.html", L"iframe test"); } TEST_F(IFrameTest, InEmptyFrame) { - NavigateAndVerifyTitle(L"iframe_in_empty_frame.html", L"iframe test"); + NavigateAndVerifyTitle("iframe_in_empty_frame.html", L"iframe test"); } diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc index 9e6940ed..a994767 100644 --- a/chrome/browser/metrics/metrics_service_uitest.cc +++ b/chrome/browser/metrics/metrics_service_uitest.cc @@ -7,6 +7,7 @@ #include <string> +#include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/platform_thread.h" @@ -33,14 +34,14 @@ class MetricsServiceTest : public UITest { window_ = automation()->GetBrowserWindow(0); ASSERT_TRUE(window_); - std::wstring page1_path; + FilePath page1_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page1_path)); - file_util::AppendToPath(&page1_path, L"title2.html"); + page1_path = page1_path.AppendASCII("title2.html"); ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page1_path))); - std::wstring page2_path; + FilePath page2_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page2_path)); - file_util::AppendToPath(&page2_path, L"iframe.html"); + page2_path = page2_path.AppendASCII("iframe.html"); ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page2_path))); } diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 0f80652..e049523 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -398,8 +398,9 @@ void RenderViewHost::DragTargetDragEnter(const WebDropData& drop_data, for (std::vector<std::wstring>::const_iterator iter(drop_data.filenames.begin()); iter != drop_data.filenames.end(); ++iter) { - policy->GrantRequestURL(process()->pid(), net::FilePathToFileURL(*iter)); - policy->GrantUploadFile(process()->pid(), FilePath::FromWStringHack(*iter)); + FilePath path = FilePath::FromWStringHack(*iter); + policy->GrantRequestURL(process()->pid(), net::FilePathToFileURL(path)); + policy->GrantUploadFile(process()->pid(), path); } Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt, screen_pt)); diff --git a/chrome/browser/renderer_host/renderer_security_policy.h b/chrome/browser/renderer_host/renderer_security_policy.h index 2064700..84fd32c 100644 --- a/chrome/browser/renderer_host/renderer_security_policy.h +++ b/chrome/browser/renderer_host/renderer_security_policy.h @@ -10,6 +10,7 @@ #include <set> #include "base/basictypes.h" +#include "base/file_path.h" #include "base/lock.h" #include "base/singleton.h" diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index b2b2c73..1a73ca5 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -122,9 +122,9 @@ bool ShouldServiceRequest(ChildProcessInfo::ProcessType process_type, std::vector<net::UploadData::Element>::const_iterator iter; for (iter = uploads.begin(); iter != uploads.end(); ++iter) { if (iter->type() == net::UploadData::TYPE_FILE && - !policy->CanUploadFile(process_id, - FilePath::FromWStringHack(iter->file_path()))) { - NOTREACHED() << "Denied unauthorized upload of " << iter->file_path(); + !policy->CanUploadFile(process_id, iter->file_path())) { + NOTREACHED() << "Denied unauthorized upload of " + << iter->file_path().value(); return false; } } diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc index d44080f..682336a 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc @@ -231,8 +231,8 @@ TEST_F(ResourceDispatcherTest, CrossSiteNavigationNonBuffered) { // Now load a file:// page, which does not use the BufferedEventHandler. // Make sure that the page loads and displays a title, and doesn't get stuck. - std::wstring test_file = test_data_directory_; - file_util::AppendToPath(&test_file, L"title2.html"); + FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); + test_file = test_file.AppendASCII("title2.html"); bool timed_out = false; tab->NavigateToURLWithTimeout(net::FilePathToFileURL(test_file), action_max_timeout_ms(), diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc index 7c389d5..bfd2d2c 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -4,6 +4,7 @@ #include <vector> +#include "base/file_path.h" #include "base/message_loop.h" #include "base/process_util.h" #include "chrome/browser/renderer_host/renderer_security_policy.h" @@ -532,7 +533,7 @@ TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) { EXPECT_EQ(4434, ResourceDispatcherHost::CalculateApproximateMemoryCost(&req)); // Add a file upload -- should have no effect. - req.AppendFileToUpload(L"does-not-exist.png"); + req.AppendFileToUpload(FilePath(FILE_PATH_LITERAL("does-not-exist.png"))); EXPECT_EQ(4434, ResourceDispatcherHost::CalculateApproximateMemoryCost(&req)); } diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc index 34922e6..b72e6dc 100644 --- a/chrome/browser/tab_restore_uitest.cc +++ b/chrome/browser/tab_restore_uitest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/command_line.h" +#include "base/file_path.h" #include "base/file_util.h" #include "base/win_util.h" #include "chrome/app/chrome_dll_resource.h" @@ -19,11 +20,10 @@ class TabRestoreUITest : public UITest { public: TabRestoreUITest() : UITest() { - std::wstring path_prefix = test_data_directory_; - file_util::AppendToPath(&path_prefix, L"session_history"); - path_prefix += FilePath::kSeparators[0]; - url1_ = net::FilePathToFileURL(path_prefix + L"bot1.html"); - url2_ = net::FilePathToFileURL(path_prefix + L"bot2.html"); + FilePath path_prefix(FilePath::FromWStringHack(test_data_directory_)); + path_prefix = path_prefix.AppendASCII("session_history"); + url1_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")); + url2_ = net::FilePathToFileURL(path_prefix.AppendASCII("bot2.html")); } protected: diff --git a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc index a114168..1ccb80f 100644 --- a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc +++ b/chrome/browser/views/constrained_window_impl_interactive_uitest.cc @@ -4,6 +4,7 @@ #include <string> +#include "base/file_path.h" #include "base/file_util.h" #include "chrome/browser/view_ids.h" #include "chrome/common/chrome_constants.h" @@ -38,9 +39,9 @@ class InteractiveConstrainedWindowTest : public UITest { } void NavigateMainTabTo(const std::wstring& file_name) { - std::wstring filename(test_data_directory_); - file_util::AppendToPath(&filename, L"constrained_files"); - file_util::AppendToPath(&filename, file_name); + FilePath filename(FilePath::FromWStringHack(test_data_directory_)); + filename = filename.AppendASCII("constrained_files"); + filename = filename.Append(FilePath::FromWStringHack(file_name)); ASSERT_TRUE(tab_->NavigateToURL(net::FilePathToFileURL(filename))); } |