diff options
author | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 04:36:34 +0000 |
---|---|---|
committer | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-23 04:36:34 +0000 |
commit | bb0e79474b4a2a50643901aae666a9e67ae9da8d (patch) | |
tree | e28e0c8988f303e44024df880d8735ac4a895e87 /webkit | |
parent | a0100c9d99acc92d6801f8d113873898e004e4d9 (diff) | |
download | chromium_src-bb0e79474b4a2a50643901aae666a9e67ae9da8d.zip chromium_src-bb0e79474b4a2a50643901aae666a9e67ae9da8d.tar.gz chromium_src-bb0e79474b4a2a50643901aae666a9e67ae9da8d.tar.bz2 |
webkit: Move FilePath/WebString conversion functions from 'glue' to 'base'
Add new files file_path_string_conversions.h/cc.
'dom_storage' no longer depends on 'glue'
Function declarations of RemoveForDataFromHistoryState(), RemovePasswordDataFromHistoryState(), RemoveScrollOffsetFromHistoryState(), CreateHistoryStateForURL() are moved from webkit_glue.h to glue_serialize.h. (This move is needed to export these functions without including webkit_glue.h from glue_serialize.cc)
BUG=157095
TEST=build
Review URL: https://chromiumcodereview.appspot.com/11232035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
20 files changed, 193 insertions, 163 deletions
diff --git a/webkit/base/file_path_string_conversions.cc b/webkit/base/file_path_string_conversions.cc new file mode 100644 index 0000000..ccca1b0 --- /dev/null +++ b/webkit/base/file_path_string_conversions.cc @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/base/file_path_string_conversions.h" + +#include "base/sys_string_conversions.h" +#include "base/utf_string_conversions.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" + +namespace webkit_base { + +FilePath::StringType WebStringToFilePathString(const WebKit::WebString& str) { +#if defined(OS_POSIX) + return base::SysWideToNativeMB(UTF16ToWideHack(str)); +#elif defined(OS_WIN) + return UTF16ToWideHack(str); +#endif +} + +WebKit::WebString FilePathStringToWebString(const FilePath::StringType& str) { +#if defined(OS_POSIX) + return WideToUTF16Hack(base::SysNativeMBToWide(str)); +#elif defined(OS_WIN) + return WideToUTF16Hack(str); +#endif +} + +FilePath WebStringToFilePath(const WebKit::WebString& str) { + return FilePath(WebStringToFilePathString(str)); +} + +WebKit::WebString FilePathToWebString(const FilePath& file_path) { + return FilePathStringToWebString(file_path.value()); +} + +} // namespace webkit_base diff --git a/webkit/base/file_path_string_conversions.h b/webkit/base/file_path_string_conversions.h new file mode 100644 index 0000000..902a881 --- /dev/null +++ b/webkit/base/file_path_string_conversions.h @@ -0,0 +1,27 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_BASE_FILE_PATH_STRING_CONVERSIONS_H_ +#define WEBKIT_BASE_FILE_PATH_STRING_CONVERSIONS_H_ + +#include "base/file_path.h" +#include "webkit/base/webkit_base_export.h" + +namespace WebKit { +class WebString; +} + +namespace webkit_base { + +WEBKIT_BASE_EXPORT FilePath::StringType WebStringToFilePathString( + const WebKit::WebString& str); +WEBKIT_BASE_EXPORT WebKit::WebString FilePathStringToWebString( + const FilePath::StringType& str); +WEBKIT_BASE_EXPORT FilePath WebStringToFilePath(const WebKit::WebString& str); +WEBKIT_BASE_EXPORT WebKit::WebString FilePathToWebString( + const FilePath& file_path); + +} // namespace webkit_base + +#endif // WEBKIT_BASE_FILE_PATH_STRING_CONVERSIONS_H_ diff --git a/webkit/base/webkit_base.gypi b/webkit/base/webkit_base.gypi index cf10301..c0c43a3 100644 --- a/webkit/base/webkit_base.gypi +++ b/webkit/base/webkit_base.gypi @@ -18,6 +18,8 @@ 'sources': [ 'data_element.cc', 'data_element.h', + 'file_path_string_conversions.cc', + 'file_path_string_conversions.h', 'webkit_base_export.h', ], 'conditions': [ diff --git a/webkit/dom_storage/dom_storage_area.cc b/webkit/dom_storage/dom_storage_area.cc index 74635b7..c72b107 100644 --- a/webkit/dom_storage/dom_storage_area.cc +++ b/webkit/dom_storage/dom_storage_area.cc @@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/time.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/database/database_util.h" #include "webkit/dom_storage/dom_storage_map.h" #include "webkit/dom_storage/dom_storage_namespace.h" @@ -18,7 +19,6 @@ #include "webkit/dom_storage/session_storage_database.h" #include "webkit/dom_storage/session_storage_database_adapter.h" #include "webkit/fileapi/file_system_util.h" -#include "webkit/glue/webkit_glue.h" using webkit_database::DatabaseUtil; @@ -50,7 +50,7 @@ FilePath DomStorageArea::DatabaseFileNameFromOrigin(const GURL& origin) { // static GURL DomStorageArea::OriginFromDatabaseFileName(const FilePath& name) { DCHECK(name.MatchesExtension(kDatabaseFileExtension)); - WebKit::WebString origin_id = webkit_glue::FilePathToWebString( + WebKit::WebString origin_id = webkit_base::FilePathToWebString( name.BaseName().RemoveExtension()); return DatabaseUtil::GetOriginFromIdentifier(origin_id); } diff --git a/webkit/dom_storage/webkit_dom_storage.gypi b/webkit/dom_storage/webkit_dom_storage.gypi index 5ef65b9..40079fa 100644 --- a/webkit/dom_storage/webkit_dom_storage.gypi +++ b/webkit/dom_storage/webkit_dom_storage.gypi @@ -16,9 +16,9 @@ '<(DEPTH)/third_party/sqlite/sqlite.gyp:sqlite', '<(DEPTH)/webkit/support/webkit_support.gyp:database', '<(DEPTH)/webkit/support/webkit_support.gyp:quota', + '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_base', + '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_storage', '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit', - 'glue', - 'webkit_storage', ], 'sources': [ 'dom_storage_area.cc', diff --git a/webkit/glue/dom_serializer_unittest.cc b/webkit/glue/dom_serializer_unittest.cc index c036e63..dcce6c3 100644 --- a/webkit/glue/dom_serializer_unittest.cc +++ b/webkit/glue/dom_serializer_unittest.cc @@ -24,8 +24,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/glue/dom_operations.h" -#include "webkit/glue/webkit_glue.h" #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" #include "webkit/tools/test_shell/test_shell_test.h" @@ -175,7 +175,7 @@ class DomSerializerTests : public TestShellTest, // Add input file URl to links_. links_.assign(&page_url,1); // Add dummy file path to local_path_. - WebString file_path = webkit_glue::FilePathStringToWebString( + WebString file_path = webkit_base::FilePathStringToWebString( FILE_PATH_LITERAL("c:\\dummy.htm")); local_paths_.assign(&file_path, 1); // Start serializing DOM. @@ -184,7 +184,7 @@ class DomSerializerTests : public TestShellTest, static_cast<WebPageSerializerClient*>(this), links_, local_paths_, - webkit_glue::FilePathToWebString(local_directory_name_)); + webkit_base::FilePathToWebString(local_directory_name_)); ASSERT_TRUE(result); ASSERT_TRUE(serialized_); } diff --git a/webkit/glue/glue_serialize.cc b/webkit/glue/glue_serialize.cc index 9993b1a..c742952 100644 --- a/webkit/glue/glue_serialize.cc +++ b/webkit/glue/glue_serialize.cc @@ -17,7 +17,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" -#include "webkit/glue/webkit_glue.h" +#include "webkit/base/file_path_string_conversions.h" using WebKit::WebData; using WebKit::WebHistoryItem; @@ -492,8 +492,63 @@ WebHistoryItem HistoryItemFromString( static_cast<int>(serialized_item.length())); return ReadHistoryItem(&obj, include_form_data, include_scroll_offset); } + } // namespace +// Serialize a HistoryItem to a string, using our JSON Value serializer. +std::string HistoryItemToString(const WebHistoryItem& item) { + if (item.isNull()) + return std::string(); + + SerializeObject obj; + WriteHistoryItem(item, &obj); + return obj.GetAsString(); +} + +WebHistoryItem HistoryItemFromString(const std::string& serialized_item) { + return HistoryItemFromString(serialized_item, ALWAYS_INCLUDE_FORM_DATA, true); +} + +std::vector<FilePath> FilePathsFromHistoryState( + const std::string& content_state) { + std::vector<FilePath> to_return; + // TODO(darin): We should avoid using the WebKit API here, so that we do not + // need to have WebKit initialized before calling this method. + const WebHistoryItem& item = + HistoryItemFromString(content_state, ALWAYS_INCLUDE_FORM_DATA, true); + if (item.isNull()) { + // Couldn't parse the string. + return to_return; + } + const WebVector<WebString> file_paths = item.getReferencedFilePaths(); + for (size_t i = 0; i < file_paths.size(); ++i) + to_return.push_back(webkit_base::WebStringToFilePath(file_paths[i])); + return to_return; +} + +// For testing purposes only. +void HistoryItemToVersionedString(const WebHistoryItem& item, int version, + std::string* serialized_item) { + if (item.isNull()) { + serialized_item->clear(); + return; + } + + // Temporarily change the version. + int real_version = kVersion; + kVersion = version; + + SerializeObject obj; + WriteHistoryItem(item, &obj); + *serialized_item = obj.GetAsString(); + + kVersion = real_version; +} + +int HistoryItemCurrentVersion() { + return kVersion; +} + std::string RemoveFormDataFromHistoryState(const std::string& content_state) { // TODO(darin): We should avoid using the WebKit API here, so that we do not // need to have WebKit initialized before calling this method. @@ -548,58 +603,4 @@ std::string CreateHistoryStateForURL(const GURL& url) { return obj.GetAsString(); } -// Serialize a HistoryItem to a string, using our JSON Value serializer. -std::string HistoryItemToString(const WebHistoryItem& item) { - if (item.isNull()) - return std::string(); - - SerializeObject obj; - WriteHistoryItem(item, &obj); - return obj.GetAsString(); -} - -WebHistoryItem HistoryItemFromString(const std::string& serialized_item) { - return HistoryItemFromString(serialized_item, ALWAYS_INCLUDE_FORM_DATA, true); -} - -std::vector<FilePath> FilePathsFromHistoryState( - const std::string& content_state) { - std::vector<FilePath> to_return; - // TODO(darin): We should avoid using the WebKit API here, so that we do not - // need to have WebKit initialized before calling this method. - const WebHistoryItem& item = - HistoryItemFromString(content_state, ALWAYS_INCLUDE_FORM_DATA, true); - if (item.isNull()) { - // Couldn't parse the string. - return to_return; - } - const WebVector<WebString> file_paths = item.getReferencedFilePaths(); - for (size_t i = 0; i < file_paths.size(); ++i) - to_return.push_back(WebStringToFilePath(file_paths[i])); - return to_return; -} - -// For testing purposes only. -void HistoryItemToVersionedString(const WebHistoryItem& item, int version, - std::string* serialized_item) { - if (item.isNull()) { - serialized_item->clear(); - return; - } - - // Temporarily change the version. - int real_version = kVersion; - kVersion = version; - - SerializeObject obj; - WriteHistoryItem(item, &obj); - *serialized_item = obj.GetAsString(); - - kVersion = real_version; -} - -int HistoryItemCurrentVersion() { - return kVersion; -} - } // namespace webkit_glue diff --git a/webkit/glue/glue_serialize.h b/webkit/glue/glue_serialize.h index e1e8259..ac869a9 100644 --- a/webkit/glue/glue_serialize.h +++ b/webkit/glue/glue_serialize.h @@ -16,6 +16,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" #include "webkit/glue/webkit_glue_export.h" +class GURL; + namespace webkit_glue { // HistoryItem serialization. @@ -36,6 +38,24 @@ WEBKIT_GLUE_EXPORT void HistoryItemToVersionedString( std::string* serialized_item); WEBKIT_GLUE_EXPORT int HistoryItemCurrentVersion(); +// Removes any form data state from the history state string |content_state|. +WEBKIT_GLUE_EXPORT std::string RemoveFormDataFromHistoryState( + const std::string& content_state); + +// Removes form data containing passwords from the history state string +// |content_state|. +WEBKIT_GLUE_EXPORT std::string RemovePasswordDataFromHistoryState( + const std::string& content_state); + +// Removes scroll offset from the history state string |content_state|. +WEBKIT_GLUE_EXPORT std::string RemoveScrollOffsetFromHistoryState( + const std::string& content_state); + +// Creates serialized state for the specified URL. This is a variant of +// HistoryItemToString (in glue_serialize) that is used during session restore +// if the saved state is empty. +WEBKIT_GLUE_EXPORT std::string CreateHistoryStateForURL(const GURL& url); + } // namespace webkit_glue #endif // #ifndef WEBKIT_GLUE_GLUE_SERIALIZE_H_ diff --git a/webkit/glue/glue_serialize_unittest.cc b/webkit/glue/glue_serialize_unittest.cc index 306a0f5..cb77a30 100644 --- a/webkit/glue/glue_serialize_unittest.cc +++ b/webkit/glue/glue_serialize_unittest.cc @@ -10,8 +10,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/glue/glue_serialize.h" -#include "webkit/glue/webkit_glue.h" #include "webkit/glue/web_io_operators.h" using WebKit::WebData; @@ -269,8 +269,8 @@ TEST_F(GlueSerializeTest, FilePathsFromHistoryState) { FilePath file_path2(FILE_PATH_LITERAL("another_file")); WebHTTPBody http_body; http_body.initialize(); - http_body.appendFile(webkit_glue::FilePathToWebString(file_path1)); - http_body.appendFile(webkit_glue::FilePathToWebString(file_path2)); + http_body.appendFile(webkit_base::FilePathToWebString(file_path1)); + http_body.appendFile(webkit_base::FilePathToWebString(file_path2)); item.setHTTPBody(http_body); std::string serialized_item = webkit_glue::HistoryItemToString(item); diff --git a/webkit/glue/simple_webmimeregistry_impl.cc b/webkit/glue/simple_webmimeregistry_impl.cc index bffc96f..73ba6f85 100644 --- a/webkit/glue/simple_webmimeregistry_impl.cc +++ b/webkit/glue/simple_webmimeregistry_impl.cc @@ -9,7 +9,7 @@ #include "base/utf_string_conversions.h" #include "net/base/mime_util.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" -#include "webkit/glue/webkit_glue.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/media/crypto/key_systems.h" using WebKit::WebString; @@ -115,8 +115,8 @@ WebMimeRegistry::SupportsType WebString SimpleWebMimeRegistryImpl::mimeTypeForExtension( const WebString& file_extension) { std::string mime_type; - net::GetMimeTypeFromExtension(WebStringToFilePathString(file_extension), - &mime_type); + net::GetMimeTypeFromExtension( + webkit_base::WebStringToFilePathString(file_extension), &mime_type); return ASCIIToUTF16(mime_type); } @@ -124,14 +124,14 @@ WebString SimpleWebMimeRegistryImpl::wellKnownMimeTypeForExtension( const WebString& file_extension) { std::string mime_type; net::GetWellKnownMimeTypeFromExtension( - WebStringToFilePathString(file_extension), &mime_type); + webkit_base::WebStringToFilePathString(file_extension), &mime_type); return ASCIIToUTF16(mime_type); } WebString SimpleWebMimeRegistryImpl::mimeTypeFromFile( const WebString& file_path) { std::string mime_type; - net::GetMimeTypeFromFile(FilePath(WebStringToFilePathString(file_path)), + net::GetMimeTypeFromFile(webkit_base::WebStringToFilePath(file_path), &mime_type); return ASCIIToUTF16(mime_type); } @@ -141,7 +141,7 @@ WebString SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType( FilePath::StringType file_extension; net::GetPreferredExtensionForMimeType(ToASCIIOrEmpty(mime_type), &file_extension); - return FilePathStringToWebString(file_extension); + return webkit_base::FilePathStringToWebString(file_extension); } } // namespace webkit_glue diff --git a/webkit/glue/webfileutilities_impl.cc b/webkit/glue/webfileutilities_impl.cc index 56b5944..835c37e 100644 --- a/webkit/glue/webfileutilities_impl.cc +++ b/webkit/glue/webfileutilities_impl.cc @@ -12,6 +12,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileInfo.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/glue/webkit_glue.h" using WebKit::WebString; @@ -26,8 +27,8 @@ WebFileUtilitiesImpl::~WebFileUtilitiesImpl() { } bool WebFileUtilitiesImpl::fileExists(const WebString& path) { - FilePath::StringType file_path = WebStringToFilePathString(path); - return file_util::PathExists(FilePath(file_path)); + FilePath file_path = webkit_base::WebStringToFilePath(path); + return file_util::PathExists(file_path); } bool WebFileUtilitiesImpl::deleteFile(const WebString& path) { @@ -47,7 +48,8 @@ bool WebFileUtilitiesImpl::getFileInfo(const WebString& path, return false; } base::PlatformFileInfo file_info; - if (!file_util::GetFileInfo(WebStringToFilePath(path), &file_info)) + if (!file_util::GetFileInfo(webkit_base::WebStringToFilePath(path), + &file_info)) return false; webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info); @@ -56,38 +58,38 @@ bool WebFileUtilitiesImpl::getFileInfo(const WebString& path, } WebString WebFileUtilitiesImpl::directoryName(const WebString& path) { - FilePath file_path(WebStringToFilePathString(path)); - return FilePathToWebString(file_path.DirName()); + FilePath file_path(webkit_base::WebStringToFilePath(path)); + return webkit_base::FilePathToWebString(file_path.DirName()); } WebString WebFileUtilitiesImpl::pathByAppendingComponent( const WebString& webkit_path, const WebString& webkit_component) { - FilePath path(WebStringToFilePathString(webkit_path)); - FilePath component(WebStringToFilePathString(webkit_component)); + FilePath path(webkit_base::WebStringToFilePath(webkit_path)); + FilePath component(webkit_base::WebStringToFilePath(webkit_component)); FilePath combined_path = path.Append(component); - return FilePathStringToWebString(combined_path.value()); + return webkit_base::FilePathStringToWebString(combined_path.value()); } bool WebFileUtilitiesImpl::makeAllDirectories(const WebString& path) { DCHECK(!sandbox_enabled_); - FilePath::StringType file_path = WebStringToFilePathString(path); - return file_util::CreateDirectory(FilePath(file_path)); + FilePath file_path = webkit_base::WebStringToFilePath(path); + return file_util::CreateDirectory(file_path); } WebString WebFileUtilitiesImpl::getAbsolutePath(const WebString& path) { - FilePath file_path(WebStringToFilePathString(path)); + FilePath file_path(webkit_base::WebStringToFilePath(path)); file_util::AbsolutePath(&file_path); - return FilePathStringToWebString(file_path.value()); + return webkit_base::FilePathStringToWebString(file_path.value()); } bool WebFileUtilitiesImpl::isDirectory(const WebString& path) { - FilePath file_path(WebStringToFilePathString(path)); + FilePath file_path(webkit_base::WebStringToFilePath(path)); return file_util::DirectoryExists(file_path); } WebKit::WebURL WebFileUtilitiesImpl::filePathToURL(const WebString& path) { - return net::FilePathToFileURL(WebStringToFilePath(path)); + return net::FilePathToFileURL(webkit_base::WebStringToFilePath(path)); } base::PlatformFile WebFileUtilitiesImpl::openFile(const WebString& path, @@ -97,7 +99,7 @@ base::PlatformFile WebFileUtilitiesImpl::openFile(const WebString& path, return base::kInvalidPlatformFileValue; } return base::CreatePlatformFile( - WebStringToFilePath(path), + webkit_base::WebStringToFilePath(path), (mode == 0) ? (base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ) : (base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_WRITE), diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index cd14f45..6dcca02 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -21,7 +21,6 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "base/sys_info.h" -#include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" #include "net/base/escape.h" #include "net/url_request/url_request.h" @@ -273,35 +272,6 @@ bool DecodeImage(const std::string& image_data, SkBitmap* image) { return true; } -// NOTE: This pair of conversion functions are here instead of in glue_util.cc -// since that file will eventually die. This pair of functions will need to -// remain as the concept of a file-path specific character encoding string type -// will most likely not make its way into WebKit. - -FilePath::StringType WebStringToFilePathString(const WebString& str) { -#if defined(OS_POSIX) - return base::SysWideToNativeMB(UTF16ToWideHack(str)); -#elif defined(OS_WIN) - return UTF16ToWideHack(str); -#endif -} - -WebString FilePathStringToWebString(const FilePath::StringType& str) { -#if defined(OS_POSIX) - return WideToUTF16Hack(base::SysNativeMBToWide(str)); -#elif defined(OS_WIN) - return WideToUTF16Hack(str); -#endif -} - -FilePath WebStringToFilePath(const WebString& str) { - return FilePath(WebStringToFilePathString(str)); -} - -WebString FilePathToWebString(const FilePath& file_path) { - return FilePathStringToWebString(file_path.value()); -} - void PlatformFileInfoToWebFileInfo( const base::PlatformFileInfo& file_info, WebKit::WebFileInfo* web_file_info) { diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index b7f9035..c166c72 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -14,14 +14,12 @@ #include <string> #include <vector> -#include "base/file_path.h" #include "base/platform_file.h" #include "base/string16.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebReferrerPolicy.h" #include "webkit/glue/webkit_glue_export.h" -class GURL; class SkBitmap; namespace net { @@ -35,7 +33,6 @@ class PlatformCanvas; namespace WebKit { struct WebFileInfo; class WebFrame; -class WebString; } namespace webkit_glue { @@ -76,24 +73,6 @@ WEBKIT_GLUE_EXPORT string16 DumpHistoryState(const std::string& history_state, int indent, bool is_current); -// Creates serialized state for the specified URL. This is a variant of -// HistoryItemToString (in glue_serialize) that is used during session restore -// if the saved state is empty. -WEBKIT_GLUE_EXPORT std::string CreateHistoryStateForURL(const GURL& url); - -// Removes any form data state from the history state string |content_state|. -WEBKIT_GLUE_EXPORT std::string RemoveFormDataFromHistoryState( - const std::string& content_state); - -// Removes form data containing passwords from the history state string -// |content_state|. -WEBKIT_GLUE_EXPORT std::string RemovePasswordDataFromHistoryState( - const std::string& content_state); - -// Removes scroll offset from the history state string |content_state|. -WEBKIT_GLUE_EXPORT std::string RemoveScrollOffsetFromHistoryState( - const std::string& content_state); - #ifndef NDEBUG // Checks various important objects to see if there are any in memory, and // calls AppendToLog with any leaked objects. Designed to be called on @@ -114,15 +93,6 @@ void SetForcefullyTerminatePluginProcess(bool value); // instead of exiting cleanly. WEBKIT_GLUE_EXPORT bool ShouldForcefullyTerminatePluginProcess(); -// File path string conversions. -WEBKIT_GLUE_EXPORT FilePath::StringType WebStringToFilePathString( - const WebKit::WebString& str); -WEBKIT_GLUE_EXPORT WebKit::WebString FilePathStringToWebString( - const FilePath::StringType& str); -WEBKIT_GLUE_EXPORT FilePath WebStringToFilePath(const WebKit::WebString& str); -WEBKIT_GLUE_EXPORT WebKit::WebString FilePathToWebString( - const FilePath& file_path); - // File info conversion WEBKIT_GLUE_EXPORT void PlatformFileInfoToWebFileInfo( const base::PlatformFileInfo& file_info, diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc index 6089dd1..547d830 100644 --- a/webkit/glue/webkitplatformsupport_impl.cc +++ b/webkit/glue/webkitplatformsupport_impl.cc @@ -40,8 +40,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "ui/base/layout.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/compositor_bindings/web_compositor_support_impl.h" -#include "webkit/glue/webkit_glue.h" #include "webkit/glue/websocketstreamhandle_impl.h" #include "webkit/glue/webthread_impl.h" #include "webkit/glue/weburlloader_impl.h" @@ -307,7 +307,7 @@ void WebKitPlatformSupportImpl::getPluginList(bool refresh, builder->addPlugin( plugin.name, plugin.desc, - FilePathStringToWebString(plugin.path.BaseName().value())); + webkit_base::FilePathStringToWebString(plugin.path.BaseName().value())); for (size_t j = 0; j < plugin.mime_types.size(); ++j) { const webkit::WebPluginMimeType& mime_type = plugin.mime_types[j]; diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc index 7606719..aed0318 100644 --- a/webkit/glue/weburlloader_impl.cc +++ b/webkit/glue/weburlloader_impl.cc @@ -29,11 +29,11 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/glue/ftp_directory_listing_response_delegate.h" #include "webkit/glue/multipart_response_delegate.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/resource_request_body.h" -#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkitplatformsupport_impl.h" #include "webkit/glue/weburlrequest_extradata_impl.h" #include "webkit/glue/weburlresponse_extradata_impl.h" @@ -174,7 +174,8 @@ void PopulateURLResponse( response->setRemotePort(info.socket_address.port()); response->setConnectionID(info.connection_id); response->setConnectionReused(info.connection_reused); - response->setDownloadFilePath(FilePathToWebString(info.download_file_path)); + response->setDownloadFilePath( + webkit_base::FilePathToWebString(info.download_file_path)); response->setExtraData(new WebURLResponseExtraDataImpl( info.npn_negotiated_protocol)); @@ -459,11 +460,11 @@ void WebURLLoaderImpl::Context::Start( case WebHTTPBody::Element::TypeFile: if (element.fileLength == -1) { request_body->AppendFileRange( - WebStringToFilePath(element.filePath), + webkit_base::WebStringToFilePath(element.filePath), 0, kuint64max, base::Time()); } else { request_body->AppendFileRange( - WebStringToFilePath(element.filePath), + webkit_base::WebStringToFilePath(element.filePath), static_cast<uint64>(element.fileStart), static_cast<uint64>(element.fileLength), base::Time::FromDoubleT(element.modificationTime)); diff --git a/webkit/plugins/ppapi/ppb_url_response_info_impl.cc b/webkit/plugins/ppapi/ppb_url_response_info_impl.cc index 8939719..d5c80ce 100644 --- a/webkit/plugins/ppapi/ppb_url_response_info_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_response_info_impl.cc @@ -11,11 +11,11 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" #include "webkit/plugins/ppapi/resource_helper.h" -#include "webkit/glue/webkit_glue.h" using ppapi::StringVar; using ppapi::thunk::PPB_URLResponseInfo_API; @@ -75,7 +75,7 @@ bool PPB_URLResponseInfo_Impl::Initialize(const WebURLResponse& response) { if (!file_path.isEmpty()) { body_ = PPB_FileRef_Impl::CreateExternal( pp_instance(), - webkit_glue::WebStringToFilePath(file_path), + webkit_base::WebStringToFilePath(file_path), std::string()); } return true; @@ -116,4 +116,3 @@ PP_Resource PPB_URLResponseInfo_Impl::GetBodyAsFileRef() { } // namespace ppapi } // namespace webkit - diff --git a/webkit/plugins/ppapi/url_request_info_util.cc b/webkit/plugins/ppapi/url_request_info_util.cc index 1361acb..a99c8f4 100644 --- a/webkit/plugins/ppapi/url_request_info_util.cc +++ b/webkit/plugins/ppapi/url_request_info_util.cc @@ -18,7 +18,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" -#include "webkit/glue/webkit_glue.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/glue/weburlrequest_extradata_impl.h" #include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/plugin_module.h" @@ -80,7 +80,7 @@ bool AppendFileRefToBody( NOTREACHED(); } http_body->appendFileRange( - webkit_glue::FilePathToWebString(platform_path), + webkit_base::FilePathToWebString(platform_path), start_offset, number_of_bytes, expected_last_modified_time); diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index 166acab..97b963d 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -49,6 +49,7 @@ #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface.h" #include "webkit/appcache/web_application_cache_host_impl.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/fileapi/isolated_context.h" #include "webkit/glue/webkit_constants.h" #include "webkit/glue/webkit_glue.h" @@ -841,7 +842,7 @@ WebKit::WebString RegisterIsolatedFileSystem( const WebKit::WebVector<WebKit::WebString>& filenames) { fileapi::IsolatedContext::FileInfoSet files; for (size_t i = 0; i < filenames.size(); ++i) { - FilePath path = webkit_glue::WebStringToFilePath(filenames[i]); + FilePath path = webkit_base::WebStringToFilePath(filenames[i]); files.AddPath(path, NULL); } std::string filesystemId = diff --git a/webkit/tools/test_shell/simple_file_system.cc b/webkit/tools/test_shell/simple_file_system.cc index e5434e9..80d0c3c 100644 --- a/webkit/tools/test_shell/simple_file_system.cc +++ b/webkit/tools/test_shell/simple_file_system.cc @@ -20,12 +20,12 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/blob/blob_storage_controller.h" #include "webkit/fileapi/file_system_task_runners.h" #include "webkit/fileapi/file_system_url.h" #include "webkit/fileapi/file_system_util.h" #include "webkit/fileapi/mock_file_system_options.h" -#include "webkit/glue/webkit_glue.h" #include "webkit/tools/test_shell/simple_file_writer.h" using base::WeakPtr; @@ -330,7 +330,7 @@ void SimpleFileSystem::DidGetMetadata(WebFileSystemCallbacks* callbacks, web_file_info.type = info.is_directory ? WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; web_file_info.platformPath = - webkit_glue::FilePathToWebString(platform_path); + webkit_base::FilePathToWebString(platform_path); callbacks->didReadMetadata(web_file_info); } else { callbacks->didFail(fileapi::PlatformFileErrorToWebFileError(result)); @@ -347,7 +347,7 @@ void SimpleFileSystem::DidReadDirectory( for (std::vector<base::FileUtilProxy::Entry>::const_iterator it = entries.begin(); it != entries.end(); ++it) { WebFileSystemEntry entry; - entry.name = webkit_glue::FilePathStringToWebString(it->name); + entry.name = webkit_base::FilePathStringToWebString(it->name); entry.isDirectory = it->is_directory; web_entries_vector.push_back(entry); } diff --git a/webkit/tools/test_shell/test_shell_webblobregistry_impl.cc b/webkit/tools/test_shell/test_shell_webblobregistry_impl.cc index fe1a7e4..41963dd 100644 --- a/webkit/tools/test_shell/test_shell_webblobregistry_impl.cc +++ b/webkit/tools/test_shell/test_shell_webblobregistry_impl.cc @@ -9,9 +9,9 @@ #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebBlobData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" +#include "webkit/base/file_path_string_conversions.h" #include "webkit/blob/blob_data.h" #include "webkit/blob/blob_storage_controller.h" -#include "webkit/glue/webkit_glue.h" using WebKit::WebBlobData; using WebKit::WebURL; @@ -39,7 +39,7 @@ BlobData* NewBlobData(const WebBlobData& data) { case WebBlobData::Item::TypeFile: if (item.length) { blob->AppendFile( - webkit_glue::WebStringToFilePath(item.filePath), + webkit_base::WebStringToFilePath(item.filePath), static_cast<uint64>(item.offset), static_cast<uint64>(item.length), base::Time::FromDoubleT(item.expectedModificationTime)); |