summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjnd@google.com <jnd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 02:58:09 +0000
committerjnd@google.com <jnd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 02:58:09 +0000
commit1a3ebe10ead2ca99d2beb45b9ec65a2863406184 (patch)
treeb1c8b11cc0a32e1f561362ecee1b488bf7d91b15 /webkit
parentaef050626d6412bffa292cbfcee23107cadc4b5d (diff)
downloadchromium_src-1a3ebe10ead2ca99d2beb45b9ec65a2863406184.zip
chromium_src-1a3ebe10ead2ca99d2beb45b9ec65a2863406184.tar.gz
chromium_src-1a3ebe10ead2ca99d2beb45b9ec65a2863406184.tar.bz2
As Brett pointed it out, We normally use 8-bit for encoding names since they're always ASCII. Plus, wstrings will also be 32-bit characters on Linux and Mac, which is expensive. So I make this CL by using std::string instead of std::wstring every time you have an encoding name.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1144 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/context_menu_client_impl.cc6
-rw-r--r--webkit/glue/webview.h4
-rw-r--r--webkit/glue/webview_delegate.h2
-rw-r--r--webkit/glue/webview_impl.cc8
-rw-r--r--webkit/glue/webview_impl.h4
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc2
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h2
7 files changed, 14 insertions, 14 deletions
diff --git a/webkit/glue/context_menu_client_impl.cc b/webkit/glue/context_menu_client_impl.cc
index ea6d800..1db2c18 100644
--- a/webkit/glue/context_menu_client_impl.cc
+++ b/webkit/glue/context_menu_client_impl.cc
@@ -184,7 +184,7 @@ WebCore::PlatformMenuDescription
GURL frame_url;
GURL page_url;
- std::wstring frame_encoding;
+ std::string frame_encoding;
// Send the frame and page URLs in any case.
ContextNode::Type frame_type = ContextNode::NONE;
ContextNode::Type page_type =
@@ -195,8 +195,8 @@ WebCore::PlatformMenuDescription
frame_type = GetTypeAndURLFromFrame(selected_frame,
&frame_url,
ContextNode::FRAME);
- frame_encoding = webkit_glue::StringToStdWString(
- selected_frame->loader()->encoding());
+ frame_encoding = WideToUTF8(
+ webkit_glue::StringToStdWString(selected_frame->loader()->encoding()));
}
if (type == ContextNode::NONE) {
diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h
index 9f44769..78feaa9 100644
--- a/webkit/glue/webview.h
+++ b/webkit/glue/webview.h
@@ -169,10 +169,10 @@ class WebView : public WebWidget {
// Set the encoding of the current main frame. The value comes from
// the encoding menu. WebKit uses the function named
// SetCustomTextEncodingName to do override encoding job.
- virtual void SetPageEncoding(const std::wstring& encoding_name) = 0;
+ virtual void SetPageEncoding(const std::string& encoding_name) = 0;
// Return the canonical encoding name of current main webframe in webview.
- virtual std::wstring GetMainFrameEncodingName() = 0;
+ virtual std::string GetMainFrameEncodingName() = 0;
// Change the text zoom level. Text size is made 20% larger or smaller.
virtual void MakeTextLarger() = 0;
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index 7160c0f..0c28599 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -567,7 +567,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
const std::wstring& selection_text,
const std::wstring& misspelled_word,
int edit_flags,
- const std::wstring& frame_encoding) {
+ const std::string& frame_encoding) {
}
// Starts a drag session with the supplied contextual information.
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 3882c4a..bad4d06 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -1093,7 +1093,7 @@ const WebPreferences& WebViewImpl::GetPreferences() {
// Set the encoding of the current main frame to the one selected by
// a user in the encoding menu.
-void WebViewImpl::SetPageEncoding(const std::wstring& encoding_name) {
+void WebViewImpl::SetPageEncoding(const std::string& encoding_name) {
if (!main_frame_)
return;
@@ -1105,12 +1105,12 @@ void WebViewImpl::SetPageEncoding(const std::wstring& encoding_name) {
}
// Return the canonical encoding name of current main webframe in webview.
-std::wstring WebViewImpl::GetMainFrameEncodingName() {
+std::string WebViewImpl::GetMainFrameEncodingName() {
if (!main_frame_)
- return std::wstring(L"");
+ return std::string();
String encoding_name = main_frame_->frame()->loader()->encoding();
- return std::wstring(encoding_name.charactersWithNullTermination());
+ return WideToUTF8(webkit_glue::StringToStdWString(encoding_name));
}
void WebViewImpl::MakeTextLarger() {
diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h
index 57b18b6..fd5ea8a 100644
--- a/webkit/glue/webview_impl.h
+++ b/webkit/glue/webview_impl.h
@@ -102,8 +102,8 @@ class WebViewImpl : public WebView,
virtual bool DownloadImage(int id, const GURL& image_url, int image_size);
virtual void SetPreferences(const WebPreferences& preferences);
virtual const WebPreferences& GetPreferences();
- virtual void SetPageEncoding(const std::wstring& encoding_name);
- virtual std::wstring GetMainFrameEncodingName();
+ virtual void SetPageEncoding(const std::string& encoding_name);
+ virtual std::string GetMainFrameEncodingName();
virtual void MakeTextLarger();
virtual void MakeTextSmaller();
virtual void MakeTextStandardSize();
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 92959f6..e111877 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -508,7 +508,7 @@ void TestWebViewDelegate::ShowContextMenu(WebView* webview,
const std::wstring& selection_text,
const std::wstring& misspelled_word,
int edit_flags,
- const std::wstring& frame_encoding) {
+ const std::string& frame_encoding) {
CapturedContextMenuEvent context(type, x, y);
captured_context_menu_events_.push_back(context);
}
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index e21ee53..ee1a4f9 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -116,7 +116,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, public
const std::wstring& selection_text,
const std::wstring& misspelled_word,
int edit_flags,
- const std::wstring& frame_encoding);
+ const std::string& frame_encoding);
virtual void DidStartProvisionalLoadForFrame(
WebView* webview,
WebFrame* frame,