diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-18 22:39:31 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-18 22:39:31 +0000 |
commit | fde6714d19b512b6190f08082c2ea05a21050253 (patch) | |
tree | 652fb54b3891708438648dd8d6cc6e0ebda700eb /webkit | |
parent | f90efcffb6df294c6e0269aac4a4a4442b9505f3 (diff) | |
download | chromium_src-fde6714d19b512b6190f08082c2ea05a21050253.zip chromium_src-fde6714d19b512b6190f08082c2ea05a21050253.tar.gz chromium_src-fde6714d19b512b6190f08082c2ea05a21050253.tar.bz2 |
Prepare some files for porting:
- Trade in some old wstrings for FilePaths.
- Remove some unnecessary headers.
Review URL: http://codereview.chromium.org/21466
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9986 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/dom_serializer.cc | 15 | ||||
-rw-r--r-- | webkit/glue/dom_serializer.h | 13 | ||||
-rw-r--r-- | webkit/glue/dom_serializer_unittest.cc | 8 |
3 files changed, 19 insertions, 17 deletions
diff --git a/webkit/glue/dom_serializer.cc b/webkit/glue/dom_serializer.cc index cb8d92e..d649f5d 100644 --- a/webkit/glue/dom_serializer.cc +++ b/webkit/glue/dom_serializer.cc @@ -148,7 +148,7 @@ DomSerializer::SerializeDomParam::SerializeDomParam( const GURL& current_frame_gurl, const WebCore::TextEncoding& text_encoding, WebCore::Document* doc, - const std::wstring& directory_name) + const FilePath& directory_name) : current_frame_gurl(current_frame_gurl), text_encoding(text_encoding), doc(doc), @@ -380,8 +380,8 @@ void DomSerializer::OpenTagToString(const WebCore::Element* element, LinkLocalPathMap::const_iterator it = local_links_.find(value); if (it != local_links_.end()) { // Replace the link when we have local files. - result += StdWStringToString(param->directory_name); - result += StdWStringToString(it->second); + result += FilePathStringToString(param->directory_name.value()); + result += FilePathStringToString(it->second.value()); } else { // If not found local path, replace it with absolute link. result += str_value; @@ -482,8 +482,8 @@ DomSerializer::DomSerializer(WebFrame* webframe, bool recursive_serialization, DomSerializerDelegate* delegate, const std::vector<GURL>& links, - const std::vector<std::wstring>& local_paths, - const std::wstring& local_directory_name) + const std::vector<FilePath>& local_paths, + const FilePath& local_directory_name) : delegate_(delegate), recursive_serialization_(recursive_serialization), frames_collected_(false), @@ -496,7 +496,7 @@ DomSerializer::DomSerializer(WebFrame* webframe, // Build local resources map. DCHECK(links.size() == local_paths.size()); std::vector<GURL>::const_iterator link_it = links.begin(); - std::vector<std::wstring>::const_iterator path_it = local_paths.begin(); + std::vector<FilePath>::const_iterator path_it = local_paths.begin(); for (; link_it != links.end(); ++link_it, ++path_it) { bool never_present = local_links_.insert( LinkLocalPathMap::value_type(link_it->spec(), *path_it)). @@ -576,7 +576,8 @@ bool DomSerializer::SerializeDom() { encoding.length() ? text_encoding : WebCore::UTF8Encoding(), current_doc, current_frame_gurl == main_page_gurl ? - local_directory_name_ : L"./"); + local_directory_name_ : + FilePath(FilePath::kCurrentDirectory)); // Process current document. WebCore::Element* root_element = current_doc->documentElement(); diff --git a/webkit/glue/dom_serializer.h b/webkit/glue/dom_serializer.h index b8073c1..a69082f 100644 --- a/webkit/glue/dom_serializer.h +++ b/webkit/glue/dom_serializer.h @@ -7,6 +7,7 @@ #include <string> +#include "base/file_path.h" #include "base/hash_tables.h" #include "googleurl/src/gurl.h" @@ -53,8 +54,8 @@ class DomSerializer { bool recursive_serialization, DomSerializerDelegate* delegate, const std::vector<GURL>& links, - const std::vector<std::wstring>& local_paths, - const std::wstring& local_directory_name); + const std::vector<FilePath>& local_paths, + const FilePath& local_directory_name); // Generate the MOTW declaration. static std::string GenerateMarkOfTheWebDeclaration(const GURL& url); @@ -67,7 +68,7 @@ class DomSerializer { WebFrameImpl* specified_webframeimpl_; // This hash_map is used to map resource URL of original link to its local // file path. - typedef base::hash_map<std::string, std::wstring> LinkLocalPathMap; + typedef base::hash_map<std::string, FilePath> LinkLocalPathMap; // local_links_ include all pair of local resource path and corresponding // original link. LinkLocalPathMap local_links_; @@ -83,7 +84,7 @@ class DomSerializer { // serialized or not; bool frames_collected_; // Local directory name of all local resource files. - const std::wstring& local_directory_name_; + const FilePath& local_directory_name_; // Vector for saving all frames which need to be serialized. std::vector<WebFrameImpl*> frames_; @@ -96,7 +97,7 @@ class DomSerializer { // Document object of current frame. WebCore::Document* doc; // Local directory name of all local resource files. - const std::wstring& directory_name; + const FilePath& directory_name; // Flag indicates current doc is html document or not. It's a cache value // of Document.isHTMLDocument(). @@ -118,7 +119,7 @@ class DomSerializer { const GURL& current_frame_gurl, const WebCore::TextEncoding& text_encoding, WebCore::Document* doc, - const std::wstring& directory_name); + const FilePath& directory_name); private: DISALLOW_EVIL_CONSTRUCTORS(SerializeDomParam); diff --git a/webkit/glue/dom_serializer_unittest.cc b/webkit/glue/dom_serializer_unittest.cc index 317a374..c5c0072 100644 --- a/webkit/glue/dom_serializer_unittest.cc +++ b/webkit/glue/dom_serializer_unittest.cc @@ -44,7 +44,7 @@ class DomSerializerTests : public TestShellTest, public webkit_glue::DomSerializerDelegate { public: DomSerializerTests() - : local_directory_name_(L"./dummy_files/") { } + : local_directory_name_(FILE_PATH_LITERAL("./dummy_files/")) { } // DomSerializerDelegate. void DidSerializeDataForFrame(const GURL& frame_url, @@ -140,7 +140,7 @@ class DomSerializerTests : public TestShellTest, // Add input file URl to links_. links_.push_back(page_url); // Add dummy file path to local_path_. - local_paths_.push_back(std::wstring(L"c:\\dummy.htm")); + local_paths_.push_back(FilePath(FILE_PATH_LITERAL("c:\\dummy.htm"))); // Start serializing DOM. webkit_glue::DomSerializer dom_serializer(web_frame, recursive_serialization, this, links_, local_paths_, @@ -162,10 +162,10 @@ class DomSerializerTests : public TestShellTest, std::vector<GURL> links_; // The local_paths_ contain dummy corresponding local file paths of all saved // links, which matched links_ one by one. - std::vector<std::wstring> local_paths_; + std::vector<FilePath> local_paths_; // The local_directory_name_ is dummy relative path of directory which // contain all saved auxiliary files included all sub frames and resources. - const std::wstring local_directory_name_; + const FilePath local_directory_name_; protected: // testing::Test |