summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 06:21:57 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-17 06:21:57 +0000
commit8980a9c9e8e6b61e3d346e4662e00e0859637ca4 (patch)
treeacb717e4f6ba9ce65ffd10b924ad20a7a7642795 /webkit
parent5e6e939f429310fb37d00421f728ecba11bc030e (diff)
downloadchromium_src-8980a9c9e8e6b61e3d346e4662e00e0859637ca4.zip
chromium_src-8980a9c9e8e6b61e3d346e4662e00e0859637ca4.tar.gz
chromium_src-8980a9c9e8e6b61e3d346e4662e00e0859637ca4.tar.bz2
Introduce WebLocalizedString and queryLocalizedString methods
on WebKitClient. This allows glue/localized_strings.cc to move into the WebKit API implementation. BUG=16933 TEST=none R=dglazkov Review URL: http://codereview.chromium.org/149760 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20938 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/api/public/WebKitClient.h15
-rw-r--r--webkit/api/public/WebLocalizedString.h66
-rw-r--r--webkit/api/src/LocalizedStrings.cpp241
-rw-r--r--webkit/glue/localized_strings.cc193
-rw-r--r--webkit/glue/password_autocomplete_listener.cc6
-rw-r--r--webkit/glue/password_autocomplete_listener.h12
-rw-r--r--webkit/glue/webframe_impl.cc1
-rw-r--r--webkit/glue/webkitclient_impl.cc73
-rw-r--r--webkit/glue/webkitclient_impl.h4
-rw-r--r--webkit/tools/test_shell/test_shell_webkit_init.h10
-rw-r--r--webkit/webkit.gyp3
11 files changed, 412 insertions, 212 deletions
diff --git a/webkit/api/public/WebKitClient.h b/webkit/api/public/WebKitClient.h
index 4de58c3..9721750 100644
--- a/webkit/api/public/WebKitClient.h
+++ b/webkit/api/public/WebKitClient.h
@@ -32,6 +32,7 @@
#define WebKitClient_h
#include "WebCommon.h"
+#include "WebLocalizedString.h"
namespace WebKit {
class WebClipboard;
@@ -61,6 +62,11 @@ namespace WebKit {
virtual WebThemeEngine* themeEngine() = 0;
+ // File ----------------------------------------------------------------
+
+ virtual bool getFileSize(const WebString& path, long long& result) = 0;
+
+
// History -------------------------------------------------------------
// Returns the hash for the given canonicalized URL for use in visited
@@ -82,10 +88,6 @@ namespace WebKit {
// A suggestion to prefetch IP information for the given hostname.
virtual void prefetchHostName(const WebString&) = 0;
- // File ----------------------------------------------------------------
-
- virtual bool getFileSize(const WebString& path, long long& result) = 0;
-
// Returns a new WebURLLoader instance.
virtual WebURLLoader* createURLLoader() = 0;
@@ -113,6 +115,11 @@ namespace WebKit {
// Returns a blob of data corresponding to the named resource.
virtual WebData loadResource(const char* name) = 0;
+ // Returns a localized string resource (with an optional numeric
+ // parameter value).
+ virtual WebString queryLocalizedString(WebLocalizedString::Name) = 0;
+ virtual WebString queryLocalizedString(WebLocalizedString::Name, int numericValue) = 0;
+
// Sudden Termination --------------------------------------------------
diff --git a/webkit/api/public/WebLocalizedString.h b/webkit/api/public/WebLocalizedString.h
new file mode 100644
index 0000000..3e24bf2
--- /dev/null
+++ b/webkit/api/public/WebLocalizedString.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebLocalizedString_h
+#define WebLocalizedString_h
+
+namespace WebKit {
+
+ struct WebLocalizedString {
+ enum Name {
+ SubmitButtonDefaultLabel,
+ InputElementAltText,
+ ResetButtonDefaultLabel,
+ FileButtonChooseFileLabel,
+ FileButtonNoFileSelectedLabel,
+ MultipleFileUploadText,
+ SearchableIndexIntroduction,
+ SearchMenuNoRecentSearchesText,
+ SearchMenuRecentSearchesText,
+ SearchMenuClearRecentSearchesText,
+ AXWebAreaText,
+ AXLinkText,
+ AXListMarkerText,
+ AXImageMapText,
+ AXHeadingText,
+ AXButtonActionVerb,
+ AXRadioButtonActionVerb,
+ AXTextFieldActionVerb,
+ AXCheckedCheckBoxActionVerb,
+ AXUncheckedCheckBoxActionVerb,
+ AXLinkActionVerb,
+ KeygenMenuHighGradeKeySize,
+ KeygenMenuMediumGradeKeySize,
+ };
+ };
+
+} // namespace WebKit
+
+#endif
diff --git a/webkit/api/src/LocalizedStrings.cpp b/webkit/api/src/LocalizedStrings.cpp
new file mode 100644
index 0000000..33faa9b
--- /dev/null
+++ b/webkit/api/src/LocalizedStrings.cpp
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "LocalizedStrings.h"
+
+#include "IntSize.h"
+#include "NotImplemented.h"
+#include "PlatformString.h"
+
+#include "WebKit.h"
+#include "WebKitClient.h"
+#include "WebLocalizedString.h"
+#include "WebString.h"
+
+using WebKit::WebLocalizedString;
+
+namespace WebCore {
+
+static String query(WebLocalizedString::Name name)
+{
+ return WebKit::webKitClient()->queryLocalizedString(name);
+}
+
+static String query(WebLocalizedString::Name name, int numericValue)
+{
+ return WebKit::webKitClient()->queryLocalizedString(name, numericValue);
+}
+
+String searchableIndexIntroduction()
+{
+ return query(WebLocalizedString::SearchableIndexIntroduction);
+}
+
+String submitButtonDefaultLabel()
+{
+ return query(WebLocalizedString::SubmitButtonDefaultLabel);
+}
+
+String inputElementAltText()
+{
+ return query(WebLocalizedString::InputElementAltText);
+}
+
+String resetButtonDefaultLabel()
+{
+ return query(WebLocalizedString::ResetButtonDefaultLabel);
+}
+
+String fileButtonChooseFileLabel()
+{
+ return query(WebLocalizedString::FileButtonChooseFileLabel);
+}
+
+String fileButtonNoFileSelectedLabel()
+{
+ return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
+}
+
+String searchMenuNoRecentSearchesText()
+{
+ return query(WebLocalizedString::SearchMenuNoRecentSearchesText);
+}
+String searchMenuRecentSearchesText()
+{
+ return query(WebLocalizedString::SearchMenuRecentSearchesText);
+}
+String searchMenuClearRecentSearchesText()
+{
+ return query(WebLocalizedString::SearchMenuClearRecentSearchesText);
+}
+
+String AXWebAreaText()
+{
+ return query(WebLocalizedString::AXWebAreaText);
+}
+
+String AXLinkText()
+{
+ return query(WebLocalizedString::AXLinkText);
+}
+
+String AXListMarkerText()
+{
+ return query(WebLocalizedString::AXListMarkerText);
+}
+
+String AXImageMapText()
+{
+ return query(WebLocalizedString::AXImageMapText);
+}
+
+String AXHeadingText()
+{
+ return query(WebLocalizedString::AXHeadingText);
+}
+
+String AXDefinitionListTermText()
+{
+ notImplemented();
+ return String("term");
+}
+
+String AXDefinitionListDefinitionText()
+{
+ notImplemented();
+ return String("definition");
+}
+
+String AXButtonActionVerb()
+{
+ return query(WebLocalizedString::AXButtonActionVerb);
+}
+
+String AXRadioButtonActionVerb()
+{
+ return query(WebLocalizedString::AXRadioButtonActionVerb);
+}
+
+String AXTextFieldActionVerb()
+{
+ return query(WebLocalizedString::AXTextFieldActionVerb);
+}
+
+String AXCheckedCheckBoxActionVerb()
+{
+ return query(WebLocalizedString::AXCheckedCheckBoxActionVerb);
+}
+
+String AXUncheckedCheckBoxActionVerb()
+{
+ return query(WebLocalizedString::AXUncheckedCheckBoxActionVerb);
+}
+
+String AXLinkActionVerb()
+{
+ return query(WebLocalizedString::AXLinkActionVerb);
+}
+
+String multipleFileUploadText(unsigned numberOfFiles)
+{
+ return query(WebLocalizedString::MultipleFileUploadText, numberOfFiles);
+}
+
+// Used in FTPDirectoryDocument.cpp
+String unknownFileSizeText()
+{
+ return String();
+}
+
+// The following two functions are not declared in LocalizedStrings.h.
+// They are used by the menu for the HTML keygen tag.
+String keygenMenuHighGradeKeySize()
+{
+ return query(WebLocalizedString::KeygenMenuHighGradeKeySize);
+}
+
+String keygenMenuMediumGradeKeySize()
+{
+ return query(WebLocalizedString::KeygenMenuMediumGradeKeySize);
+}
+
+// Used in ImageDocument.cpp as the title for pages when that page is an image.
+String imageTitle(const String& filename, const IntSize& size)
+{
+ // C3 97 is UTF-8 for U+00D7 (multiplication sign).
+ return filename + String::format(" (%d\xC3\x97%d)", size.width(), size.height());
+}
+
+// We don't use these strings, so they return an empty String. We can't just
+// make them asserts because webcore still calls them.
+String contextMenuItemTagOpenLinkInNewWindow() { return String(); }
+String contextMenuItemTagDownloadLinkToDisk() { return String(); }
+String contextMenuItemTagCopyLinkToClipboard() { return String(); }
+String contextMenuItemTagOpenImageInNewWindow() { return String(); }
+String contextMenuItemTagDownloadImageToDisk() { return String(); }
+String contextMenuItemTagCopyImageToClipboard() { return String(); }
+String contextMenuItemTagOpenFrameInNewWindow() { return String(); }
+String contextMenuItemTagCopy() { return String(); }
+String contextMenuItemTagGoBack() { return String(); }
+String contextMenuItemTagGoForward() { return String(); }
+String contextMenuItemTagStop() { return String(); }
+String contextMenuItemTagReload() { return String(); }
+String contextMenuItemTagCut() { return String(); }
+String contextMenuItemTagPaste() { return String(); }
+String contextMenuItemTagNoGuessesFound() { return String(); }
+String contextMenuItemTagIgnoreSpelling() { return String(); }
+String contextMenuItemTagLearnSpelling() { return String(); }
+String contextMenuItemTagSearchWeb() { return String(); }
+String contextMenuItemTagLookUpInDictionary() { return String(); }
+String contextMenuItemTagOpenLink() { return String(); }
+String contextMenuItemTagIgnoreGrammar() { return String(); }
+String contextMenuItemTagSpellingMenu() { return String(); }
+String contextMenuItemTagCheckSpelling() { return String(); }
+String contextMenuItemTagCheckSpellingWhileTyping() { return String(); }
+String contextMenuItemTagCheckGrammarWithSpelling() { return String(); }
+String contextMenuItemTagFontMenu() { return String(); }
+String contextMenuItemTagBold() { return String(); }
+String contextMenuItemTagItalic() { return String(); }
+String contextMenuItemTagUnderline() { return String(); }
+String contextMenuItemTagOutline() { return String(); }
+String contextMenuItemTagWritingDirectionMenu() { return String(); }
+String contextMenuItemTagTextDirectionMenu() { return String(); }
+String contextMenuItemTagDefaultDirection() { return String(); }
+String contextMenuItemTagLeftToRight() { return String(); }
+String contextMenuItemTagRightToLeft() { return String(); }
+String contextMenuItemTagInspectElement() { return String(); }
+String contextMenuItemTagShowSpellingPanel(bool show) { return String(); }
+
+// FIXME: These should return something.
+String mediaElementLiveBroadcastStateText() { return String(); }
+String mediaElementLoadingStateText() { return String(); }
+
+} // namespace WebCore
diff --git a/webkit/glue/localized_strings.cc b/webkit/glue/localized_strings.cc
deleted file mode 100644
index ffdf125..0000000
--- a/webkit/glue/localized_strings.cc
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "LocalizedStrings.h"
-#include "PlatformString.h"
-#include "IntSize.h"
-
-#undef LOG
-
-#include "base/logging.h"
-#include "base/file_util.h"
-#include "base/string16.h"
-#include "base/string_util.h"
-#include "grit/webkit_strings.h"
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webkit_glue.h"
-
-
-using namespace WebCore;
-
-inline String GetLocalizedString(int message_id) {
- const string16& str = webkit_glue::GetLocalizedString(message_id);
- return webkit_glue::String16ToString(str);
-}
-
-String WebCore::searchableIndexIntroduction() {
- return GetLocalizedString(IDS_SEARCHABLE_INDEX_INTRO);
-}
-String WebCore::submitButtonDefaultLabel() {
- return GetLocalizedString(IDS_FORM_SUBMIT_LABEL);
-}
-String WebCore::inputElementAltText() {
- return GetLocalizedString(IDS_FORM_INPUT_ALT);
-}
-String WebCore::resetButtonDefaultLabel() {
- return GetLocalizedString(IDS_FORM_RESET_LABEL);
-}
-String WebCore::fileButtonChooseFileLabel() {
- return GetLocalizedString(IDS_FORM_FILE_BUTTON_LABEL);
-}
-String WebCore::fileButtonNoFileSelectedLabel() {
- return GetLocalizedString(IDS_FORM_FILE_NO_FILE_LABEL);
-}
-
-String WebCore::searchMenuNoRecentSearchesText() {
- return GetLocalizedString(IDS_RECENT_SEARCHES_NONE);
-}
-String WebCore::searchMenuRecentSearchesText() {
- return GetLocalizedString(IDS_RECENT_SEARCHES);
-}
-String WebCore::searchMenuClearRecentSearchesText() {
- return GetLocalizedString(IDS_RECENT_SEARCHES_CLEAR);
-}
-
-// A11y strings.
-String WebCore::AXWebAreaText() {
- return GetLocalizedString(IDS_AX_ROLE_WEB_AREA);
-}
-String WebCore::AXLinkText() {
- return GetLocalizedString(IDS_AX_ROLE_LINK);
-}
-String WebCore::AXListMarkerText() {
- return GetLocalizedString(IDS_AX_ROLE_LIST_MARKER);
-}
-String WebCore::AXImageMapText() {
- return GetLocalizedString(IDS_AX_ROLE_IMAGE_MAP);
-}
-String WebCore::AXHeadingText() {
- return GetLocalizedString(IDS_AX_ROLE_HEADING);
-}
-String WebCore::AXDefinitionListTermText() {
- NOTIMPLEMENTED();
- return String("term");
-}
-String WebCore::AXDefinitionListDefinitionText() {
- NOTIMPLEMENTED();
- return String("definition");
-}
-String WebCore::AXButtonActionVerb() {
- return GetLocalizedString(IDS_AX_BUTTON_ACTION_VERB);
-}
-String WebCore::AXRadioButtonActionVerb() {
- return GetLocalizedString(IDS_AX_RADIO_BUTTON_ACTION_VERB);
-}
-String WebCore::AXTextFieldActionVerb() {
- return GetLocalizedString(IDS_AX_TEXT_FIELD_ACTION_VERB);
-}
-String WebCore::AXCheckedCheckBoxActionVerb() {
- return GetLocalizedString(IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB);
-}
-String WebCore::AXUncheckedCheckBoxActionVerb() {
- return GetLocalizedString(IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB);
-}
-String WebCore::AXLinkActionVerb() {
- return GetLocalizedString(IDS_AX_LINK_ACTION_VERB);
-}
-
-String WebCore::multipleFileUploadText(unsigned number_of_files) {
- return webkit_glue::String16ToString(ReplaceStringPlaceholders(
- webkit_glue::GetLocalizedString(IDS_FORM_FILE_MULTIPLE_UPLOAD),
- WideToUTF16Hack(UintToWString(number_of_files)),
- NULL));
-}
-// Used in FTPDirectoryDocument.cpp
-String WebCore::unknownFileSizeText() {
- return String();
-}
-
-// The following two functions are not declared in LocalizedStrings.h.
-// They are used by the menu for the HTML keygen tag.
-namespace WebCore {
-String keygenMenuHighGradeKeySize() {
- return GetLocalizedString(IDS_KEYGEN_HIGH_GRADE_KEY);
-}
-String keygenMenuMediumGradeKeySize() {
- return GetLocalizedString(IDS_KEYGEN_MED_GRADE_KEY);
-}
-
-// Used in ImageDocument.cpp as the title for pages when that page is an image.
-String imageTitle(const String& filename, const IntSize& size) {
- // C3 97 is UTF-8 for U+00D7 (multiplication sign).
- std::string size_str = StringPrintf(" (%d\xC3\x97%d)",
- size.width(), size.height());
- return filename + webkit_glue::StdStringToString(size_str);
-}
-
-} //namespace WebCore
-
-// We don't use these strings, so they return an empty String. We can't just
-// make them asserts because webcore still calls them.
-String WebCore::contextMenuItemTagOpenLinkInNewWindow() { return String(); }
-String WebCore::contextMenuItemTagDownloadLinkToDisk() { return String(); }
-String WebCore::contextMenuItemTagCopyLinkToClipboard() { return String(); }
-String WebCore::contextMenuItemTagOpenImageInNewWindow() { return String(); }
-String WebCore::contextMenuItemTagDownloadImageToDisk() { return String(); }
-String WebCore::contextMenuItemTagCopyImageToClipboard() { return String(); }
-String WebCore::contextMenuItemTagOpenFrameInNewWindow() { return String(); }
-String WebCore::contextMenuItemTagCopy() { return String(); }
-String WebCore::contextMenuItemTagGoBack() { return String(); }
-String WebCore::contextMenuItemTagGoForward() { return String(); }
-String WebCore::contextMenuItemTagStop() { return String(); }
-String WebCore::contextMenuItemTagReload() { return String(); }
-String WebCore::contextMenuItemTagCut() { return String(); }
-String WebCore::contextMenuItemTagPaste() { return String(); }
-String WebCore::contextMenuItemTagNoGuessesFound() { return String(); }
-String WebCore::contextMenuItemTagIgnoreSpelling() { return String(); }
-String WebCore::contextMenuItemTagLearnSpelling() { return String(); }
-String WebCore::contextMenuItemTagSearchWeb() { return String(); }
-String WebCore::contextMenuItemTagLookUpInDictionary() { return String(); }
-String WebCore::contextMenuItemTagOpenLink() { return String(); }
-String WebCore::contextMenuItemTagIgnoreGrammar() { return String(); }
-String WebCore::contextMenuItemTagSpellingMenu() { return String(); }
-String WebCore::contextMenuItemTagCheckSpelling() { return String(); }
-String WebCore::contextMenuItemTagCheckSpellingWhileTyping() { return String(); }
-String WebCore::contextMenuItemTagCheckGrammarWithSpelling() { return String(); }
-String WebCore::contextMenuItemTagFontMenu() { return String(); }
-String WebCore::contextMenuItemTagBold() { return String(); }
-String WebCore::contextMenuItemTagItalic() { return String(); }
-String WebCore::contextMenuItemTagUnderline() { return String(); }
-String WebCore::contextMenuItemTagOutline() { return String(); }
-String WebCore::contextMenuItemTagWritingDirectionMenu() { return String(); }
-String WebCore::contextMenuItemTagTextDirectionMenu() { return String(); }
-String WebCore::contextMenuItemTagDefaultDirection() { return String(); }
-String WebCore::contextMenuItemTagLeftToRight() { return String(); }
-String WebCore::contextMenuItemTagRightToLeft() { return String(); }
-String WebCore::contextMenuItemTagInspectElement() { return String(); }
-String WebCore::contextMenuItemTagShowSpellingPanel(bool show) { return String(); }
-// TODO(scherkus): These should return something.
-String WebCore::mediaElementLiveBroadcastStateText() { return String(); }
-String WebCore::mediaElementLoadingStateText() { return String(); }
diff --git a/webkit/glue/password_autocomplete_listener.cc b/webkit/glue/password_autocomplete_listener.cc
index 80e51a4..ac0b16d 100644
--- a/webkit/glue/password_autocomplete_listener.cc
+++ b/webkit/glue/password_autocomplete_listener.cc
@@ -5,11 +5,15 @@
// This file provides the implementaiton of the password manager's autocomplete
// component.
-#include "webkit/glue/password_autocomplete_listener.h"
+#include "config.h"
+
+#include "HTMLInputElement.h"
#undef LOG
+
#include "base/logging.h"
#include "base/string_util.h"
#include "webkit/glue/glue_util.h"
+#include "webkit/glue/password_autocomplete_listener.h"
#include "webkit/glue/webframe_impl.h"
#include "webkit/glue/webview_impl.h"
diff --git a/webkit/glue/password_autocomplete_listener.h b/webkit/glue/password_autocomplete_listener.h
index c56c0189..a5fbce1 100644
--- a/webkit/glue/password_autocomplete_listener.h
+++ b/webkit/glue/password_autocomplete_listener.h
@@ -8,18 +8,14 @@
#ifndef WEBKIT_GLUE_PASSWORD_AUTOCOMPLETE_LISTENER_H_
#define WEBKIT_GLUE_PASSWORD_AUTOCOMPLETE_LISTENER_H_
-#include "config.h"
-
-#include "base/compiler_specific.h"
-
-MSVC_PUSH_WARNING_LEVEL(0);
-#include "HTMLInputElement.h"
-MSVC_POP_WARNING();
-
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "webkit/glue/password_form_dom_manager.h"
+namespace WebCore {
+class HTMLInputElement;
+}
+
namespace webkit_glue {
// A proxy interface to a WebCore::HTMLInputElement for inline autocomplete.
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index 29e108d..4087a2a 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -95,6 +95,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "GraphicsContext.h"
#include "HTMLCollection.h"
#include "HTMLHeadElement.h"
+#include "HTMLInputElement.h"
#include "HTMLFrameOwnerElement.h"
#include "HTMLLinkElement.h"
#include "HTMLNames.h"
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index 1a8a86d..c6bd4c8 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -9,6 +9,7 @@
#include "base/string_util.h"
#include "base/trace_event.h"
#include "grit/webkit_resources.h"
+#include "grit/webkit_strings.h"
#include "webkit/api/public/WebData.h"
#include "webkit/api/public/WebPluginListBuilder.h"
#include "webkit/api/public/WebString.h"
@@ -17,12 +18,66 @@
#include "webkit/glue/weburlloader_impl.h"
using WebKit::WebData;
+using WebKit::WebLocalizedString;
using WebKit::WebPluginListBuilder;
+using WebKit::WebString;
using WebKit::WebThemeEngine;
using WebKit::WebURLLoader;
namespace webkit_glue {
+static int ToMessageID(WebLocalizedString::Name name) {
+ switch (name) {
+ case WebLocalizedString::SubmitButtonDefaultLabel:
+ return IDS_FORM_SUBMIT_LABEL;
+ case WebLocalizedString::InputElementAltText:
+ return IDS_FORM_INPUT_ALT;
+ case WebLocalizedString::ResetButtonDefaultLabel:
+ return IDS_FORM_RESET_LABEL;
+ case WebLocalizedString::FileButtonChooseFileLabel:
+ return IDS_FORM_FILE_BUTTON_LABEL;
+ case WebLocalizedString::FileButtonNoFileSelectedLabel:
+ return IDS_FORM_FILE_NO_FILE_LABEL;
+ case WebLocalizedString::MultipleFileUploadText:
+ return IDS_FORM_FILE_MULTIPLE_UPLOAD;
+ case WebLocalizedString::SearchableIndexIntroduction:
+ return IDS_SEARCHABLE_INDEX_INTRO;
+ case WebLocalizedString::SearchMenuNoRecentSearchesText:
+ return IDS_RECENT_SEARCHES_NONE;
+ case WebLocalizedString::SearchMenuRecentSearchesText:
+ return IDS_RECENT_SEARCHES;
+ case WebLocalizedString::SearchMenuClearRecentSearchesText:
+ return IDS_RECENT_SEARCHES_CLEAR;
+ case WebLocalizedString::AXWebAreaText:
+ return IDS_AX_ROLE_WEB_AREA;
+ case WebLocalizedString::AXLinkText:
+ return IDS_AX_ROLE_LINK;
+ case WebLocalizedString::AXListMarkerText:
+ return IDS_AX_ROLE_LIST_MARKER;
+ case WebLocalizedString::AXImageMapText:
+ return IDS_AX_ROLE_IMAGE_MAP;
+ case WebLocalizedString::AXHeadingText:
+ return IDS_AX_ROLE_HEADING;
+ case WebLocalizedString::AXButtonActionVerb:
+ return IDS_AX_BUTTON_ACTION_VERB;
+ case WebLocalizedString::AXRadioButtonActionVerb:
+ return IDS_AX_RADIO_BUTTON_ACTION_VERB;
+ case WebLocalizedString::AXTextFieldActionVerb:
+ return IDS_AX_TEXT_FIELD_ACTION_VERB;
+ case WebLocalizedString::AXCheckedCheckBoxActionVerb:
+ return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB;
+ case WebLocalizedString::AXUncheckedCheckBoxActionVerb:
+ return IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB;
+ case WebLocalizedString::AXLinkActionVerb:
+ return IDS_AX_LINK_ACTION_VERB;
+ case WebLocalizedString::KeygenMenuHighGradeKeySize:
+ return IDS_KEYGEN_HIGH_GRADE_KEY;
+ case WebLocalizedString::KeygenMenuMediumGradeKeySize:
+ return IDS_KEYGEN_MED_GRADE_KEY;
+ }
+ return -1;
+}
+
WebKitClientImpl::WebKitClientImpl()
: main_loop_(MessageLoop::current()),
shared_timer_func_(NULL) {
@@ -125,6 +180,24 @@ WebData WebKitClientImpl::loadResource(const char* name) {
return WebData();
}
+WebString WebKitClientImpl::queryLocalizedString(
+ WebLocalizedString::Name name) {
+ int message_id = ToMessageID(name);
+ if (message_id < 0)
+ return WebString();
+ return GetLocalizedString(message_id);
+}
+
+WebString WebKitClientImpl::queryLocalizedString(
+ WebLocalizedString::Name name, int numeric_value) {
+ int message_id = ToMessageID(name);
+ if (message_id < 0)
+ return WebString();
+ return ReplaceStringPlaceholders(GetLocalizedString(message_id),
+ IntToString16(numeric_value),
+ NULL);
+}
+
double WebKitClientImpl::currentTime() {
return base::Time::Now().ToDoubleT();
}
diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h
index 54f691c..b97d63a 100644
--- a/webkit/glue/webkitclient_impl.h
+++ b/webkit/glue/webkitclient_impl.h
@@ -28,6 +28,10 @@ class WebKitClientImpl : public WebKit::WebKitClient {
virtual void traceEventBegin(const char* name, void* id, const char* extra);
virtual void traceEventEnd(const char* name, void* id, const char* extra);
virtual WebKit::WebData loadResource(const char* name);
+ virtual WebKit::WebString queryLocalizedString(
+ WebKit::WebLocalizedString::Name name);
+ virtual WebKit::WebString queryLocalizedString(
+ WebKit::WebLocalizedString::Name name, int numeric_value);
virtual double currentTime();
virtual void setSharedTimerFiredFunction(void (*func)());
virtual void setSharedTimerFireTime(double fireTime);
diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h
index 8b832ae..eafff01 100644
--- a/webkit/tools/test_shell/test_shell_webkit_init.h
+++ b/webkit/tools/test_shell/test_shell_webkit_init.h
@@ -71,6 +71,11 @@ class TestShellWebKitInit : public webkit_glue::WebKitClientImpl {
return NULL;
}
+ virtual bool getFileSize(const WebKit::WebString& path, long long& result) {
+ return file_util::GetFileSize(
+ FilePath(webkit_glue::WebStringToFilePathString(path)), &result);
+ }
+
virtual unsigned long long visitedLinkHash(const char* canonicalURL,
size_t length) {
return 0;
@@ -97,11 +102,6 @@ class TestShellWebKitInit : public webkit_glue::WebKitClientImpl {
virtual void prefetchHostName(const WebKit::WebString&) {
}
- virtual bool getFileSize(const WebKit::WebString& path, long long& result) {
- return file_util::GetFileSize(
- FilePath(webkit_glue::WebStringToFilePathString(path)), &result);
- }
-
virtual WebKit::WebData loadResource(const char* name) {
if (!strcmp(name, "deleteButton")) {
// Create a red 30x30 square.
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index db0c323..655fc11 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -995,6 +995,7 @@
'api/public/WebInputEvent.h',
'api/public/WebKit.h',
'api/public/WebKitClient.h',
+ 'api/public/WebLocalizedString.h',
'api/public/WebMediaPlayer.h',
'api/public/WebMediaPlayerClient.h',
'api/public/WebMimeRegistry.h',
@@ -1034,6 +1035,7 @@
'api/src/x11/WebScreenInfoFactory.cpp',
'api/src/mac/WebInputEventFactory.mm',
'api/src/mac/WebScreenInfoFactory.mm',
+ 'api/src/LocalizedStrings.cpp',
'api/src/MediaPlayerPrivateChromium.cpp',
'api/src/ResourceHandle.cpp',
'api/src/TemporaryGlue.h',
@@ -1325,7 +1327,6 @@
'glue/image_resource_fetcher.h',
'glue/inspector_client_impl.cc',
'glue/inspector_client_impl.h',
- 'glue/localized_strings.cc',
'glue/multipart_response_delegate.cc',
'glue/multipart_response_delegate.h',
'glue/npruntime_util.cc',